I just duplicated a doctype and in the backend I defined the before_save methodbut it is not getting called…
Here is the code snippet
from future import unicode_literals
import frappe
from frappe.model.document import Document
class ShiftTry(Document):
def on_update(self):
frappe.msgprint(__(“Custom Message”))
Can someone tell me where I am going wrong?
First, wrap your code snippets in triple backticks so you can have correct indentation and syntax highlighting:
from future import unicode_literals
import frappe
from frappe.model.document import Document
class ShiftTry(Document):
def on_update(self): # this is the problem
frappe.msgprint(__(“Custom Message”))
def before_save(self): # this should work
frappe.msgprint(__(“Custom Message”))
Here is the documentation.