[FIX] account: yml issue
[odoo/odoo.git] / addons / account / test / account_customer_invoice.yml
1 -
2   In order to test account invoice I create a new customer invoice
3 -
4   !record {model: account.invoice, id: account_invoice_customer0}:
5     account_id: account.a_recv
6     address_contact_id: base.res_partner_address_zen
7     address_invoice_id: base.res_partner_address_zen
8     company_id: base.main_company
9     currency_id: base.EUR
10     date_invoice: '2010-05-26'
11     invoice_line:
12       - account_id: account.a_sale
13         name: '[PC3] Medium PC'
14         price_unit: 900.0
15         quantity: 10.0
16         product_id: product.product_product_pc3
17         uos_id: product.product_uom_unit
18     journal_id: account.sales_journal
19     partner_id: base.res_partner_3
20     reference_type: none
21 -
22   I check that Initially customer invoice is in the "Draft" state
23 -
24   !assert {model: account.invoice, id: account_invoice_customer0}:
25     - state == 'draft'
26 -
27   I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
28 -
29   !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_customer0}
30 -
31   I check that the invoice state is now "Proforma2"
32 -
33   !assert {model: account.invoice, id: account_invoice_customer0}:
34     - state == 'proforma2'
35 -
36   I check that there is no move attached to the invoice
37 -
38   !python {model: account.invoice}: |
39     acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
40     assert (not acc_id.move_id), "Move falsely created at pro-forma"
41 -
42   I create invoice by clicking on Create button
43 -
44   !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0}
45 -
46   I check that the invoice state is "Open"
47 -
48   !assert {model: account.invoice, id: account_invoice_customer0}:
49     - state == 'open'
50
51 -
52   I check that now there is a move attached to the invoice
53 -
54   !python {model: account.invoice}: |
55     acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
56     assert acc_id.move_id, "Move not created for open invoice"
57 -
58   I create a record for partial payment of 1000 EUR.
59 -
60   !record {model: account.invoice.pay, id: account_invoice_pay_first0}:
61     amount: 1000.0
62     date: '2010-05-26'
63     journal_id: account.sales_journal
64     name: First payment for [PC3] Medium PC to Distrib PC
65     period_id: account.period_5
66 -
67   I make partial payment by clicking on Partial Payment button
68 -
69   !python {model: account.invoice.pay}: |
70     self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_first0")], {"lang":
71       'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
72       [ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"),
73       })
74 -
75   I check that the invoice state is still open
76 -
77   !assert {model: account.invoice, id: account_invoice_customer0}:
78     - state == 'open'
79 -
80   I make second partial payment of 6000 EUR.
81 -
82   !record {model: account.invoice.pay, id: account_invoice_pay_second0}:
83     amount: 6000.0
84     date: '2010-05-28'
85     journal_id: account.sales_journal
86     name: Second payment for [PC3] Medium PC to Distrib PC
87     period_id: account.period_5
88 -
89   I make partial payment by clicking on Partial Payment button
90
91 -
92   !python {model: account.invoice.pay}: |
93     self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_second0")], {"lang":
94       'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
95       [ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"),
96       })
97 -
98   I make final partial payment of 2000 EUR
99 -
100   !record {model: account.invoice.pay, id: account_invoice_pay_final0}:
101     amount: 2000.0
102     date: '2010-05-30'
103     journal_id: account.sales_journal
104     name: Final payment for [PC3] Medium PC to Distrib PC
105     period_id: account.period_5
106
107 -
108   I make partial payment by clicking on Partial Payment button
109
110 -
111   !python {model: account.invoice.pay}: |
112     self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_final0")], {"lang":
113       'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
114       [ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"),
115       })
116
117 -
118   I check that the invoice state is now Done
119 -
120   !assert {model: account.invoice, id: account_invoice_customer0}:
121     - state == 'paid'
122 -
123   I check that an payment entry gets created in the account.move.line
124 -
125   !python {model: account.invoice}: |
126     acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
127     assert(acc_id.move_id)
128 -
129   I refund the invoice Using Refund Button
130 -
131   !record {model: account.invoice.refund, id: account_invoice_refund_0}:
132     description: Refund To China Export
133     period: account.period_5
134     filter_refund: refund
135 -
136   I clicked on refund button
137 -
138   !python {model: account.invoice.refund}: |
139     self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US', "tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account.account_invoice_customer0"), })
140 -
141   I checked that a new entry with state "Draft" created in account move line
142
143