From c6e9d71e1f5178e7318be294ee3d29acbf562dc2 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 6 Jun 2025 21:01:20 +0530 Subject: [PATCH] fix: allow snake & camel case for on load, on save, convert to deal, on create lead --- frontend/src/data/document.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/data/document.js b/frontend/src/data/document.js index 67302549..bd412a44 100644 --- a/frontend/src/data/document.js +++ b/frontend/src/data/document.js @@ -98,14 +98,14 @@ export function useDocument(doctype, docname) { async function triggerOnLoad() { const handler = async function () { - await this.onLoad?.() + await (this.onLoad?.() || this.on_load?.() || this.onload?.()) } await trigger(handler) } async function triggerOnSave() { const handler = async function () { - await this.onSave?.() + await (this.onSave?.() || this.on_save?.()) } await trigger(handler) } @@ -164,7 +164,7 @@ export function useDocument(doctype, docname) { async function triggerOnCreateLead() { const args = Array.from(arguments) const handler = async function () { - await this.on_create_lead?.(...args) + await (this.onCreateLead?.(...args) || this.on_create_lead?.(...args)) } await trigger(handler) } @@ -172,7 +172,8 @@ export function useDocument(doctype, docname) { async function triggerConvertToDeal() { const args = Array.from(arguments) const handler = async function () { - await this.convert_to_deal?.(...args) + await (this.convertToDeal?.(...args) || + this.on_convert_to_deal?.(...args)) } await trigger(handler) }