From ec9859e0a0acdc8f4ea4e4cde467023d6cae985e Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 31 Jan 2013 19:43:56 +0100 Subject: [PATCH] [FIX] sale: fix incorrect on_change on sale.order.line resetting the UoM field + added test lp bug: https://launchpad.net/bugs/1082409 fixed bzr revid: odo@openerp.com-20130131184356-y9ck1dr31nlsp73r --- addons/sale/sale.py | 1 - addons/sale/test/sale_order_demo.yml | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 66653c61849..cddde4a5f08 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -926,7 +926,6 @@ class sale_order_line(osv.osv): elif uom: # whether uos is set or not default_uom = product_obj.uom_id and product_obj.uom_id.id q = product_uom_obj._compute_qty(cr, uid, uom, qty, default_uom) - result['product_uom'] = default_uom if product_obj.uos_id: result['product_uos'] = product_obj.uos_id.id result['product_uos_qty'] = qty * product_obj.uos_coeff diff --git a/addons/sale/test/sale_order_demo.yml b/addons/sale/test/sale_order_demo.yml index 7e5a223e8b0..75e17ebeb02 100644 --- a/addons/sale/test/sale_order_demo.yml +++ b/addons/sale/test/sale_order_demo.yml @@ -14,3 +14,23 @@ !assert {model: sale.order, id: sale.sale_order_test1, string: The onchange function of product was not correctly triggered}: - order_line[0].name == u'[LCD17] 17\u201d LCD Monitor' - order_line[0].price_unit == 1350.0 + - order_line[0].product_uom_qty == 8 + - order_line[0].product_uom.id == ref('product.product_uom_unit') + +- + I create another sale order +- + !record {model: sale.order, id: sale_order_test2}: + partner_id: base.res_partner_2 + order_line: + - product_id: product.product_product_7 + product_uom_qty: 16 + product_uom: product.product_uom_dozen +- + I verify that the onchange was correctly triggered +- + !assert {model: sale.order, id: sale.sale_order_test2, string: The onchange function of product was not correctly triggered}: + - order_line[0].name == u'[LCD17] 17\u201d LCD Monitor' + - order_line[0].price_unit == 1350.0 * 12 + - order_line[0].product_uom.id == ref('product.product_uom_dozen') + - order_line[0].product_uom_qty == 16 \ No newline at end of file