diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 6d30820d54c..20eb552c074 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -268,6 +268,7 @@ class account_voucher(osv.osv): 'tax_id': _get_tax, 'payment_option': 'without_writeoff', 'comment': _('Write-Off'), + 'payment_rate': 1.0, } def compute_tax(self, cr, uid, ids, context=None): diff --git a/addons/account_voucher/test/case1_usd_usd.yml b/addons/account_voucher/test/case1_usd_usd.yml index eabcec2a08c..6685e64f298 100644 --- a/addons/account_voucher/test/case1_usd_usd.yml +++ b/addons/account_voucher/test/case1_usd_usd.yml @@ -149,12 +149,13 @@ 'partner_id': ref('res_partner_strauss0'), 'period_id': ref('account.period_3'), 'type': 'receipt', - 'date': time.strftime("%Y-03-01"), + 'date': time.strftime("%Y-%m-%d"), 'payment_option': 'with_writeoff', 'writeoff_acc_id': ref('account.a_expense'), 'comment': 'Write Off', 'name': 'First payment', } + vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-03-01'), ref('base.USD'), 240)['value']) if not res['value']['line_cr_ids']: res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}] for item in res['value']['line_cr_ids']: @@ -247,12 +248,13 @@ 'partner_id': ref('res_partner_strauss0'), 'period_id': ref('account.period_3'), 'type': 'receipt', - 'date': time.strftime("%Y-04-01"), + 'date': time.strftime("%Y-%m-%d"), 'payment_option': 'with_writeoff', 'writeoff_acc_id': ref('account.a_expense'), 'comment': 'Write Off', 'name': 'Second payment', } + vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-04-01'), ref('base.USD'), 45.0)['value']) if not res['value']['line_cr_ids']: res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}] for item in res['value']['line_cr_ids']: diff --git a/addons/account_voucher/test/case2_suppl_usd_eur.yml b/addons/account_voucher/test/case2_suppl_usd_eur.yml index 31e756d5355..424783d8a7b 100644 --- a/addons/account_voucher/test/case2_suppl_usd_eur.yml +++ b/addons/account_voucher/test/case2_suppl_usd_eur.yml @@ -239,12 +239,13 @@ 'partner_id': ref('res_partner_clements0'), 'period_id': ref('account.period_3'), 'type': 'payment', - 'date': time.strftime("%Y-04-01"), + 'date': time.strftime("%Y-%m-%d"), 'payment_option': 'with_writeoff', 'writeoff_acc_id': ref('account.a_expense'), 'comment': 'Write Off', 'name': 'Second payment', } + vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-04-01'), ref('base.USD'), 45.0)['value']) if not res['value']['line_dr_ids']: res['value']['line_dr_ids'] = [{'type': 'dr', 'account_id': ref('account.a_pay'),}] for item in res['value']['line_dr_ids']: diff --git a/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml b/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml index b872a54561d..e1cc87f427e 100644 --- a/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml +++ b/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml @@ -155,12 +155,12 @@ !python {model: account.voucher}: | import netsvc, time vals = {} - res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michael0"), ref('bank_journal_EUR'), 240.0, 2, ttype='receipt', date=False) + res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michael0"), ref('bank_journal_EUR'), 240.0, False, ttype='receipt', date=False) vals = { 'account_id': ref('account.cash'), 'amount': 200.0, 'company_id': ref('base.main_company'), - 'currency_id': ref('base.EUR'), + 'currency_id': False, 'journal_id': ref('bank_journal_EUR'), 'partner_id': ref('res_partner_michael0'), 'period_id': ref('account.period_3'), @@ -220,8 +220,9 @@ 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]) + print move_line.amount_residual, move_line.amount_residual_currency assert (move_line.amount_residual_currency == 55.56 and move_line.amount_residual == 20) , "Residual amount is not correct for first Invoice" -- toto +- I check the residual amuont of Invoice2, should be 22.22 in residual currency and 10 in amount_residual - !python {model: account.invoice}: | @@ -247,13 +248,14 @@ 'partner_id': ref('res_partner_michael0'), 'period_id': ref('account.period_3'), 'type': 'receipt', - 'date': time.strftime("%Y-04-01"), + 'date': time.strftime("%Y-%m-%d"), 'payment_option': 'with_writeoff', 'writeoff_acc_id': ref('account.a_expense'), 'exchange_acc_id': ref('account.o_expense'), 'comment': 'Write Off', 'name': 'Second payment', } + vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-04-01'), ref('base.USD'), 80.0)['value']) if not res['value']['line_cr_ids']: res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}] for item in res['value']['line_cr_ids']: diff --git a/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml b/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml index 8fc495d79c8..355098dc7d6 100644 --- a/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml +++ b/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml @@ -155,7 +155,7 @@ !python {model: account.voucher}: | import netsvc, time vals = {} - res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michal1"), ref('bank_journal_EUR'), 200.0, 2, ttype='receipt', date=False) + res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michal1"), ref('bank_journal_EUR'), 200.0, False, ttype='receipt', date=False) vals = { 'account_id': ref('account.cash'), 'amount': 200.0, @@ -240,7 +240,7 @@ !python {model: account.voucher}: | import netsvc, time vals = {} - res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michal1"), ref('bank_journal_USD'), 80.0, 2, ttype='receipt', date=False) + res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michal1"), ref('bank_journal_USD'), 80.0, ref('base.USD'), ttype='receipt', date=False) vals = { 'account_id': ref('account.cash'), 'amount': 80.0, @@ -250,13 +250,14 @@ 'partner_id': ref('res_partner_michal1'), 'period_id': ref('account.period_3'), 'type': 'receipt', - 'date': time.strftime("%Y-04-01"), + 'date': time.strftime("%Y-%m-%d"), 'payment_option': 'with_writeoff', 'writeoff_acc_id': ref('account.a_expense'), 'exchange_acc_id': ref('account.o_expense'), 'comment': 'Write Off', 'name': 'Second payment', } + vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-04-01'), ref('base.USD'), 80.0)['value']) if not res['value']['line_cr_ids']: res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}] for item in res['value']['line_cr_ids']: diff --git a/addons/account_voucher/test/case3_eur_eur.yml b/addons/account_voucher/test/case3_eur_eur.yml index 374f40607bd..9ed498442fb 100644 --- a/addons/account_voucher/test/case3_eur_eur.yml +++ b/addons/account_voucher/test/case3_eur_eur.yml @@ -118,7 +118,7 @@ !python {model: account.voucher}: | import netsvc, time vals = {} - res = self.onchange_partner_id(cr, uid, [], ref("res_partner_peter0"), ref('bank_journal_EUR'), 120.00, 2, ttype='receipt', date=False) + res = self.onchange_partner_id(cr, uid, [], ref("res_partner_peter0"), ref('bank_journal_EUR'), 120.00, False, ttype='receipt', date=False) vals = { 'account_id': ref('account.cash'), 'amount': 120.00, @@ -210,7 +210,7 @@ !python {model: account.voucher}: | import netsvc, time vals = {} - res = self.onchange_partner_id(cr, uid, [], ref("res_partner_peter0"), ref('bank_journal_EUR'), 120.00, 2, ttype='receipt', date=False) + res = self.onchange_partner_id(cr, uid, [], ref("res_partner_peter0"), ref('bank_journal_EUR'), 120.00, False, ttype='receipt', date=False) vals = { 'account_id': ref('account.cash'), 'amount': 120.00, diff --git a/addons/account_voucher/test/case4_cad_chf.yml b/addons/account_voucher/test/case4_cad_chf.yml index deaf341d1c0..557e20dec1a 100644 --- a/addons/account_voucher/test/case4_cad_chf.yml +++ b/addons/account_voucher/test/case4_cad_chf.yml @@ -97,7 +97,7 @@ !python {model: account.voucher}: | import netsvc, time vals = {} - res = self.onchange_partner_id(cr, uid, [], ref("res_partner_john0"), ref('bank_journal_CHF'), 200.00, 2, ttype='receipt', date=False) + res = self.onchange_partner_id(cr, uid, [], ref("res_partner_john0"), ref('bank_journal_CHF'), 200.00, ref('base.CHF'), ttype='receipt', date=False) vals = { 'account_id': ref('account.cash'), 'amount': 200.00, @@ -107,13 +107,14 @@ 'partner_id': ref('res_partner_john0'), 'period_id': ref('account.period_3'), 'type': 'receipt', - 'date': time.strftime("%Y-03-01"), + 'date': time.strftime("%Y-%m-%d"), 'payment_option': 'with_writeoff', 'writeoff_acc_id': ref('account.a_expense'), 'exchange_acc_id': ref('account.o_expense'), 'comment': 'Write Off', 'name': 'First payment', } + vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-03-01'), ref('base.CHF'), 200.0)['value']) if not res['value']['line_cr_ids']: res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}] for item in res['value']['line_cr_ids']: diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index 170f8fbcfe0..db21b4ce86a 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -82,9 +82,9 @@
- - - + + + @@ -209,9 +209,9 @@ - - - + + +