odoo/addons/sale/test/sale_order_demo.yml

41 lines
1.4 KiB
YAML

-
Test the data with salesman,
-
!context
uid: 'res_users_salesman'
-
In order to test process of the Sale Order, I create sale order
-
!record {model: sale.order, id: sale_order_test1}:
partner_id: base.res_partner_2
note: Invoice after delivery
payment_term: account.account_payment_term
order_line:
- product_id: product.product_product_7
product_uom_qty: 8
-
I verify that the onchange was correctly triggered
-
!assert {model: sale.order, id: sale.sale_order_test1, string: The onchange function of product was not correctly triggered}:
- order_line[0].name == u'[A8767] Apple In-Ear Headphones'
- order_line[0].price_unit == 79.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'[A8767] Apple In-Ear Headphones'
- order_line[0].price_unit == 79.0 * 12
- order_line[0].product_uom.id == ref('product.product_uom_dozen')
- order_line[0].product_uom_qty == 16