summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2013-01-31 19:43:56 +0100
committerOlivier Dony <odo@openerp.com>2013-01-31 19:43:56 +0100
commitec9859e0a0acdc8f4ea4e4cde467023d6cae985e (patch)
tree20d22c69a0cbbe5f37a85a1abe91f426f705014f
parent9b3e333d678c6acf117db92cf1abad55c0a4d567 (diff)
[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
-rw-r--r--addons/sale/sale.py1
-rw-r--r--addons/sale/test/sale_order_demo.yml20
2 files changed, 20 insertions, 1 deletions
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