[IMP] sale_stock: added a test to verify the the product onchange in sale order line was correctly triggered

bzr revid: qdp-launchpad@openerp.com-20120928101531-sw1r2d5tc034ie23
This commit is contained in:
Quentin (OpenERP) 2012-09-28 12:15:31 +02:00
parent 20bf037ea4
commit 6251b57b39
4 changed files with 29 additions and 4 deletions

View File

@ -61,6 +61,7 @@ You can choose flexible invoicing methods:
'test': ['test/cancel_order_sale_stock.yml',
'test/picking_order_policy.yml',
'test/prepaid_order_policy.yml',
'test/sale_order_onchange.yml',
],
'installable': True,
'auto_install': True,

View File

@ -625,7 +625,7 @@ class sale_order_line(osv.osv):
uom = False
if not uom2:
uom2 = product_obj.uom_id
compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, precision_rounding=product_obj.uom_id.rounding)
if (product_obj.type=='product') and int(compare_qty) == -1 \
and (product_obj.procure_method=='make_to_stock'):

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<openerp>
<data>
<record id="view_sale_shop_form_inherit" model="ir.ui.view">
<field name="name">sale.shop.inherit.form</field>
<field name="model">sale.shop</field>
@ -13,7 +13,7 @@
</xpath>
</field>
</record>
<record id="view_shop_tree_inherit" model="ir.ui.view">
<field name="name">sale.shop.sale.stock</field>
<field name="model">sale.shop</field>
@ -41,7 +41,7 @@
</xpath>
<xpath expr="//button[@name='action_view_invoice']" position="after">
<button name="action_view_delivery" string="View Delivery Order" type="object" class="oe_highlight"
attrs="{'invisible': ['|','|','|',('picking_ids','=',False),('picking_ids','=',[]), ('state', 'not in', ('progress','manual')),('shipped','=',True)]}"/> </xpath>
attrs="{'invisible': ['|','|','|',('picking_ids','=',False),('picking_ids','=',[]), ('state', 'not in', ('progress','manual')),('shipped','=',True)]}"/> </xpath>
<xpath expr="//button[@name='action_cancel']" position="after">
<button name="ship_cancel" states="shipping_except" string="Cancel"/>
</xpath>

View File

@ -0,0 +1,24 @@
-
In order to test the onchange of the Sale Order, I create a product
-
!record {model: product.product, id: product_onchange1}:
name: 'Devil Worship Book'
list_price: 66.6
procure_method: 'make_to_order'
-
Now i create a sale order that uses my new product
-
!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
-
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'