2 In order to test account invoice I create a new customer invoice
4 I will create bank detail with using manager access rights because account manager can only create bank details.
7 uid: 'res_users_account_manager'
9 !record {model: res.partner.bank, id: res_partner_bank_0}:
11 company_id: base.main_company
12 partner_id: base.main_partner
18 Test with that user which have rights to make Invoicing and payment and who is accountant.
21 uid: 'res_users_account_user'
23 I create a customer invoice
25 !record {model: account.invoice, id: account_invoice_customer0, view: invoice_form}:
26 payment_term: account.account_payment_term_advance
27 partner_bank_id: res_partner_bank_0
28 journal_id: account.sales_journal
29 partner_id: base.res_partner_3
31 name: 'Test Customer Invoice'
33 - product_id: product.product_product_5
36 I manually assign tax on invoice
38 !python {model: account.invoice.tax}: |
39 amt = self.amount_change(cr, uid, [], 50.0, ref('base.EUR'), ref('base.main_company'), False)
40 base_amt = self.base_change(cr, uid, [], 9000.0, ref('base.EUR'), ref('base.main_company'), False)
42 'name': 'Test Tax for Customer Invoice',
44 'base': base_amt['value']['base_amount'],
45 'amount': amt['value']['tax_amount'],
46 'account_id': ref('account.ova'),
47 'invoice_id': ref("account_invoice_customer0"),
49 tax = self.create(cr, uid, invoice_tax_line)
50 assert tax, "Tax has not been assigned correctly"
53 I check that Initially customer invoice is in the "Draft" state
55 !assert {model: account.invoice, id: account_invoice_customer0}:
58 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
60 !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_customer0}
62 I check that the invoice state is now "Proforma2"
64 !assert {model: account.invoice, id: account_invoice_customer0}:
65 - state == 'proforma2'
67 I check that there is no move attached to the invoice
69 !python {model: account.invoice}: |
70 acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
71 assert (not acc_id.move_id), "Move falsely created at pro-forma"
73 I create invoice by clicking on Create button
75 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0}
77 I check that the invoice state is "Open"
79 !assert {model: account.invoice, id: account_invoice_customer0}:
83 I check that now there is a move attached to the invoice
85 !python {model: account.invoice}: |
86 acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
87 assert acc_id.move_id, "Move not created for open invoice"
91 !python {model: account.invoice}: |
93 pay = self.pay_and_reconcile(cr, uid, [ref('account_invoice_customer0')],
94 9050.0, ref('cash'), ref('account.period_10'),
95 ref('bank_journal'), ref('cash'),
96 ref('account.period_10'), ref('bank_journal'),
97 name='Payment for test customer invoice')
98 assert (pay == True), "Incorrect Payment"
100 I verify that invoice is now in Paid state
102 !python {model: account.invoice}: |
103 inv = self.browse(cr, uid, ref("account_invoice_customer0"))
104 assert (inv.state == 'paid'), "Invoice is not in Paid state"
106 I refund the invoice Using Refund Button
108 !record {model: account.invoice.refund, id: account_invoice_refund_0}:
109 description: Refund To China Export
110 period: account.period_5
111 filter_refund: refund
113 I clicked on refund button
115 !python {model: account.invoice.refund}: |
116 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"), })
118 I checked that a new entry with state "Draft" created in account move line