Remove check against move when deleting account period
The period on the move restrict on delete of the foreign key.
This commit is contained in:
@@ -9,9 +9,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.message" id="msg_no_open_period_date">
|
||||
<field name="text">To continue, you must reopen the period "%(period)s" of company "%(company)s" for the date "%(date)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_modify_delete_period_moves">
|
||||
<field name="text">You cannot modify or delete period "%(period)s" because it contains moves.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_create_period_closed_fiscalyear">
|
||||
<field name="text">You cannot create a period in fiscal year "%(fiscalyear)s" because it is closed.</field>
|
||||
</record>
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user