Reputation: 487
How to pass argument from one env to another. The objective is to get the total of invoice in payment wizard so the user has the idea of what amount he is going to register.
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()
Upvotes: 0
Views: 1978
Reputation: 1575
You need to change the structure
'res_id': write_obj.id,
that's it.
Upvotes: 1