From 65bdf83d0a56ecdd606c7b8b615b0af5eed19df0 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 9 Mar 2009 10:20:57 +0530 Subject: [PATCH] [FIX] Bug 338678 : Corrected fiscalyear closing wizard bzr revid: jvo@tinyerp.com-20090309045057-8qh60i6iy7dspgrq --- addons/account/account_move_line.py | 2 +- addons/account/wizard/wizard_fiscalyear_close.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 0dacc365fcc..084185a6462 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -531,6 +531,7 @@ class account_move_line(osv.osv): def reconcile(self, cr, uid, ids, type='auto', writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False, context={}): id_set = ','.join(map(str, ids)) + lines = self.browse(cr, uid, ids, context=context) unrec_lines = filter(lambda x: not x['reconcile_id'], lines) credit = debit = 0.0 @@ -707,7 +708,6 @@ class account_move_line(osv.osv): return result def unlink(self, cr, uid, ids, context={}, check=True): - print "CC" self._update_check(cr, uid, ids, context) result = False for line in self.browse(cr, uid, ids, context): diff --git a/addons/account/wizard/wizard_fiscalyear_close.py b/addons/account/wizard/wizard_fiscalyear_close.py index feba99a4ccb..7cd560e7b44 100644 --- a/addons/account/wizard/wizard_fiscalyear_close.py +++ b/addons/account/wizard/wizard_fiscalyear_close.py @@ -63,7 +63,8 @@ def _data_save(self, cr, uid, data, context): period = pool.get('account.period').browse(cr, uid, data['form']['period_id'], context=context) new_fyear = pool.get('account.fiscalyear').browse(cr, uid, data['form']['fy2_id'], context=context) - + old_fyear = pool.get('account.fiscalyear').browse(cr, uid, data['form']['fy_id'], context=context) + new_journal = data['form']['journal_id'] new_journal = pool.get('account.journal').browse(cr, uid, new_journal, context=context) @@ -192,8 +193,12 @@ def _data_save(self, cr, uid, data, context): offset += limit ids = pool.get('account.move.line').search(cr, uid, [('journal_id','=',new_journal.id), - ('period_id.fiscalyear_id','=',new_fyear.id)]) + ('period_id.fiscalyear_id','=',old_fyear.id)]) context['fy_closing'] = True + if not ids: + raise wizard.except_wizard(_('UserError'), + _('The old fiscal year does not have any entry to reconcile!')) + pool.get('account.move.line').reconcile(cr, uid, ids, context=context) new_period = data['form']['period_id'] ids = pool.get('account.journal.period').search(cr, uid, [('journal_id','=',new_journal.id),('period_id','=',new_period)])