[ADD] account, account_*: Add YAML test files
[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 create invoice by clicking on Create button
37 -
38   !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0}
39 -
40   I check that the invoice state is "Open"
41 -
42   !assert {model: account.invoice, id: account_invoice_customer0}:
43     - state == 'open'
44 -
45   I create a record for partial payment of 1000 EUR.
46 -
47   !record {model: account.invoice.pay, id: account_invoice_pay_first0}:
48     amount: 1000.0
49     date: '2010-05-26'
50     journal_id: account.sales_journal
51     name: First payment for [PC3] Medium PC to Distrib PC
52     period_id: account.period_5
53 -
54   I make partial payment by clicking on Partial Payment button
55 -
56   !python {model: account.invoice.pay}: |
57     self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_first0")], {"lang":
58       'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
59       [ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"),
60       })
61 -
62   I check that the invoice state is still open
63 -
64   !assert {model: account.invoice, id: account_invoice_customer0}:
65     - state == 'open'
66 -
67   I make second partial payment of 6000 EUR.
68 -
69   !record {model: account.invoice.pay, id: account_invoice_pay_second0}:
70     amount: 6000.0
71     date: '2010-05-28'
72     journal_id: account.sales_journal
73     name: Second payment for [PC3] Medium PC to Distrib PC
74     period_id: account.period_5
75 -
76   I make partial payment by clicking on Partial Payment button
77
78 -
79   !python {model: account.invoice.pay}: |
80     self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_second0")], {"lang":
81       'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
82       [ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"),
83       })
84 -
85   I make final partial payment of 2000 EUR
86 -
87   !record {model: account.invoice.pay, id: account_invoice_pay_final0}:
88     amount: 2000.0
89     date: '2010-05-30'
90     journal_id: account.sales_journal
91     name: Final payment for [PC3] Medium PC to Distrib PC
92     period_id: account.period_5
93
94 -
95   I make partial payment by clicking on Partial Payment button
96
97 -
98   !python {model: account.invoice.pay}: |
99     self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_final0")], {"lang":
100       'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
101       [ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"),
102       })
103
104 -
105   I check that the invoice state is now Done
106 -
107   !assert {model: account.invoice, id: account_invoice_customer0}:
108     - state == 'paid'
109 -
110   I check that an payment entry gets created in the account.move.line
111 -
112   !python {model: account.invoice}: |
113     acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
114     assert(acc_id.move_id)
115 -
116   I refund the invoice Using Credit Note
117 -
118   !record {model: account.invoice.refund, id: account_invoice_refund_0}:
119     description: Refund To China Export
120     period: account.period_5
121 -
122   I clicked on refund button
123 -
124   !python {model: account.invoice.refund}: |
125     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"), })
126 -
127   I checked that a new entry with state "Draft" created in account move line
128
129