fix: set sla creation date if not set
This commit is contained in:
parent
5c5ec3c492
commit
fe39be5f97
@ -47,16 +47,13 @@ class CRMServiceLevelAgreement(Document):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def apply(self, doc: Document):
|
def apply(self, doc: Document):
|
||||||
self.handle_new(doc)
|
self.handle_creation(doc)
|
||||||
self.handle_communication_status(doc)
|
self.handle_communication_status(doc)
|
||||||
self.handle_targets(doc)
|
self.handle_targets(doc)
|
||||||
self.handle_sla_status(doc)
|
self.handle_sla_status(doc)
|
||||||
|
|
||||||
def handle_new(self, doc: Document):
|
def handle_creation(self, doc: Document):
|
||||||
if not doc.is_new():
|
doc.sla_creation = doc.sla_creation or now_datetime()
|
||||||
return
|
|
||||||
creation = doc.sla_creation or now_datetime()
|
|
||||||
doc.sla_creation = creation
|
|
||||||
|
|
||||||
def handle_communication_status(self, doc: Document):
|
def handle_communication_status(self, doc: Document):
|
||||||
if doc.is_new() or not doc.has_value_changed("communication_status"):
|
if doc.is_new() or not doc.has_value_changed("communication_status"):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user