[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
This commit is contained in:
Quentin (OpenERP) 2012-10-01 18:08:54 +02:00
parent 6251b57b39
commit 2b07b4e35c
4 changed files with 14 additions and 20 deletions

View File

@ -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]

View File

@ -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"/>

View File

@ -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

View File

@ -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'