3 In order to check account voucher module in OpenERP I create a customer voucher
5 !record {model: account.voucher, id: account_voucher_voucherforaxelor0}:
6 account_id: account.cash
7 company_id: base.main_company
9 journal_id: account.bank_journal
10 name: Voucher for Axelor
13 - account_id: account.a_recv
15 name: Voucher for Axelor
16 partner_id: base.res_partner_desertic_hispafuentes
17 period_id: account.period_6
21 I check that Initially customer voucher is in the "Draft" state
23 !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
26 I compute the voucher to calculate the taxes by clicking Cpmpute button
28 !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucherforaxelor0}
30 I check that the voucher state is now "proforma"
32 !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
35 I create voucher by clicking on Create button
37 !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucherforaxelor0}
39 I clicked on Validate Button
41 !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
45 I check that Moves get created for this voucher
47 !python {model: account.voucher}: |
48 acc_id=self.browse(cr, uid, ref("account_voucher_voucherforaxelor0"))
49 assert(acc_id.move_id)
53 Now I create a Vendor Voucher
55 !record {model: account.voucher, id: account_voucher_voucheraxelor0}:
56 account_id: account.cash
57 company_id: base.main_company
59 journal_id: account.bank_journal
63 - account_id: account.cash
66 period_id: account.period_6
70 I check that Initially vendor voucher is in the "Draft" state
72 !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
75 I change the state of voucher to "proforma" by clicking PRO-FORMA button
77 !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucheraxelor0}
79 I check that the voucher state is now "proforma"
81 !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
84 I create voucher by clicking on Create button
86 !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucheraxelor0}
88 I check that the voucher state is "posted"
90 !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
93 I check that moves get created for this voucher
95 !python {model: account.voucher}: |
96 acc_id=self.browse(cr, uid, ref("account_voucher_voucheraxelor0"))
97 assert(acc_id.move_id)
100 In order to test the PDF reports defined on a account_voucher, we will print account voucher amount Report
102 !python {model: account.voucher}: |
103 import netsvc, tools, os
104 (data, format) = netsvc.LocalService('report.voucher.cash_amount').create(cr, uid, [ref("account_voucher_voucheraxelor0")], {}, {})
105 if tools.config['test_report_directory']:
106 file(os.path.join(tools.config['test_report_directory'], 'account_voucher-amount.'+format), 'wb+').write(data)
109 In order to test the PDF reports defined on a account_voucher, we will print account voucher Report
111 !python {model: account.voucher}: |
112 import netsvc, tools, os
113 (data, format) = netsvc.LocalService('report.voucher.cash_receipt.drcr').create(cr, uid, [ref("account_voucher_voucheraxelor0")], {}, {})
114 if tools.config['test_report_directory']:
115 file(os.path.join(tools.config['test_report_directory'], 'account_voucher-report.'+format), 'wb+').write(data)