summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>2012-10-01 18:08:54 +0200
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>2012-10-01 18:08:54 +0200
commit2b07b4e35c5ee619eaf93a7bb4fb14a37e55fb0e (patch)
treeb85a2e53672c7170039b68ef7d3998ebe327deb9
parent6251b57b39ac2a01d907f1f5f6fccf13a0319830 (diff)
[FIX] sale, sale_stock: yaml tests on product_id_change() + fix in that same function (type is defined in sale_stock now)
bzr revid: qdp-launchpad@openerp.com-20121001160854-7d2xew5pol6u27b2
-rw-r--r--addons/sale/sale.py1
-rw-r--r--addons/sale/sale_view.xml5
-rw-r--r--addons/sale/test/sale_order_demo.yml14
-rw-r--r--addons/sale_stock/test/sale_order_onchange.yml14
4 files changed, 14 insertions, 20 deletions
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 96f44d353d6..f9dc3c62281 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -899,7 +899,6 @@ class sale_order_line(osv.osv):
fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False
if update_tax: #The quantity only have changed
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, product_obj.taxes_id)
- result.update({'type': product_obj.procure_method})
if not flag:
result['name'] = self.pool.get('product.product').name_get(cr, uid, [product_obj.id], context=context_partner)[0][1]
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 23d2c556f40..620991d8053 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -200,8 +200,7 @@
<field name="product_id"
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
groups="base.group_user"
- on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
- <label for="product_uom_qty"/>
+ on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
<div>
<field
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
@@ -237,7 +236,7 @@
<field name="invoice_lines"/>
</div>
</form>
- <tree string="Sales Order Lines" editable="bottom">
+ <tree string="Sales Order Lines">
<field name="sequence" widget="handle"/>
<field name="state" invisible="1"/>
<field name="th_weight" invisible="1"/>
diff --git a/addons/sale/test/sale_order_demo.yml b/addons/sale/test/sale_order_demo.yml
index 5b1c08bb5e1..7e5a223e8b0 100644
--- a/addons/sale/test/sale_order_demo.yml
+++ b/addons/sale/test/sale_order_demo.yml
@@ -5,14 +5,12 @@
partner_id: base.res_partner_2
note: Invoice after delivery
payment_term: account.account_payment_term
--
- !record {model: sale.order.line, id: line}:
- order_id: sale_order_test1
- product_id: product.product_product_7
- product_uom_qty: 8
+ order_line:
+ - product_id: product.product_product_7
+ product_uom_qty: 8
-
I verify that the onchange was correctly triggered
-
- !assert {model: sale.order.line, id: sale.line, string: The onchange function of product was not correctly triggered}:
- - l.name == '17” LCD Monitor'
- - l.price_unit == 1350.0
+ !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
diff --git a/addons/sale_stock/test/sale_order_onchange.yml b/addons/sale_stock/test/sale_order_onchange.yml
index 4561742976e..015e857ec58 100644
--- a/addons/sale_stock/test/sale_order_onchange.yml
+++ b/addons/sale_stock/test/sale_order_onchange.yml
@@ -10,15 +10,13 @@
-
!record {model: sale.order, id: sale_order_onchange1}:
partner_id: base.res_partner_2
--
- !record {model: sale.order.line, id: line_onchange}:
- order_id: sale_order_onchange1
- product_id: sale_stock.product_onchange1
- product_uom_qty: 10
+ order_line:
+ - product_id: sale_stock.product_onchange1
+ product_uom_qty: 10
-
I verify that the onchange of product on sale order line was correctly triggered
-
!assert {model: sale.order.line, id: sale.line, string: The onchange function of product was not correctly triggered}:
- - l.name == 'Devil Worship Book'
- - l.price_unit == 66.6
- - l.type == 'make_to_order'
+ - order_line[0].name == u'Devil Worship Book'
+ - order_line[0].price_unit == 66.6
+ - order_line[0].type == 'make_to_order'