From 5f0bbe797f2bc369303865b2222d8a651385586d Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 2 Nov 2016 12:05:06 +0100 Subject: [PATCH] [FIX] sale: product_id_change with different unit of measure When changing the product of SO line if the uom_id is different, the uom of the product must be changed and quantity ordered is set to 1.0. opw:692556 --- addons/sale/sale.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 661880cfd98..8142a39f416 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -744,13 +744,14 @@ class SaleOrderLine(models.Model): vals = {} domain = {'product_uom': [('category_id', '=', self.product_id.uom_id.category_id.id)]} - if not self.product_uom or (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.id != self.product_uom.id): vals['product_uom'] = self.product_id.uom_id + vals['product_uom_qty'] = 1.0 product = self.product_id.with_context( lang=self.order_id.partner_id.lang, partner=self.order_id.partner_id.id, - quantity=self.product_uom_qty, + quantity=vals.get('product_uom_qty') or self.product_uom_qty, date=self.order_id.date_order, pricelist=self.order_id.pricelist_id.id, uom=self.product_uom.id