- In order to test the V11 import, I will create an invoice with a specified reference that I will reconcile with the moves imported from a V11 - I create an invoice ref 1234567 - !record {model: account.invoice, id: v11_test_invoice, view: False}: name: V11 YAML invoice number: 1234567 company_id: base.main_company journal_id: account.bank_journal currency_id: base.EUR account_id: account.a_recv type : out_invoice partner_id: base.res_partner_2 reference_type: bvr reference: 12345676 date_invoice: !eval "'%s-01-01' %(datetime.now().year)" period_id: account.period_1 #invoice_line: partner_bank_id: main_partner_bank check_total : 888.00 - I create an invoice line - !record {model: account.invoice.line, id: v11_test_invoice_line, view: False}: account_id: account.a_expense name: '[PC1] Basic PC' price_unit: 888.00 quantity: 1.0 product_id: product.product_product_3 uos_id: product.product_uom_unit invoice_id: v11_test_invoice - I Validate invoice by clicking on Validate button - !workflow {model: account.invoice, action: invoice_open, ref: v11_test_invoice} - I specify the invoice number to fit with my v11 - !python {model: account.invoice}: | invoice = self.browse(cr, uid, ref('v11_test_invoice')) invoice.write({'number': 1234567}) - I create a bank statement - !record {model: account.bank.statement, id: v11_test_bank_statement, view: False}: #account_id: #balance_end: #balance_end_cash: #balance_end_real: #balance_start: #closing_date: #company_id: #currency: date: !eval "'%s-01-01' %(datetime.now().year)" #ending_details_ids: journal_id: account.bank_journal #line_ids: #move_line_ids name: "/" period_id: account.period_1 #starting_details_ids state: draft #total_entry_encoding #user_id - I import the V11 - !python {model: bvr.import.wizard}: | import base64 import addons import os # create our wizard wiz_id = self.create(cr,uid,[]) wiz = self.browse(cr, uid, wiz_id) test_file_path = addons.get_module_resource(os.path.join('l10n_ch', 'test', 'test.v11')) # get our test file to test it f_v11 = open(test_file_path) str64_v11 = base64.encodestring(f_v11.read()) wiz.write({'file': str64_v11}) # set the file in the wizard field bank_statement_id = ref('v11_test_bank_statement') context['active_id'] = bank_statement_id context['active_ids'] = [bank_statement_id] # launch the import self.import_bvr(cr, uid, [wiz_id], context=context) - I check my bank statement got a statement line - !assert {model: account.bank.statement, id: v11_test_bank_statement, string: statement has 1 and only 1 statement line id}: - len(line_ids) == 1 - I check the voucher linked to the statement line contains a line with an amount of 888.00 - !python {model: account.bank.statement}: | statement = self.browse(cr, uid, ref('v11_test_bank_statement')) voucher_line_ids = statement.line_ids[0].voucher_id.line_ids assert voucher_line_ids, "No voucher line found" voucher_line_amount = voucher_line_ids[0].amount assert voucher_line_amount == 888.00, "Amount isn't correct : %d" %(voucher_line_amount) - I check amount of account voucher is equal to the bank statement line amount - !python {model: account.bank.statement}: | statement = self.browse(cr, uid, ref('v11_test_bank_statement')) statement_line_amount = statement.line_ids[0].amount voucher_amount = statement.line_ids[0].voucher_id.amount assert statement_line_amount == voucher_amount, "Mismatch of amounts" - I enter the closing balance and press on compute button - !python {model: account.bank.statement}: | statement = self.browse(cr, uid, ref('v11_test_bank_statement')) statement.write({'balance_end_real': 888.00}) self.button_dummy(cr, uid, [ref('v11_test_bank_statement')], context=context) - I check that the statement Balance is 888.00 - !assert {model: account.bank.statement, id: v11_test_bank_statement, string: balance is 888.0}: - balance_end == 888.0 - I confirm my bank statement - !python {model: account.bank.statement}: | self.button_confirm_bank(cr, uid, [ref('v11_test_bank_statement')], context=context) - I check my invoice is paid, reconciled and has no residual - !assert {model: account.invoice, id: v11_test_invoice, string: 'invoice is paid, reconciled and has no residual'}: - state == "paid" - reconciled - residual == 0.0