[IMP] point_of_sale: new weighting workflow
[odoo/odoo.git] / addons / point_of_sale / test / 02_order_to_invoice.yml
1 -
2   I create a new PoS order with 2 units of PC1 at 450 EUR (Tax Incl) and 3 units of PC2 at 300 EUR. (Tax Excl)
3 -
4   !record {model: pos.order, id: pos_order_pos1}:
5     company_id: base.main_company
6     partner_id: base.res_partner_asus
7     lines:
8       - name: OL/0001
9         product_id: product.product_product_pc1
10         price_unit: 450
11         discount: 5.0
12         qty: 2.0
13       - name: OL/0002
14         product_id: product.product_product_pc2
15         price_unit: 300
16         discount: 5.0
17         qty: 3.0
18 -
19   I click on the "Make Payment" wizard to pay the PoS order
20
21   !record {model: pos.make.payment, id: pos_make_payment_2, context: '{"active_id": ref("pos_order_pos1"), "active_ids": [ref("pos_order_pos1")]}' }:
22     amount: !eval >
23         (450*2 + 300*3*1.05)*0.95
24 -
25   I click on the validate button to register the payment.
26 -
27   !python {model: pos.make.payment}: |
28     self.check(cr, uid, [ref('pos_make_payment_2')], context={'active_id': ref('pos_order_pos1')} )
29 - |
30   I check that the order is marked as paid and there is no invoice attached to it
31 -
32   !python {model: pos.order}: |
33     order = self.browse(cr,uid,ref('pos_order_pos1'))
34 -
35   !assert {model: pos.order, id: pos_order_pos1, string: State not correct}:
36      - state == 'paid'
37      - not invoice_id
38
39   I generate the invoice by pressing the Invoice button that calls the workflow
40 -
41   !workflow {model: pos.order, action: invoice, ref: pos_order_pos1}
42 -
43   I test that the total of the attached invoice is correct
44 -
45   !assert {model: pos.order, id: pos_order_pos1, string: Invoice not correct}:
46      - amount_total == (450*2 + 300*3*1.05)*0.95