Commit 095e3aff authored by Alain Takoudjou's avatar Alain Takoudjou

Delay destroy of unlinked instances if modification_date is recent

parent 5a6f2ed1
from zExceptions import Unauthorized
from DateTime import DateTime
from Products.ERP5Type.DateUtils import addToDate
if REQUEST is not None:
raise Unauthorized
......@@ -12,6 +14,11 @@ if hosting_subscription is None or \
hosting_subscription.getSlapState() == "destroy_requested":
return
# If instance modificationDate is too recent, skip
# Delay destroy of unlinked instances
if instance.getModificationDate() - addToDate(DateTime(), {'minute': -50}) > 0:
return
if instance.getPredecessorRelatedValue() is None:
# This unlinked instance to parent should be removed
is_slave = False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment