[FIX] mail: model can be None or uninstalled
[odoo/odoo.git] / addons / sale / test / sale_order_demo.yml
1 -
2   Test the data with salesman,
3 -
4   !context
5     uid: 'res_users_salesman'
6 -
7   In order to test process of the Sale Order, I create sale order
8 -
9   !record {model: sale.order, id: sale_order_test1}:
10     partner_id: base.res_partner_2
11     note: Invoice after delivery
12     payment_term: account.account_payment_term
13     order_line: 
14       - product_id: product.product_product_7
15         product_uom_qty: 8
16 -
17   I verify that the onchange was correctly triggered
18 -
19   !assert {model: sale.order, id: sale.sale_order_test1, string: The onchange function of product was not correctly triggered}:
20     - order_line[0].name == u'[A8767] Apple In-Ear Headphones'
21     - order_line[0].price_unit == 79.0
22     - order_line[0].product_uom_qty == 8
23     - order_line[0].product_uom.id == ref('product.product_uom_unit')
24
25 -
26   I create another sale order
27 -
28   !record {model: sale.order, id: sale_order_test2}:
29     partner_id: base.res_partner_2
30     order_line: 
31       - product_id: product.product_product_7
32         product_uom_qty: 16
33         product_uom: product.product_uom_dozen
34 -
35   I verify that the onchange was correctly triggered
36 -
37   !assert {model: sale.order, id: sale.sale_order_test2, string: The onchange function of product was not correctly triggered}:
38     - order_line[0].name == u'[A8767] Apple In-Ear Headphones'
39     - order_line[0].price_unit == 79.0 * 12
40     - order_line[0].product_uom.id == ref('product.product_uom_dozen')
41     - order_line[0].product_uom_qty == 16