ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Reapply customization on Duplicate


#1

Hello;

I did customization when adding items in the order and invoices, so instead of getting the rate from the price list, it is calculating the rate for each item based on equation and settings and it is working fine.

The problem now, when I need to do Duplicate (from the Menu), the new duplicated document is fetching the rate from the price list !! From where I can change this?

It seems there is code that is related to Duplicate, because when doing duplicate for example to sales order, it is creating new copy document but with empty delivery date, so for sure there is a code that is related to the duplicate (an action to be done when doing duplicate), if I can reach for this code, I can check why it is not getting the same rate that was in the original document and it is fetching the rate from the price list.

Regards
Bilal


#2

You can trigger your customization by writing a event handler for refresh event


#3

Hello @rmehta
From the other side, can you please guide me where I can find the code that is related to the Duplicate or to the Menu that we see it for the document (the menu at the document itself and not at the list view)?

Regards
Bilal


#4

Perhaps here https://github.com/frappe/frappe/blob/develop/frappe/public/js/frappe/form/toolbar.js#L141

That file turns up from this search:

(env) frappe@ubuntu1804lts:~/frappe-bench$ find . -name '*.js' | xargs grep 'Request Feedback'
./sites/assets/js/form.min.js:    				this.page.add_menu_item(__("Request Feedback"), function() {
grep: ./apps/frappe/node_modules/big.js: Is a directory
grep: ./apps/frappe/node_modules/highlight.js: Is a directory
grep: ./apps/frappe/node_modules/ipaddr.js: Is a directory
grep: ./apps/frappe/node_modules/fuse.js: Is a directory
./apps/frappe/frappe/public/js/frappe/form/toolbar.js:				this.page.add_menu_item(__("Request Feedback"), function() {

Where to find source code for Actions menu