Help

7

how to pop up a existing module form after a button press

Avatar
Abraham Qureshi

hai

how to pop up a existing module form after a button press?

def action_approve(self):
        self.state='approved'
        invoices=self.env['account.invoice'].create({
            'type': 'out_invoice',
            'partner_id': self.partner_id.id,
            'user_id': self.env.user.id,
            'admission_id': self.name ,
            'origin': self.name,
            'invoice_line_ids': [(0, 0, {
                'name': 'Invoice For Admission',
                'quantity': 1,
                'price_unit': 500,
                'account_id': 41,
            })],
        })



i need to display a form for invoice  created


2 Comments
Avatar
Discard
Avatar
Sehrish
-
Avatar
Abraham Qureshi
-

its not working

1 Answer
1
Avatar
Mitul Shingala
Best Answer

hello,

add the return action in your method.

@api.multi

def action_approve(self):
        self.state='approved'
        invoices=self.env['account.invoice'].create({
            'type': 'out_invoice',
            'partner_id': self.partner_id.id,
            'user_id': self.env.user.id,
            'admission_id': self.name ,
            'origin': self.name,
            'invoice_line_ids': [(0, 0, {
                'name': 'Invoice For Admission',
                'quantity': 1,
                'price_unit': 500,
                'account_id': 41,
            })],
        })

        return {
            'name': _('Customer Invoice'),
            'view_type': 'form',
            'view_mode': 'form',
            'res_model': 'account.invoice',
            'type': 'ir.actions.act_window',
           'res_id': invoices.id,
            'context': self.env.context,
        }

 


1 Comment
Avatar
Discard
Avatar
Abraham Qureshi
-

thank you