fix: check if doc_before_save exists
This commit is contained in:
parent
173960e50b
commit
764f18e2e9
1 changed files with 8 additions and 7 deletions
|
|
@ -59,13 +59,14 @@ class Workflow(Document):
|
|||
|
||||
def update_doc_status(self):
|
||||
doc_before_save = self.get_doc_before_save()
|
||||
for current_doc_state, doc_before_save_state in zip(self.states, doc_before_save.states):
|
||||
if not doc_before_save_state.doc_status == current_doc_state.doc_status:
|
||||
frappe.db.set_value(self.document_type,
|
||||
{self.workflow_state_field: doc_before_save_state.state},
|
||||
'docstatus',
|
||||
current_doc_state.doc_status
|
||||
)
|
||||
if doc_before_save:
|
||||
for current_doc_state, doc_before_save_state in zip(self.states, doc_before_save.states):
|
||||
if not doc_before_save_state.doc_status == current_doc_state.doc_status:
|
||||
frappe.db.set_value(self.document_type,
|
||||
{self.workflow_state_field: doc_before_save_state.state},
|
||||
'docstatus',
|
||||
current_doc_state.doc_status
|
||||
)
|
||||
|
||||
def validate_docstatus(self):
|
||||
def get_state(state):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue