Skip to content
Browse files

[FIX] purchase: onchange at create

When creating an invoice programmatically, make sure to retrieve the
`currency_id` field set by `_onchange_partner_id`.

  • Loading branch information...
nim-odoo committed Mar 25, 2019
1 parent 1e9336a commit 576a15805c256c5d71e97573754be70274826940
Showing with 6 additions and 1 deletion.
  1. +6 −1 addons/purchase/models/
@@ -131,7 +131,7 @@ def _onchange_partner_id(self):
res = super(AccountInvoice, self)._onchange_partner_id()
if payment_term_id:
self.payment_term_id = payment_term_id
if not self.env.context.get('default_journal_id') and self.partner_id and self.currency_id and\
if not self.env.context.get('default_journal_id') and self.partner_id and\
self.type in ['in_invoice', 'in_refund'] and\
self.currency_id != self.partner_id.property_purchase_currency_id and\
@@ -172,6 +172,11 @@ def write(self, vals):
return result

def _get_onchange_create(self):
res = super()._get_onchange_create()
return res

class AccountInvoiceLine(models.Model):
""" Override AccountInvoice_line to add the link to the purchase order line it is related to"""

0 comments on commit 576a158

Please sign in to comment.
You can’t perform that action at this time.