From f2cc9b9f5e2c7d1f742bfea65842ded1ad139d65 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 5 Oct 2012 10:53:55 +0200 Subject: [PATCH] [FIX] account_payment: fixed error in yalm tests due to value returned for a field not present in the view bzr revid: qdp-launchpad@openerp.com-20121005085355-92vao01nusvl1ik5 --- .../account_payment_populate_statement.py | 18 +++++++++--------- addons/account_voucher/account_voucher.py | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index ecfd4988329..fffe6c17b92 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -86,24 +86,24 @@ class account_payment_populate_statement(osv.osv_memory): 'name': line.name, 'partner_id': line.partner_id.id, 'journal_id': statement.journal_id.id, - 'account_id': result.get('account_id', statement.journal_id.default_credit_account_id.id), + 'account_id': result['value'].get('account_id', statement.journal_id.default_credit_account_id.id), 'company_id': statement.company_id.id, 'currency_id': statement.currency.id, 'date': line.date or time.strftime('%Y-%m-%d'), 'amount': abs(amount), - 'period_id': statement.period_id.id + 'period_id': statement.period_id.id, } voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) - voucher_line_dict = False - if result['value']['line_ids']: - for line_dict in result['value']['line_ids']: - move_line = move_line_obj.browse(cr, uid, line_dict['move_line_id'], context) - if line.move_line_id.move_id.id == move_line.move_id.id: - voucher_line_dict = line_dict + + voucher_line_dict = {} + for line_dict in result['value']['line_cr_ids'] + result['value']['line_dr_ids']: + move_line = move_line_obj.browse(cr, uid, line_dict['move_line_id'], context) + if line.move_line_id.move_id.id == move_line.move_id.id: + voucher_line_dict = line_dict + if voucher_line_dict: voucher_line_dict.update({'voucher_id': voucher_id}) voucher_line_obj.create(cr, uid, voucher_line_dict, context=context) - st_line_id = statement_line_obj.create(cr, uid, { 'name': line.order_id.reference or '?', 'amount': - amount, diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 5f48a8020c4..423026251c2 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -552,7 +552,6 @@ class account_voucher(osv.osv): # We should definitively split account.voucher object in two and make distinct on_change functions. In the # meanwhile, bellow lines must be there because the fields aren't present in the view, what crashes if the # onchange returns a value for them - print "TTYPE", ttype if ttype == 'sale': del(res['value']['line_dr_ids']) del(res['value']['pre_line'])