From 4bc74de5799e29bc150efabca96252dbafecd225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 6 Nov 2023 15:46:25 +0100 Subject: [PATCH] Remove check against move when deleting account period The period on the move restrict on delete of the foreign key. --- modules/account/message.xml | 3 --- modules/account/period.py | 12 ------------ 2 files changed, 15 deletions(-) diff --git a/modules/account/message.xml b/modules/account/message.xml index 31abd9da79..a6804cf9fd 100644 --- a/modules/account/message.xml +++ b/modules/account/message.xml @@ -9,9 +9,6 @@ this repository contains the full copyright notices and license terms. --> To continue, you must reopen the period "%(period)s" of company "%(company)s" for the date "%(date)s". - - You cannot modify or delete period "%(period)s" because it contains moves. - You cannot create a period in fiscal year "%(fiscalyear)s" because it is closed. diff --git a/modules/account/period.py b/modules/account/period.py index fb3488a810..442852d6e2 100644 --- a/modules/account/period.py +++ b/modules/account/period.py @@ -272,17 +272,6 @@ class Period(Workflow, ModelSQL, ModelView): else: return period - @classmethod - def _check(cls, periods): - Move = Pool().get('account.move') - moves = Move.search([ - ('period', 'in', [p.id for p in periods]), - ], limit=1) - if moves: - raise AccessError( - gettext('account.msg_modify_delete_period_moves', - period=moves[0].period.rec_name)) - @classmethod def search(cls, args, offset=0, limit=None, order=None, count=False, query=False): @@ -362,7 +351,6 @@ class Period(Workflow, ModelSQL, ModelView): @classmethod def delete(cls, periods): - cls._check(periods) super(Period, cls).delete(periods) cls._find_cache.clear()