2 In order to test account invoice I create a new customer invoice
4 I will create bank detail
6 !record {model: res.partner.bank, id: res_partner_bank_0}:
8 company_id: base.main_company
9 partner_id: base.main_partner
15 I create a customer invoice
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
23 name: 'Test Customer Invoice'
25 - product_id: product.product_product_5
28 I manually assign tax on invoice
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)
34 'name': 'Test Tax for Customer Invoice',
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"),
41 tax = self.create(cr, uid, invoice_tax_line)
42 assert tax, "Tax has not been assigned correctly"
45 I check that Initially customer invoice is in the "Draft" state
47 !assert {model: account.invoice, id: account_invoice_customer0}:
50 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
52 !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_customer0}
54 I check that the invoice state is now "Proforma2"
56 !assert {model: account.invoice, id: account_invoice_customer0}:
57 - state == 'proforma2'
59 I check that there is no move attached to the invoice
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"
65 I create invoice by clicking on Create button
67 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0}
69 I check that the invoice state is "Open"
71 !assert {model: account.invoice, id: account_invoice_customer0}:
75 I check that now there is a move attached to the invoice
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"
83 !python {model: account.invoice}: |
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"
92 I verify that invoice is now in Paid state
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"
98 I refund the invoice Using Refund Button
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
105 I clicked on refund button
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"), })
110 I checked that a new entry with state "Draft" created in account move line