From 1646fbe478fefaa173c2c1e009d1a5d0dcb13326 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Fri, 10 Jun 2022 13:52:17 +0530 Subject: [PATCH] refactor: remove add_fetch (#31315) - Sales Team already had fetch from set up - Set up fetch from on sales partner in sales transaction Reason for removal: the JS code applies arbitrarily to any field called "sales_person" --- erpnext/accounts/doctype/sales_invoice/sales_invoice.json | 4 +++- erpnext/selling/doctype/sales_order/sales_order.json | 4 +++- erpnext/selling/sales_common.js | 4 +--- erpnext/stock/doctype/delivery_note/delivery_note.json | 4 +++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 80b95db8868..327545aa54e 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -1790,6 +1790,8 @@ "width": "50%" }, { + "fetch_from": "sales_partner.commission_rate", + "fetch_if_empty": 1, "fieldname": "commission_rate", "fieldtype": "Float", "hide_days": 1, @@ -2038,7 +2040,7 @@ "link_fieldname": "consolidated_invoice" } ], - "modified": "2022-03-08 16:08:53.517903", + "modified": "2022-06-10 03:52:51.409913", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index ff921c721df..74c5c07e47b 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -1359,6 +1359,8 @@ "width": "50%" }, { + "fetch_from": "sales_partner.commission_rate", + "fetch_if_empty": 1, "fieldname": "commission_rate", "fieldtype": "Float", "hide_days": 1, @@ -1547,7 +1549,7 @@ "idx": 105, "is_submittable": 1, "links": [], - "modified": "2022-04-26 14:38:18.350207", + "modified": "2022-06-10 03:52:22.212953", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order", diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 6cb53c3bbe3..8ff01f5cb4c 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -12,8 +12,6 @@ frappe.provide("erpnext.selling"); erpnext.selling.SellingController = class SellingController extends erpnext.TransactionController { setup() { super.setup(); - this.frm.add_fetch("sales_partner", "commission_rate", "commission_rate"); - this.frm.add_fetch("sales_person", "commission_rate", "commission_rate"); } onload() { @@ -514,4 +512,4 @@ frappe.ui.form.on(cur_frm.doctype, { dialog.show(); } -}) \ No newline at end of file +}) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index e3222bc8850..f9e934921d8 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -1192,6 +1192,8 @@ "width": "50%" }, { + "fetch_from": "sales_partner.commission_rate", + "fetch_if_empty": 1, "fieldname": "commission_rate", "fieldtype": "Float", "label": "Commission Rate (%)", @@ -1334,7 +1336,7 @@ "idx": 146, "is_submittable": 1, "links": [], - "modified": "2022-04-26 14:48:08.781837", + "modified": "2022-06-10 03:52:04.197415", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note",