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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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', '<=', 0), ('is_product_variant', '=', True)]}"
groups="product.group_product_variant"/>
Thanks
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Nov 24
|
128 | ||
|
4
Nov 24
|
5238 | ||
|
1
Mar 24
|
398 | ||
|
3
Sep 23
|
22661 | ||
|
0
Feb 24
|
1718 |