[FIX] sale, sale_stock: Changing the product uom
When changing the product in a SO line, the uom must be change if the uom category of the product is different of the uom set. Closes #11241 opw:671367
This commit is contained in:
+1
-1
@@ -728,7 +728,7 @@ class SaleOrderLine(models.Model):
|
||||
|
||||
vals = {}
|
||||
domain = {'product_uom': [('category_id', '=', self.product_id.uom_id.category_id.id)]}
|
||||
if not (self.product_uom and (self.product_id.uom_id.category_id.id == self.product_uom.category_id.id)):
|
||||
if not self.product_uom or (self.product_id.uom_id.category_id.id != self.product_uom.category_id.id):
|
||||
vals['product_uom'] = self.product_id.uom_id
|
||||
|
||||
product = self.product_id.with_context(
|
||||
|
||||
@@ -130,7 +130,13 @@ class SaleOrderLine(models.Model):
|
||||
return self._check_package()
|
||||
return {}
|
||||
|
||||
@api.onchange('product_id', 'product_uom_qty', 'product_uom', 'route_id')
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product_id_uom_check_availability(self):
|
||||
if not self.product_uom or (self.product_id.uom_id.category_id.id != self.product_uom.category_id.id):
|
||||
self.product_uom = self.product_id.uom_id
|
||||
self._onchange_product_id_check_availability()
|
||||
|
||||
@api.onchange('product_uom_qty', 'product_uom', 'route_id')
|
||||
def _onchange_product_id_check_availability(self):
|
||||
if not self.product_id or not self.product_uom_qty or not self.product_uom:
|
||||
self.product_packaging = False
|
||||
|
||||
Reference in New Issue
Block a user