From 136bd72379cb0c6bf9bc6d6d22d3811673c37012 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 27 Aug 2015 11:51:25 +0200 Subject: [PATCH] [FIX] sale: in a SO line, changing uom qty must change uos qty This is a oversight of the forward port af07b2a07587d83a67928cf30dd9172f2c870cb7 from 8.0 The revision in 8.0 is 9a9720ac14d3508e93339e351ba19de4b3ca2fd6 Not updating the product uos qty on updating the uom qty is wrong, and it has multiple side-effect. The SO line margin not being correctly recomputed when changing the quantity is one of them. opw-647810 --- addons/sale/sale.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index cb1597d5e34..8d4936293ca 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1165,7 +1165,10 @@ class sale_order_line(osv.osv): if update_tax: price = self.pool['account.tax']._fix_tax_included_price(cr, uid, price, product_obj.taxes_id, result['tax_id']) if context.get('uom_qty_change', False): + product_uos_qty = result.get('product_uos_qty') result, domain = {}, {} + if product_uos_qty: + result['product_uos_qty'] = product_uos_qty result.update({'price_unit': price}) return {'value': result, 'domain': domain}