- In order to check account voucher module in OpenERP I create a customer voucher - !record {model: account.voucher, id: account_voucher_voucherforaxelor0}: account_id: account.cash company_id: base.main_company currency_id: base.EUR journal_id: account.bank_journal name: Voucher for Axelor narration: Basic Pc line_ids: - account_id: account.a_recv amount: 1000.0 name: Voucher for Axelor partner_id: base.res_partner_desertic_hispafuentes period_id: account.period_6 reference_type: none - I check that Initially customer voucher is in the "Draft" state - !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}: - state == 'draft' - I compute the voucher to calculate the taxes by clicking Cpmpute button - !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucherforaxelor0} - I check that the voucher state is now "proforma" - !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}: - state == 'proforma' - I create voucher by clicking on Create button - !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucherforaxelor0} - I clicked on Validate Button - !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}: - state == 'posted' - I check that Moves get created for this voucher - !python {model: account.voucher}: | acc_id=self.browse(cr, uid, ref("account_voucher_voucherforaxelor0")) assert(acc_id.move_id) - Now I create a Vendor Voucher - !record {model: account.voucher, id: account_voucher_voucheraxelor0}: account_id: account.cash company_id: base.main_company currency_id: base.EUR journal_id: account.bank_journal name: Voucher Axelor narration: Basic PC line_ids: - account_id: account.cash amount: 1000.0 name: Voucher Axelor period_id: account.period_6 reference_type: none - I check that Initially vendor voucher is in the "Draft" state - !assert {model: account.voucher, id: account_voucher_voucheraxelor0}: - state == 'draft' - I change the state of voucher to "proforma" by clicking PRO-FORMA button - !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucheraxelor0} - I check that the voucher state is now "proforma" - !assert {model: account.voucher, id: account_voucher_voucheraxelor0}: - state == 'proforma' - I create voucher by clicking on Create button - !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucheraxelor0} - I check that the voucher state is "posted" - !assert {model: account.voucher, id: account_voucher_voucheraxelor0}: - state == 'posted' - I check that moves get created for this voucher - !python {model: account.voucher}: | acc_id=self.browse(cr, uid, ref("account_voucher_voucheraxelor0")) assert(acc_id.move_id) - In order to test the PDF reports defined on a account_voucher, we will print account voucher amount Report - !python {model: account.voucher}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.voucher.cash_amount').create(cr, uid, [ref("account_voucher_voucheraxelor0")], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account_voucher-amount.'+format), 'wb+').write(data) - In order to test the PDF reports defined on a account_voucher, we will print account voucher Report - !python {model: account.voucher}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.voucher.cash_receipt.drcr').create(cr, uid, [ref("account_voucher_voucheraxelor0")], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account_voucher-report.'+format), 'wb+').write(data)