majid
majid

Reputation: 271

How to add print button which is use to directly print report instead pressing ctrl+shift+p in odoo?

I am working on printing report where report first download or directly press ctrl+hift+p to print. How can i add button which directly print report instead pressing ctrl+shift+p?

Upvotes: 2

Views: 3574

Answers (1)

Chavada Viki
Chavada Viki

Reputation: 1524

Create a Button in form view.

<button type="object" name="print_report" />

On click of button call this method.

@api.multi
def print_report(self):
   return self.env['report'].get_action(self,'MODULE_NAME.REPORT_NAME')

Make sure you are having a report with name="MODULE_NAME.REPORT_NAME".

Upvotes: 5

Related Questions