Fork of Odoo (formerly OpenERP). [This project is not publically mantained just born for internal usage with some little patches] go to official repository on github.com/odoo/odoo
commit e1aaa68d81a56792da13e18a76ec86544bfd393e
Author: Arnold Moyaux <arm@odoo.com>
Date: Mon Dec 11 10:47:42 2017 +0100
[FIX] purchase: Only use purchase UOM on vendor bill
It was the purpose of this commit fea667a2433dfc2387daa7051989e840d30e18e0
However it uses purchase uom in any cases and not
only vendor bill.
This commit correct it by using it only if a purchase
order is linked to the invoice.
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py
index e3150abb86f..1bf3ceb66d9 100644
--- a/addons/account/models/account_invoice.py
+++ b/addons/account/models/account_invoice.py
@@ -1314,9 +1314,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):
The following commit will be deleted from vx/odoo since that odoo/odoo has applied this one from https://github.com/odoo/odoo/commit/6d02f7d6bfa5c59495c44db35d39a2eeef59e395