[IMP] Misc useability improvement in account
[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   I will create bank detail
5 -
6   !record {model: res.partner.bank, id: res_partner_bank_0}:
7     state: bank
8     company_id: base.main_company
9     partner_id: base.main_partner
10     acc_number: 123456789
11     footer: True
12     bank: base.res_bank_1
13     bank_name: Reserve
14 -
15   I create a customer invoice
16 -
17   !record {model: account.invoice, id: account_invoice_customer0, view: invoice_form}:
18     payment_term: account.account_payment_term_advance
19     partner_bank_id: res_partner_bank_0
20     journal_id: account.sales_journal
21     partner_id: base.res_partner_3
22     reference_type: none
23     name: 'Test Customer Invoice'
24     invoice_line:
25       - product_id: product.product_product_5
26         quantity: 10.0
27 -
28   I manually assign tax on invoice
29 -
30   !python {model: account.invoice.tax}: |
31     amt = self.amount_change(cr, uid, [], 50.0, ref('base.EUR'), ref('base.main_company'), False)
32     base_amt = self.base_change(cr, uid, [], 9000.0, ref('base.EUR'), ref('base.main_company'), False)
33     invoice_tax_line = {
34         'name':  'Test Tax for Customer Invoice',
35         'manual': 1,
36         'base': base_amt['value']['base_amount'],
37         'amount': amt['value']['tax_amount'],
38         'account_id': ref('account.ova'),
39         'invoice_id': ref("account_invoice_customer0"),
40         }
41     tax = self.create(cr, uid, invoice_tax_line)
42     assert tax, "Tax has not been assigned correctly"
43
44 -
45   I check that Initially customer invoice is in the "Draft" state
46 -
47   !assert {model: account.invoice, id: account_invoice_customer0}:
48     - state == 'draft'
49 -
50   I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
51 -
52   !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_customer0}
53 -
54   I check that the invoice state is now "Proforma2"
55 -
56   !assert {model: account.invoice, id: account_invoice_customer0}:
57     - state == 'proforma2'
58 -
59   I check that there is no move attached to the invoice
60 -
61   !python {model: account.invoice}: |
62     acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
63     assert (not acc_id.move_id), "Move falsely created at pro-forma"
64 -
65   I create invoice by clicking on Create button
66 -
67   !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0}
68 -
69   I check that the invoice state is "Open"
70 -
71   !assert {model: account.invoice, id: account_invoice_customer0}:
72     - state == 'open'
73
74 -
75   I check that now there is a move attached to the invoice
76 -
77   !python {model: account.invoice}: |
78     acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
79     assert acc_id.move_id, "Move not created for open invoice"
80 -
81   I pay the Invoice
82 -
83   !python {model: account.invoice}: |
84     import time
85     pay = self.pay_and_reconcile(cr, uid, [ref('account_invoice_customer0')],
86         9050.0, ref('cash'), ref('account.period_10'),
87         ref('bank_journal'), ref('cash'),
88         ref('account.period_10'), ref('bank_journal'),
89         name='Payment for test customer invoice')
90     assert (pay == True), "Incorrect Payment"
91 -
92   I verify that invoice is now in Paid state
93 -
94   !python {model: account.invoice}: |
95     inv = self.browse(cr, uid, ref("account_invoice_customer0"))
96     assert (inv.state == 'paid'), "Invoice is not in Paid state"
97 -
98   I refund the invoice Using Refund Button
99 -
100   !record {model: account.invoice.refund, id: account_invoice_refund_0}:
101     description: Refund To China Export
102     period: account.period_5
103     filter_refund: refund
104 -
105   I clicked on refund button
106 -
107   !python {model: account.invoice.refund}: |
108     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"), })
109 -
110   I checked that a new entry with state "Draft" created in account move line
111
112