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