diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 93951e68904..83a4c015179 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1316,9 +1316,6 @@ class AccountInvoiceLine(models.Model): self.price_unit = 0.0 domain['uom_id'] = [] else: - # Use the purchase uom by default - self.uom_id = self.product_id.uom_po_id - if part.lang: product = self.product_id.with_context(lang=part.lang) else: diff --git a/addons/purchase/models/account_invoice.py b/addons/purchase/models/account_invoice.py index 0aed9c09c26..43ffb17dddf 100644 --- a/addons/purchase/models/account_invoice.py +++ b/addons/purchase/models/account_invoice.py @@ -59,6 +59,13 @@ class AccountInvoice(models.Model): data['account_id'] = account.id return data + def _onchange_product_id(self): + domain = super(AccountInvoice, self)._onchange_product_id() + if self.purchase_id: + # Use the purchase uom by default + self.uom_id = self.product_id.uom_po_id + return domain + # Load all unsold PO lines @api.onchange('purchase_id') def purchase_order_change(self):