Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5827 Lượt xem

Hello Guys

I have created  a report like this :

<report
      id="action_report_batch_product_config"
      string="GuiLherme Configuration Configuration"
      model="stock.picking.batch"
      report_type="qweb-pdf"
      name="teste2"
      file="teste2"
      paperformat=format_teste"
      menu="True"
print_report_name="'Batch Product Config- %s' % (object.name)"
  />

It worked as expected. However I need to show it and sometimes I need to get it invisible due the value that I have in the stock.picking.batch model.

Could u please help me on that ?

Thank you so much

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Easily what you can do is that, hide the report from the print by giving menu="False" inside the report tag(which you shown in the question) and print the same report from a button in the header of the form. Once you add the button in form and use it for printing, you can easily make it visible and invisible using the attrs .

<report
id="action_report_batch_product_config"
string="GuiLherme Configuration Configuration"
model="stock.picking.batch"
report_type="qweb-pdf"
name="teste2"
file="teste2"
menu="False"
print_report_name="'Batch Product Config- %s' % (object.name)"/>

Add a button to form view,

<button name="print_picking_new" string="Print" type="object" class="oe_highlight"/>


then in the model,

def print_picking_new(self):
return self.env.ref('module_name.action_report_batch_product_config').report_action(self)


Now the print button will be visible always, for making it visible and invisible you can add attrs and give condition, a sample is given below,


<button string="Configure Variants" type="action"
name="%(product_attribute_value_action)d"
attrs="{'invisible': ['|', ('attribute_line_ids', '&lt;=', 0), ('is_product_variant', '=', True)]}"
groups="product.group_product_variant"/>


Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 25
1196
2
thg 3 25
1328
1
thg 11 24
1102
4
thg 11 24
7051
1
thg 3 24
1965