From db12e88f2b48edab95e33399bfbd233039a9f56e Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 25 Jan 2010 14:22:56 +0530 Subject: [PATCH] [FIX] Account: Bank statement line,if has write-off entries,should pass write off account to move line bzr revid: jvo@tinyerp.com-20100125085256-jqxoqe1xlg8amx02 --- addons/account/account_bank_statement.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index f725a5477ba..2b0c72abb46 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -287,7 +287,14 @@ class account_bank_statement(osv.osv): torec += map(lambda x: x.id, move.reconcile_id.line_ids) #try: if abs(move.reconcile_amount-move.amount)<0.0001: - account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context) + + writeoff_acc_id = False + #There should only be one write-off account! + for entry in move.reconcile_id.line_new_ids: + writeoff_acc_id = entry.account_id.id + break + + account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context) else: account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) #except: