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 select the journal for customer invoice
|
|
|
|
-
|
|
|
|
!python {model: account.invoice}: |
|
|
|
|
journal = self.onchange_journal_id(cr, uid, [], journal_id=ref('account.sales_journal'))
|
|
|
|
assert journal['value']
|
|
|
|
-
|
|
|
|
I select the partner for customer invoice
|
|
|
|
-
|
|
|
|
!python {model: account.invoice}: |
|
|
|
|
partner = self.onchange_partner_id(cr, uid, [], 'out_invoice', ref('base.res_partner_3'), date_invoice=False,
|
|
|
|
payment_term=ref('account.account_payment_term_advance'), partner_bank_id=ref('res_partner_bank_0'), company_id=ref('base.main_company'))
|
|
|
|
assert partner['value'], "Partner has not been selected correctly"
|
|
|
|
-
|
|
|
|
I select the company for invoice
|
|
|
|
-
|
|
|
|
!python {model: account.invoice}: |
|
|
|
|
company = self.onchange_company_id(cr, uid, [], ref('base.main_company'), False, 'out_invoice', [], ref('base.EUR'))
|
|
|
|
assert company, "Company has not been selected correctly"
|
|
|
|
-
|
|
|
|
I create a customer invoice
|
2010-05-27 13:25:40 +00:00
|
|
|
-
|
2010-06-08 12:47:44 +00:00
|
|
|
!record {model: account.invoice, id: account_invoice_customer0}:
|
2010-05-27 13:25:40 +00:00
|
|
|
account_id: account.a_recv
|
|
|
|
address_contact_id: base.res_partner_address_zen
|
|
|
|
address_invoice_id: base.res_partner_address_zen
|
|
|
|
company_id: base.main_company
|
|
|
|
currency_id: base.EUR
|
2011-01-05 07:29:14 +00:00
|
|
|
date_invoice: !eval time.strftime('%Y-%m-%d')
|
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'
|
|
|
|
-
|
|
|
|
I select a product for invoice
|
|
|
|
-
|
|
|
|
!python {model: account.invoice.line}: |
|
|
|
|
product = self.product_id_change(cr, uid, [], ref("product.product_product_pc3"), False, qty=10.0, name='[PC3] Medium PC',
|
|
|
|
type='out_invoice', partner_id=ref('base.res_partner_3'), fposition_id=False, price_unit= 900.0, address_invoice_id=ref('base.res_partner_address_zen'),
|
|
|
|
currency_id=ref('base.EUR'), context={'lang': u'en_US', 'tz': False, 'type': 'out_invoice'}, company_id=ref('base.main_company'))
|
|
|
|
price_unit = self._price_unit_default(cr, uid, {'lang': u'en_US', 'type': u'out_invoice', 'tz': False, 'view_type': 'form'})
|
|
|
|
line = {
|
|
|
|
'account_id': product['value']['account_id'],
|
|
|
|
'name': product['value']['name'],
|
|
|
|
'price_unit': product['value']['price_unit'],
|
|
|
|
'quantity': 10.0,
|
|
|
|
'product_id': ref("product.product_product_pc3"),
|
|
|
|
'uos_id': product['value']['uos_id'],
|
|
|
|
'invoice_id': ref("account_invoice_customer0"),
|
|
|
|
}
|
|
|
|
invoice_line = self.create(cr, uid, line)
|
|
|
|
assert invoice_line, "Account invoice line has not been created"
|
|
|
|
-
|
|
|
|
I select product Uos
|
|
|
|
-
|
|
|
|
!python {model: account.invoice.line}: |
|
|
|
|
inv_line_id = self.search(cr, uid, [('invoice_id','=',ref('account_invoice_customer0'))])
|
|
|
|
uos = self.uos_id_change(cr, uid, inv_line_id, ref("product.product_product_pc3"), ref('product.product_uom_unit'), qty=0, name='[PC3] Medium PC', type='out_invoice',
|
|
|
|
partner_id=ref('base.res_partner_3'), fposition_id=False, price_unit=False, address_invoice_id=ref('base.res_partner_address_zen'),
|
|
|
|
currency_id=ref('base.EUR'), context={'lang': u'en_US', 'tz': False, 'type': 'out_invoice'}, company_id=ref('base.main_company'))
|
|
|
|
assert uos['value'], "Product Uos has not been selected correctly"
|
|
|
|
-
|
|
|
|
I select the account for invoice line
|
|
|
|
-
|
|
|
|
!python {model: account.invoice.line}: |
|
|
|
|
inv_line_id = self.search(cr, uid, [('invoice_id','=',ref('account_invoice_customer0'))])
|
|
|
|
account = self.onchange_account_id(cr, uid, inv_line_id, False, ref('account.a_sale'))
|
|
|
|
assert (not account['value']['invoice_line_tax_id']),"Account is not selected 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')],
|
|
|
|
9000.0, ref('cash'), ref('account.period_' + str(int(time.strftime('%m')))),
|
|
|
|
ref('bank_journal'), ref('cash'),
|
|
|
|
ref('account.period_' + str(int(time.strftime('%m')))), ref('bank_journal'),
|
|
|
|
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
|
|
|
|