[IMP] Account: improved yml test files for account_voucher

bzr revid: pap@tinyerp.co.in-20100924124258-wyk38tacir21qjul
This commit is contained in:
pap (openerp) 2010-09-24 18:12:58 +05:30
parent ac3f17558e
commit ac018a4f1e
3 changed files with 73 additions and 75 deletions

View File

@ -51,8 +51,8 @@
],
"test" : [
# "test/account_voucher.yml",
# "test/sales_receipt.yml",
# "test/sales_payment.yml",
"test/sales_receipt.yml",
"test/sales_payment.yml",
"test/account_voucher_report.yml"
],
'certificate': '0037580727101',

View File

@ -1,24 +1,5 @@
-
In order to test account voucher i will create an invoice and pay it through account voucher.
-
I create a new Partner
-
!record {model: res.partner, id: res_partner_micropc0}:
address:
- country_id: base.be
name: Jenifer
street: 69 rue de Chimay
type: default
zip: '5478'
category_id:
- base.res_partner_category_8
credit_limit: 0.0
name: Micro PC
property_account_payable: account.a_pay
property_account_receivable: account.a_recv
-
Create an invoice for the partner
Create an invoice for the partner Seagate with amount 450.0
-
!record {model: account.invoice, id: account_invoice_0}:
account_id: account.a_recv
@ -34,7 +15,7 @@
product_id: product.product_product_pc1
uos_id: product.product_uom_unit
journal_id: account.sales_journal
partner_id: res_partner_micropc0
partner_id: base.res_partner_seagate
-
I check that the customer invoice is in draft state
@ -55,20 +36,20 @@
assert(acc_id.move_id)
-
I will create and post an account voucher for the partner.
I will create and post an account voucher of amount 450.0 for the partner Seagate.
-
!python {model: account.voucher}: |
import netsvc
vals = {}
journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_micropc0"), journal_id, price=0.0, ttype='receipt')
res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_seagate"), journal_id, 0.0, 1, ttype='receipt')
vals = {
'account_id': ref('account.cash'),
'amount': 450.0,
'company_id': ref('base.main_company'),
'currency_id': ref('base.EUR'),
'journal_id': ref('account.bank_journal'),
'partner_id': ref('res_partner_micropc0'),
'partner_id': ref('base.res_partner_seagate'),
'period_id': ref('account.period_8'),
'type': 'receipt',
}

View File

@ -1,74 +1,91 @@
-
In order to test sales receipt i will create a sale receipt and pay it through sales payment
-
First of all I create a voucher
-
!record {model: account.voucher, id: account_voucher_chinaexport_0}:
-
Creating a Voucher Receipt for partner Seagate with amount 30000.0
-
!record {model: account.voucher, id: account_voucher_seagate_0}:
account_id: account.a_recv
amount: 30000.0
amount: 0.0
company_id: base.main_company
currency_id: base.EUR
journal_id: account.sales_journal
line_cr_ids:
- account_id: account.a_sale
amount: 30000.0
partner_id: base.res_partner_3
period_id: account.period_8
type: cr
partner_id: base.res_partner_seagate
period_id: account.period_9
tax_amount: 0.0
type: sale
-
I check that the voucher state is Draft
-
!assert {model: account.voucher, id: account_voucher_chinaexport_0}:
!assert {model: account.voucher, id: account_voucher_seagate_0}:
- state == 'draft'
-
I clicked on post button to post the voucher
I click on post button to post the voucher
-
!workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_chinaexport_0}
!workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_seagate_0}
-
Check the voucher state is Posted
Check that the voucher state is Posted
-
!assert {model: account.voucher, id: account_voucher_chinaexport_0}:
!assert {model: account.voucher, id: account_voucher_seagate_0}:
- state == 'posted'
-
I check that move lines are validated but not reconciled
-
!python {model: account.voucher}: |
reconciled = False
for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids:
if l.reconcile_id:
reconciled = True
break
if not reconciled:
print "Info: Voucher is not paid"
else:
print "Info: Voucher is paid"
-
I create a voucher record for the same partner
I create and post a voucher payment of amount 30000.0 for the partner Seagate
-
!record {model: account.voucher, id: account_voucher_chinaexport_1}:
account_id: account.cash
amount: 30000.0
company_id: base.main_company
currency_id: base.EUR
journal_id: account.bank_journal
line_cr_ids:
- account_id: account.a_recv
amount: 0.0
name: 2010/003
type: cr
- account_id: account.a_recv
amount: 30000.0
name: 2010/003
type: cr
partner_id: base.res_partner_3
period_id: account.period_8
type: receipt
!python {model: account.voucher}: |
import netsvc
vals = {}
journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_seagate"), journal_id, 0.0, 1, ttype='receipt')
vals = {
'account_id': ref('account.cash'),
'amount': 30000.0,
'company_id': ref('base.main_company'),
'currency_id': ref('base.EUR'),
'journal_id': ref('account.bank_journal'),
'partner_id': ref('base.res_partner_seagate'),
'period_id': ref('account.period_8'),
'type': 'receipt',
}
if not res['value']['line_cr_ids']:
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
res['value']['line_cr_ids'][0]['amount'] = 30000.0
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
id = self.create(cr, uid, vals)
voucher_id = self.browse(cr, uid, id)
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr)
-
Check the voucher state is draft
I check that move lines are reconciled meaning voucher is paid
-
!assert {model: account.voucher, id: account_voucher_chinaexport_1}:
- state == 'draft'
-
I clicked on Post button to post the voucher
-
!workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_chinaexport_1}
-
Check the voucher state is Posted
-
!assert {model: account.voucher, id: account_voucher_chinaexport_1}:
- state == 'posted'
!python {model: account.voucher}: |
reconciled = False
for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids:
if l.reconcile_id:
reconciled = True
break
if not reconciled:
print "Info: Voucher is not paid"
else:
print "Info: Voucher is paid"