import frappe
from frappe import _
def after_insert(doc, method=None):
try:
frappe.errprint("Test1")
if doc.party_type == "Customer":
frappe.errprint("Test2")
# this check if the button is submit and create gl entry and not worked like preview button
path = str(frappe.local.request.path)
frappe.errprint(path)
if path in ['/api/method/frappe.model.workflow.apply_workflow' ,'/api/method/frappe.desk.form.save.savedocs']:
frappe.errprint("Test3")
elif path in ['/api/method/erpnext.controllers.stock_controller.show_accounting_ledger_preview']:
frappe.errprint("Test33")
# pass
else:
frappe.errprint("Test3444")
# /api/method/frappe.desk.form.save.cancel
frappe.throw("Can not send sms Tell IT manager")
except Exception as e:
frappe.throw("Error: " + str(e))
i try this code but the throw did not fire but the errprint fired?!