2 In order to test the V11 import,
3 I will create an invoice with a specified reference that I will partialy reconcile with a 1st V11
4 And then I will complete the reconcile with a second V11
6 I create an invoice ref 2000999 of EUR 250.00
8 !record {model: account.invoice, id: v11_part_test_invoice, view: False}:
11 company_id: base.main_company
12 journal_id: account.bank_journal
14 account_id: account.a_recv
16 partner_id: base.res_partner_2
19 date_invoice: !eval "'%s-01-01' %(datetime.now().year)"
20 period_id: account.period_1
22 partner_bank_id: main_partner_bank
26 I create an invoice line
28 !record {model: account.invoice.line, id: v11_part_test_invoice_line, view: False}:
29 account_id: account.a_expense
30 name: '[PCSC234] PC Assemble SC234'
33 product_id: product.product_product_3
34 uos_id: product.product_uom_unit
35 invoice_id: v11_part_test_invoice
38 I Validate invoice by clicking on Validate button
40 !workflow {model: account.invoice, action: invoice_open, ref: v11_part_test_invoice}
43 I specify the invoice number to fit with my v11
45 !python {model: account.invoice}: |
46 invoice = self.browse(cr, uid, ref('v11_part_test_invoice'))
47 invoice.write({'number': 2000999})
51 I create a 1st bank statement
52 #########################################
53 # Creating 1st bank statement #
54 #########################################
56 !record {model: account.bank.statement, id: v11_part_test_bank_statement_1, view: False}:
65 date: !eval "'%s-01-01' %(datetime.now().year)"
67 journal_id: account.bank_journal
71 period_id: account.period_1
80 !python {model: bvr.import.wizard}: |
86 wiz_id = self.create(cr,uid,[])
87 wiz = self.browse(cr, uid, wiz_id)
89 test_file_path = addons.get_module_resource(os.path.join('l10n_ch', 'test', 'test_part_1.v11'))
91 # get our test file to test it
92 f_v11 = open(test_file_path)
94 str64_v11 = base64.encodestring(f_v11.read())
96 wiz.write({'file': str64_v11})
98 # set the file in the wizard field
99 bank_statement_id = ref('v11_part_test_bank_statement_1')
101 context['active_id'] = bank_statement_id
102 context['active_ids'] = [bank_statement_id]
104 self.import_bvr(cr, uid, [wiz_id], context=context)
108 I check my bank statement got a statement line
110 !assert {model: account.bank.statement, id: v11_part_test_bank_statement_1, string: statement has 1 and only 1 statement line id}:
114 I check the voucher linked to the statement line contains a line with an amount of EUR 150.00
116 !python {model: account.bank.statement}: |
117 statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_1'))
119 voucher_line_ids = statement.line_ids[0].voucher_id.line_ids
121 assert voucher_line_ids, "No voucher line found"
123 voucher_line_amount = voucher_line_ids[0].amount
124 assert voucher_line_amount == 150.00, "Amount isn't correct : %d" %(voucher_line_amount)
127 I check amount of account voucher is equal to the bank statement line amount
129 !python {model: account.bank.statement}: |
130 statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_1'))
132 statement_line_amount = statement.line_ids[0].amount
133 voucher_amount = statement.line_ids[0].voucher_id.amount
135 assert statement_line_amount == voucher_amount, "Mismatch of amounts"
138 I enter the closing balance and press on compute button
140 !python {model: account.bank.statement}: |
141 statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_1'))
142 statement.write({'balance_end_real': 150.00})
143 self.button_dummy(cr, uid, [ref('v11_part_test_bank_statement_1')], context=context)
146 I check that the statement Balance is EUR 150.00
148 !assert {model: account.bank.statement, id: v11_part_test_bank_statement_1, string: balance is 150.0}:
149 - balance_end == 150.0
152 I confirm my 1st bank statement
154 !python {model: account.bank.statement}: |
155 self.button_confirm_bank(cr, uid, [ref('v11_part_test_bank_statement_1')], context=context)
159 I check that my invoice is partially paid in open state, not reconciled, with a residual amount of EUR 100.0
160 #########################################
161 # Checking partial result #
162 #########################################
164 !assert {model: account.invoice, id: v11_part_test_invoice, string: 'invoice is open, reconciled and has no residual'}:
172 I create a 2nd bank statement
173 #########################################
174 # Creating 2nd bank statement #
175 #########################################
177 !record {model: account.bank.statement, id: v11_part_test_bank_statement_2, view: False}:
186 date: !eval "'%s-01-01' %(datetime.now().year)"
188 journal_id: account.bank_journal
192 period_id: account.period_1
193 #starting_details_ids
195 #total_entry_encoding
201 !python {model: bvr.import.wizard}: |
207 wiz_id = self.create(cr,uid,[])
208 wiz = self.browse(cr, uid, wiz_id)
210 test_file_path = addons.get_module_resource(os.path.join('l10n_ch', 'test', 'test_part_2.v11'))
212 # get our test file to test it
213 f_v11 = open(test_file_path)
215 str64_v11 = base64.encodestring(f_v11.read())
217 wiz.write({'file': str64_v11})
219 # set the file in the wizard field
220 bank_statement_id = ref('v11_part_test_bank_statement_2')
222 context['active_id'] = bank_statement_id
223 context['active_ids'] = [bank_statement_id]
225 self.import_bvr(cr, uid, [wiz_id], context=context)
229 I check my bank statement got a statement line
231 !assert {model: account.bank.statement, id: v11_part_test_bank_statement_2, string: statement has 1 and only 1 statement line id}:
235 I check the voucher linked to the statement line contains a line with an amount of EUR 100.00
237 !python {model: account.bank.statement}: |
238 statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_2'))
240 voucher_line_ids = statement.line_ids[0].voucher_id.line_ids
242 assert voucher_line_ids, "No voucher line found"
244 voucher_line_amount = voucher_line_ids[0].amount
245 assert voucher_line_amount == 100.00, "Amount isn't correct : %d" %(voucher_line_amount)
248 I check amount of account voucher is equal to the bank statement line amount
250 !python {model: account.bank.statement}: |
251 statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_2'))
253 statement_line_amount = statement.line_ids[0].amount
254 voucher_amount = statement.line_ids[0].voucher_id.amount
256 assert statement_line_amount == voucher_amount, "Mismatch of amounts"
260 I enter the closing balance and press on compute button
262 !python {model: account.bank.statement}: |
263 statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_2'))
264 statement.write({'balance_end_real': 100.00})
265 self.button_dummy(cr, uid, [ref('v11_part_test_bank_statement_2')], context=context)
268 I check that the statement Balance is EUR 100.00
270 !assert {model: account.bank.statement, id: v11_part_test_bank_statement_2, string: balance is 100.0}:
271 - balance_end == 100.0
274 I confirm my 2nd bank statement
276 !python {model: account.bank.statement}: |
277 self.button_confirm_bank(cr, uid, [ref('v11_part_test_bank_statement_2')], context=context)
282 I check my invoice is paid, reconciled and has no residual
283 #########################################
284 # Checking finale state #
285 #########################################
287 !assert {model: account.invoice, id: v11_part_test_invoice, string: 'invoice is paid, reconciled and has no residual'}: