From 82960e33124b4264dbb8512c23484cc7f945d4e5 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 22 Dec 2023 17:55:58 +0530 Subject: [PATCH] fix: reset the incoming rate on changing of the warehouse (backport #38925) (#38926) fix: reset the incoming rate on changing of the warehouse (#38925) (cherry picked from commit 161ae1edd1ebcafd14d7a302ad1adde238e43426) Co-authored-by: rohitwaghchaure --- erpnext/public/js/utils/sales_common.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/public/js/utils/sales_common.js b/erpnext/public/js/utils/sales_common.js index 084cca7db5f..b92b02e8269 100644 --- a/erpnext/public/js/utils/sales_common.js +++ b/erpnext/public/js/utils/sales_common.js @@ -184,6 +184,12 @@ erpnext.sales_common = { refresh_field("incentives",row.name,row.parentfield); } + warehouse(doc, cdt, cdn) { + if (doc.docstatus === 0 && doc.is_return && !doc.return_against) { + frappe.model.set_value(cdt, cdn, "incoming_rate", 0.0); + } + } + toggle_editable_price_list_rate() { var df = frappe.meta.get_docfield(this.frm.doc.doctype + " Item", "price_list_rate", this.frm.doc.name); var editable_price_list_rate = cint(frappe.defaults.get_default("editable_price_list_rate"));