[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
This commit is contained in:
Quentin (OpenERP) 2012-10-05 10:53:55 +02:00
parent 8c4a842c3d
commit f2cc9b9f5e
2 changed files with 9 additions and 10 deletions

View File

@ -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,

View File

@ -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'])