pdf Print from python function – odoo


Python File

class AMCPaintBooth(models.Model):
    _name = 'amc.paint.booth'    
    @api.multi
    def action_amc_jobcard_pb_print(self):
        context = {
                'lang': 'en_US', 
                'active_ids': [self.id], 
                'tz': False, 
                'uid': 1
                }
        return {
            'context': context,
            'data': None,
            'type': 'ir.actions.report.xml',
            'report_name': 'safe_amc.safe_report_amc_jobcard_pb',
            'report_type': 'qweb-pdf',
            'report_file': 'safe_amc.safe_report_amc_jobcard_pb',
            'name': 'AMC',
        }

xml File

<header>
   <button name="action_amc_jobcard_pb_print" string="Print AMC Job Card" icon="fa-bars" type="object" class="oe_highlight"/>
</header>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.