From e853b460654f58d6a32d6d02569e8bf55776a6ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 7 Oct 2008 12:25:54 +0200 Subject: [PATCH] Fix delete fiscalyear for issue415 --- fiscalyear.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fiscalyear.py b/fiscalyear.py index bf554ef86b..8e818e8f96 100644 --- a/fiscalyear.py +++ b/fiscalyear.py @@ -110,6 +110,16 @@ class FiscalYear(OSV): return super(FiscalYear, self).write(cursor, user, ids, vals, context=context) + def delete(self, cursor, user, ids, context=None): + period_obj = self.pool.get('account.period') + + period_ids = [] + for fiscalyear in self.browse(cursor, user, ids, context=context): + period_ids.extend([x.id for x in fiscalyear.periods]) + period_obj.delete(cursor, user, period_ids, context=context) + return super(FiscalYear, self).delete(cursor, user, ids, + context=context) + def create_period(self, cursor, user, ids, context=None, interval=1): ''' Create periods for the fiscal years with month interval