2010-05-27 13:25:40 +00:00
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
In order to test account invoice I create a new customer invoice
|
2011-09-21 12:49:02 +00:00
|
|
|
-
|
|
|
|
I will create bank detail
|
|
|
|
-
|
|
|
|
!record {model: res.partner.bank, id: res_partner_bank_0}:
|
|
|
|
state: bank
|
|
|
|
company_id: base.main_company
|
|
|
|
partner_id: base.main_partner
|
|
|
|
acc_number: 123456789
|
|
|
|
footer: True
|
|
|
|
bank: base.res_bank_1
|
|
|
|
bank_name: Reserve
|
2011-09-23 08:47:21 +00:00
|
|
|
-
|
|
|
|
I create a customer invoice
|
2010-05-27 13:25:40 +00:00
|
|
|
-
|
2011-11-14 23:23:11 +00:00
|
|
|
!record {model: account.invoice, id: account_invoice_customer0, view: invoice_form}:
|
2011-09-21 12:49:02 +00:00
|
|
|
payment_term: account.account_payment_term_advance
|
|
|
|
partner_bank_id: res_partner_bank_0
|
2010-05-27 13:25:40 +00:00
|
|
|
journal_id: account.sales_journal
|
|
|
|
partner_id: base.res_partner_3
|
|
|
|
reference_type: none
|
2011-09-23 08:47:21 +00:00
|
|
|
name: 'Test Customer Invoice'
|
2011-11-14 23:23:11 +00:00
|
|
|
invoice_line:
|
|
|
|
- product_id: product.product_product_pc3
|
|
|
|
quantity: 10.0
|
2011-09-23 12:55:17 +00:00
|
|
|
-
|
|
|
|
I manually assign tax on invoice
|
|
|
|
-
|
|
|
|
!python {model: account.invoice.tax}: |
|
|
|
|
amt = self.amount_change(cr, uid, [], 50.0, ref('base.EUR'), ref('base.main_company'), False)
|
|
|
|
base_amt = self.base_change(cr, uid, [], 9000.0, ref('base.EUR'), ref('base.main_company'), False)
|
|
|
|
invoice_tax_line = {
|
|
|
|
'name': 'Test Tax for Customer Invoice',
|
|
|
|
'manual': 1,
|
|
|
|
'base': base_amt['value']['base_amount'],
|
|
|
|
'amount': amt['value']['tax_amount'],
|
|
|
|
'account_id': ref('account.ova'),
|
|
|
|
'invoice_id': ref("account_invoice_customer0"),
|
|
|
|
}
|
|
|
|
tax = self.create(cr, uid, invoice_tax_line)
|
|
|
|
assert tax, "Tax has not been assigned correctly"
|
|
|
|
|
2010-05-27 13:25:40 +00:00
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
I check that Initially customer invoice is in the "Draft" state
|
2010-05-27 13:25:40 +00:00
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
!assert {model: account.invoice, id: account_invoice_customer0}:
|
2010-05-27 13:25:40 +00:00
|
|
|
- state == 'draft'
|
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
|
2010-05-27 13:25:40 +00:00
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
!workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_customer0}
|
2010-05-27 13:25:40 +00:00
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
I check that the invoice state is now "Proforma2"
|
2010-05-27 13:25:40 +00:00
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
!assert {model: account.invoice, id: account_invoice_customer0}:
|
2010-05-27 13:25:40 +00:00
|
|
|
- state == 'proforma2'
|
2010-07-29 07:10:03 +00:00
|
|
|
-
|
|
|
|
I check that there is no move attached to the invoice
|
|
|
|
-
|
|
|
|
!python {model: account.invoice}: |
|
|
|
|
acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
|
2010-08-30 22:38:47 +00:00
|
|
|
assert (not acc_id.move_id), "Move falsely created at pro-forma"
|
2010-05-27 13:25:40 +00:00
|
|
|
-
|
|
|
|
I create invoice by clicking on Create button
|
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0}
|
2010-05-27 13:25:40 +00:00
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
I check that the invoice state is "Open"
|
2010-05-27 13:25:40 +00:00
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
!assert {model: account.invoice, id: account_invoice_customer0}:
|
2010-05-27 13:25:40 +00:00
|
|
|
- state == 'open'
|
2010-08-25 06:01:16 +00:00
|
|
|
|
2010-07-29 07:10:03 +00:00
|
|
|
-
|
|
|
|
I check that now there is a move attached to the invoice
|
|
|
|
-
|
|
|
|
!python {model: account.invoice}: |
|
|
|
|
acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
|
2010-08-30 22:38:47 +00:00
|
|
|
assert acc_id.move_id, "Move not created for open invoice"
|
2011-09-23 08:47:21 +00:00
|
|
|
-
|
|
|
|
I pay the Invoice
|
|
|
|
-
|
|
|
|
!python {model: account.invoice}: |
|
|
|
|
import time
|
|
|
|
pay = self.pay_and_reconcile(cr, uid, [ref('account_invoice_customer0')],
|
2011-11-11 10:10:35 +00:00
|
|
|
9050.0, ref('cash'), ref('account.period_10'),
|
2011-09-23 08:47:21 +00:00
|
|
|
ref('bank_journal'), ref('cash'),
|
2011-11-11 10:10:35 +00:00
|
|
|
ref('account.period_10'), ref('bank_journal'),
|
2011-09-23 08:47:21 +00:00
|
|
|
name='Payment for test customer invoice')
|
|
|
|
assert (pay == True), "Incorrect Payment"
|
|
|
|
-
|
|
|
|
I verify that invoice is now in Paid state
|
|
|
|
-
|
|
|
|
!python {model: account.invoice}: |
|
|
|
|
inv = self.browse(cr, uid, ref("account_invoice_customer0"))
|
|
|
|
assert (inv.state == 'paid'), "Invoice is not in Paid state"
|
2010-06-08 12:47:44 +00:00
|
|
|
-
|
2010-08-25 06:01:16 +00:00
|
|
|
I refund the invoice Using Refund Button
|
2010-06-08 12:47:44 +00:00
|
|
|
-
|
|
|
|
!record {model: account.invoice.refund, id: account_invoice_refund_0}:
|
|
|
|
description: Refund To China Export
|
|
|
|
period: account.period_5
|
2010-09-01 10:47:00 +00:00
|
|
|
filter_refund: refund
|
2010-06-08 12:47:44 +00:00
|
|
|
-
|
|
|
|
I clicked on refund button
|
|
|
|
-
|
|
|
|
!python {model: account.invoice.refund}: |
|
|
|
|
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"), })
|
|
|
|
-
|
|
|
|
I checked that a new entry with state "Draft" created in account move line
|
|
|
|
|
2010-05-28 10:27:37 +00:00
|
|
|
|