Fix task and model last_change handling

Improve db model index
Improve db model infrastructure
This commit is contained in:
allegroai
2021-01-05 18:17:29 +02:00
parent 29c792d459
commit 59994ccf9c
14 changed files with 80 additions and 35 deletions

View File

@@ -127,7 +127,11 @@ class ProjectBLL:
project_name=project_name,
description="Auto-generated during move",
)
entity_cls.objects(company=company, id__in=ids).update(set__project=project)
extra = (
{"set__last_change": datetime.utcnow()}
if hasattr(entity_cls, "last_change")
else {}
)
entity_cls.objects(company=company, id__in=ids).update(set__project=project, **extra)
return project