fix: allow snake & camel case for on load, on save, convert to deal, on create lead

This commit is contained in:
Shariq Ansari 2025-06-06 21:01:20 +05:30
parent f58d44bf9c
commit c6e9d71e1f

View File

@ -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)
}