Hi Gleb,
i think you need to first find the report external id defined in XML file and then inherit that XML code and add parameter invisible="1" to that code using xpath.
e.g. i have one report in account module and i want to hide then
<report
id="account_invoices"
model="account.invoice"
string="Invoices"
report_type="qweb-pdf"
name="account.report_invoice_with_payments"
file="account.report_invoice_with_payments"
attachment="(object.state in ('open','in_payment','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
print_report_name="(object._get_report_base_filename())"
groups="account.group_account_invoice"
/>
Then add invisible parameter like:
<report
id="account.account_invoices"
invisible="1"
model="account.invoice"
string="Invoices"
report_type="qweb-pdf"
name="account.report_invoice_with_payments"
file="account.report_invoice_with_payments"
attachment="(object.state in ('open','in_payment','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
print_report_name="(object._get_report_base_filename())"
groups="account.group_account_invoice"
/>
There is one module available to hide print button: https://goo.gl/nuvnmw
Accept and upvote answer if helpful
Thanks and regards
Haresh Kansara
Solution:
Use two methods
@api.multi
def create_action(self):
""" Create a contextual action for each report. """
for report in self:
model = self.env['ir.model']._get(report.model)
report.write({'binding_model_id': model.id, 'binding_type': 'report'})
return True
@api.multi
def unlink_action(self):
""" Remove the contextual actions created for the reports. """
self.check_access_rights('write', raise_exception=True)
self.filtered('binding_model_id').write({'binding_model_id': False})
return True