Reapply customization on Duplicate

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

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

1 Like

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

Perhaps here frappe/toolbar.js at develop · frappe/frappe · GitHub

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() {