diff --git a/addons/account_voucher/test/case1_usd_usd_payment_rate.yml b/addons/account_voucher/test/case1_usd_usd_payment_rate.yml index 263aec7e876..39ca16c552f 100644 --- a/addons/account_voucher/test/case1_usd_usd_payment_rate.yml +++ b/addons/account_voucher/test/case1_usd_usd_payment_rate.yml @@ -70,7 +70,7 @@ - I create the first invoice on 1st January for 200 USD - - !record {model: account.invoice, id: account_invoice_jan}: + !record {model: account.invoice, id: account_invoice_jan_payment_rate}: account_id: account.a_recv company_id: base.main_company currency_id: base.USD @@ -89,12 +89,12 @@ - I Validate invoice by clicking on Validate button - - !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_jan} + !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_jan_payment_rate} - I check that first invoice move is correct for debtor account (debit - credit == 150.0) - !python {model: account.invoice}: | - invoice_id = self.browse(cr, uid, ref("account_invoice_jan")) + invoice_id = self.browse(cr, uid, ref("account_invoice_jan_payment_rate")) assert invoice_id.move_id, "Move not created for open invoice" move_line_obj = self.pool.get('account.move.line') move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)]) @@ -103,7 +103,7 @@ - I create the second invoice on 1st February for 100 USD - - !record {model: account.invoice, id: account_invoice_feb}: + !record {model: account.invoice, id: account_invoice_feb_payment_rate}: account_id: account.a_recv company_id: base.main_company currency_id: base.USD @@ -122,12 +122,12 @@ - I Validate invoice by clicking on Validate button - - !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_feb} + !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_feb_payment_rate} - I check that second invoice move is correct for debtor account (debit - credit == 80) - !python {model: account.invoice}: | - invoice_id = self.browse(cr, uid, ref("account_invoice_feb")) + invoice_id = self.browse(cr, uid, ref("account_invoice_feb_payment_rate")) assert invoice_id.move_id, "Move not created for open invoice" move_line_obj = self.pool.get('account.move.line') move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('account_id', '=', invoice_id.account_id.id)]) @@ -142,12 +142,12 @@ - On the first March, I create the first voucher of payment with values 240 USD, journal USD, and specifying that $1 = 1.25€ - - !record {model: account.voucher, id: account_voucher_1_case1, view: view_vendor_receipt_form}: + !record {model: account.voucher, id: account_voucher_1_case1_payment_rate, view: view_vendor_receipt_form}: account_id: account.cash amount: 240.0 company_id: base.main_company journal_id: bank_journal_USD - name: 'First payment: Case 1 USD/USD' + name: 'Payment: Case 1 USD/USD payment rate' partner_id: base.res_partner_19 period_id: account.period_3 date: !eval time.strftime("%Y-03-01") @@ -163,7 +163,7 @@ !python {model: account.voucher}: | import netsvc, time vals = {} - voucher_id = self.browse(cr, uid, ref('account_voucher_1_case1')) + voucher_id = self.browse(cr, uid, ref('account_voucher_1_case1_payment_rate')) data = [] for item in voucher_id.line_cr_ids: if item.amount_unreconciled == 200.00: @@ -177,23 +177,22 @@ I check that writeoff amount computed is -10.0 - !python {model: account.voucher}: | - voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 USD/USD'), ('partner_id', '=', ref('base.res_partner_19'))]) - voucher_id = self.browse(cr, uid, voucher[0]) + voucher = ref('account_voucher_1_case1_payment_rate') + voucher_id = self.browse(cr, uid, voucher) assert (voucher_id.writeoff_amount == -10.0), "Writeoff amount is not -10.0" - I confirm the voucher - !python {model: account.voucher}: | import netsvc - voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 USD/USD'), ('partner_id', '=', ref('base.res_partner_19'))]) wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.voucher', voucher[0], 'proforma_voucher', cr) + wf_service.trg_validate(uid, 'account.voucher', ref('account_voucher_1_case1_payment_rate'), 'proforma_voucher', cr) - I check that the move of my first voucher is valid - !python {model: account.voucher}: | - voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 USD/USD'), ('partner_id', '=', ref('base.res_partner_19'))]) - voucher_id = self.browse(cr, uid, voucher[0]) + voucher = ref('account_voucher_1_case1_payment_rate') + voucher_id = self.browse(cr, uid, voucher) move_line_obj = self.pool.get('account.move.line') move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)]) for move_line in move_line_obj.browse(cr, uid, move_lines): @@ -206,8 +205,8 @@ I check that my write-off is correct. 8 debit and 10 amount_currency - !python {model: account.voucher}: | - voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 1 USD/USD'), ('partner_id', '=', ref('base.res_partner_19'))]) - voucher_id = self.browse(cr, uid, voucher[0]) + voucher = ref('account_voucher_1_case1_payment_rate') + voucher_id = self.browse(cr, uid, voucher) move_line_obj = self.pool.get('account.move.line') move_lines = move_line_obj.search(cr, uid, [('move_id', '=', voucher_id.move_id.id)]) for move_line in move_line_obj.browse(cr, uid, move_lines): @@ -225,7 +224,7 @@ I check the residual amount of Invoice1, should be 20 in amount_currency and 6 in amount_residual - !python {model: account.invoice}: | - invoice_id = self.browse(cr, uid, ref("account_invoice_jan")) + invoice_id = self.browse(cr, uid, ref("account_invoice_jan_payment_rate")) move_line_obj = self.pool.get('account.move.line') move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)]) move_line = move_line_obj.browse(cr, uid, move_lines[0]) @@ -235,7 +234,7 @@ I check the residual amuont of Invoice2, should be 30 in residual currency and 24 in amount_residual - !python {model: account.invoice}: | - invoice_id = self.browse(cr, uid, ref("account_invoice_feb")) + invoice_id = self.browse(cr, uid, ref("account_invoice_feb_payment_rate")) move_line_obj = self.pool.get('account.move.line') move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)]) move_line = move_line_obj.browse(cr, uid, move_lines[0])