From 9cf463765786255cac22afb8cdb40d86e8a4c048 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Tue, 6 Mar 2012 17:10:40 +0100 Subject: [PATCH] [FIX] account.move.line: do not create writeoff entries when called from fy closing wizard bzr revid: xal@openerp.com-20120306161040-ycv7viqwtfn1lbob --- addons/account/account_move_line.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 17120ee265e..c6182d9e61b 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -827,7 +827,12 @@ class account_move_line(osv.osv): if r[0][1] != None: raise osv.except_osv(_('Error'), _('Some entries are already reconciled !')) - if (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \ + if context.get('fy_closing'): + # We don't want to generate any write-off when being called from the + # wizard used to close a fiscal year (and it doesn't give us any + # writeoff_acc_id). + pass + elif (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \ (account.currency_id and (not currency_obj.is_zero(cr, uid, account.currency_id, currency))): if not writeoff_acc_id: raise osv.except_osv(_('Warning'), _('You have to provide an account for the write off/exchange difference entry !'))