Hi,
I have called on function on_submit from hooks.py.
I don’t know, why its calling twice.
hooks.py code
doc_events = {
"Job Card": {
"validate": "sample_register.sample_register.doctype.sample_entry_register.sample_entry_register.status_updator",
"on_submit": "sample_register.sample_register.doctype.sample_entry_register.sample_entry_register.status_updator"
}
}
python function
@frappe.whitelist(allow_guest=True)
def status_updator(self, method):
if self.sample_id and (self.docstatus==1):
frappe.msgprint("in submit"+self.sample_id)
sample_entry_doc=frappe.get_doc("Sample Entry Register",self.sample_id)
sample_entry_doc.job_card_status = "Submitted"
sample_entry_doc.save()
Submit called twice: