fix: Add additional check to ensure doc_before save exists

This commit is contained in:
Suraj Shetty 2019-06-17 09:29:46 +05:30
parent eb0ca67ced
commit a86a07ef37
2 changed files with 4 additions and 3 deletions

View File

@ -75,10 +75,11 @@
{ {
"fieldname": "medium", "fieldname": "medium",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Medium" "label": "Medium",
"read_only": 1
} }
], ],
"modified": "2019-06-17 08:21:20.665441", "modified": "2019-06-17 09:02:48.150383",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Communication", "module": "Communication",
"name": "Call Log", "name": "Call Log",

View File

@ -15,5 +15,5 @@ class CallLog(Document):
def on_update(self): def on_update(self):
doc_before_save = self.get_doc_before_save() doc_before_save = self.get_doc_before_save()
if doc_before_save.status in ['Ringing'] and self.status in ['Missed', 'Completed']: if doc_before_save and doc_before_save.status in ['Ringing'] and self.status in ['Missed', 'Completed']:
frappe.publish_realtime('call_{id}_disconnected'.format(id=self.id), self) frappe.publish_realtime('call_{id}_disconnected'.format(id=self.id), self)