Skip to Content
Menu
This question has been flagged
1 Reply
1561 Views

i am trying to use one single button for two function, first i want to generate a sequence number and in a second place i want to print a pdf, in odoo here is my code

def print_pdf(self):
        if self.name:
            if self.my_number == _('New') or self.my_number == 'New':
                self.write({'my_number': self.env['ir.sequence'].next_by_code('shipset.bar')})
            return True
        return self.env.ref('module_extend.action_report_styn').report_action(self)



but i can't print my pdf, what i am missing else ? 

Avatar
Discard
Best Answer

   Hi,

     remove return True     


def print_pdf(self):

            if self.name:

                if self.my_number == _('New') or self.my_number == 'New':

                    self.write({'my_number': self.env['ir.sequence'].next_by_code('shipset.bar')})

            return self.env.ref('module_extend.action_report_styn').report_action(self

Avatar
Discard
Related Posts Replies Views Activity
0
Sep 23
383
4
May 24
10077
1
Apr 24
1565
0
Nov 23
525
1
Sep 23
570