[iMP] yaml test account
bzr revid: fp@tinyerp.com-20111111101035-so9ks4shaxsa7v1c
This commit is contained in:
@@ -1,5 +1,34 @@
|
||||
-
|
||||
In order to test account invoice I create a new customer invoice
|
||||
-
|
||||
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
|
||||
-
|
||||
I select the journal for customer invoice
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
journal = self.onchange_journal_id(cr, uid, [], journal_id=ref('account.sales_journal'))
|
||||
-
|
||||
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'))
|
||||
-
|
||||
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'))
|
||||
-
|
||||
I create a customer invoice
|
||||
-
|
||||
!record {model: account.invoice, id: account_invoice_customer0}:
|
||||
account_id: account.a_recv
|
||||
@@ -8,16 +37,57 @@
|
||||
company_id: base.main_company
|
||||
currency_id: base.EUR
|
||||
date_invoice: !eval time.strftime('%Y-%m-%d')
|
||||
invoice_line:
|
||||
- account_id: account.a_sale
|
||||
name: '[PC3] Medium PC'
|
||||
price_unit: 900.0
|
||||
quantity: 10.0
|
||||
product_id: product.product_product_pc3
|
||||
uos_id: product.product_uom_unit
|
||||
payment_term: account.account_payment_term_advance
|
||||
partner_bank_id: res_partner_bank_0
|
||||
journal_id: account.sales_journal
|
||||
partner_id: base.res_partner_3
|
||||
reference_type: none
|
||||
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'))
|
||||
line = {}
|
||||
line.update(product.get('value', {}))
|
||||
line.update({
|
||||
'quantity': 10.0,
|
||||
'invoice_id': ref("account_invoice_customer0"),
|
||||
})
|
||||
invoice_line = self.create(cr, uid, line)
|
||||
-
|
||||
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'))
|
||||
-
|
||||
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'))
|
||||
-
|
||||
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"
|
||||
|
||||
-
|
||||
I check that Initially customer invoice is in the "Draft" state
|
||||
-
|
||||
@@ -54,6 +124,23 @@
|
||||
!python {model: account.invoice}: |
|
||||
acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
|
||||
assert acc_id.move_id, "Move not created for open invoice"
|
||||
-
|
||||
I pay the Invoice
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
import time
|
||||
pay = self.pay_and_reconcile(cr, uid, [ref('account_invoice_customer0')],
|
||||
9050.0, ref('cash'), ref('account.period_10'),
|
||||
ref('bank_journal'), ref('cash'),
|
||||
ref('account.period_10'), 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"
|
||||
-
|
||||
I refund the invoice Using Refund Button
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user