How to write change event on item code without affecting the existing change events

I know its late but it may help for someone else.

One way to do this is to override whitelisted method erpnext.stock.get_item_details.get_item_details in hook.py of your custom app.

override_whitelisted_methods = { "erpnext.stock.get_item_details.get_item_details" : "link.to.your.custom_get_item_details" }

In your .py custom script file add this code

@frappe.whitelist()
def custom_get_item_details(args):

'that run standard event.
from erpnext.stock.get_item_details import get_item_details
out = get_item_details(args)

'Allow you to get data from args.
args = process_args(args)

'Your change event. You can append data to out.

return out

def process_args(args):
	if isinstance(args, basestring):
		args = json.loads(args)

args = frappe._dict(args)

return args
3 Likes