如何将参数从一个env传递到另一个env。目标是在付款向导中获取发票总额,以便用户了解他将要注册的金额。
class org_invoice(models.Model):
_name = 'org.invoice'
@api.multi
def register_payment(self):
object= self.env['org.reg_payment']
write_obj = object.create({'amount': self.total})
return {'name': "Register Payment",
'type': 'ir.actions.act_window',
'res_model': 'org.reg_payment',
'res_id': write_obj,
'view_id': False,
'view_type': 'form',
'view_mode': 'form',
'target': 'new',
'domain': '[]',
}
class org_reg_payment(models.Model):
_name = 'org.reg_payment'
name = fields.Char()
accounts = fields.Many2one('org.accounts')
amount = fields.Float()
答案 0 :(得分:1)
您需要更改结构
'res_id': write_obj.id,
是的。