跳至内容
菜单
此问题已终结
3 回复
3504 查看

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


形象
丢弃
编写者

its not working

最佳答案

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,
        }

 


形象
丢弃
编写者

thank you

相关帖文 回复 查看 活动
3
3月 15
4975
1
7月 25
493
2
7月 25
653
1
7月 25
1719
3
4月 25
1741