From 403822afb315b80c1c48c05ccf9749ba08ff73ae Mon Sep 17 00:00:00 2001 From: pateljannat Date: Thu, 5 Nov 2020 16:24:33 +0530 Subject: [PATCH 1/4] fix: correcting description field in taxes and charges for accounts that have account number + account name --- erpnext/public/js/controllers/accounts.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js index 6e97d811fc1..b1ffcfb6ad0 100644 --- a/erpnext/public/js/controllers/accounts.js +++ b/erpnext/public/js/controllers/accounts.js @@ -146,18 +146,21 @@ cur_frm.cscript.account_head = function(doc, cdt, cdn) { if(!d.charge_type && d.account_head){ frappe.msgprint(__("Please select Charge Type first")); frappe.model.set_value(cdt, cdn, "account_head", ""); - } else if(d.account_head && d.charge_type!=="Actual") { + } else if(d.account_head) { frappe.call({ type:"GET", method: "erpnext.controllers.accounts_controller.get_tax_rate", args: {"account_head":d.account_head}, callback: function(r) { - frappe.model.set_value(cdt, cdn, "rate", r.message.tax_rate || 0); - frappe.model.set_value(cdt, cdn, "description", r.message.account_name); + if(d.charge_type!=="Actual"){ + frappe.model.set_value(cdt, cdn, "rate", r.message.tax_rate || 0); + frappe.model.set_value(cdt, cdn, "description", r.message.account_name); + } + else if(d.charge_type == 'Actual'){ + frappe.model.set_value(cdt, cdn, "description", r.message.account_name); + } } }) - } else if (d.charge_type == 'Actual' && d.account_head) { - frappe.model.set_value(cdt, cdn, "description", d.account_head.split(' - ')[0]); } } From 5b02d328269e2654f6253c45ddafe215121d2435 Mon Sep 17 00:00:00 2001 From: pateljannat Date: Thu, 5 Nov 2020 18:04:14 +0530 Subject: [PATCH 2/4] fix: trailling spaces removed --- erpnext/public/js/controllers/accounts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js index b1ffcfb6ad0..1bceec05470 100644 --- a/erpnext/public/js/controllers/accounts.js +++ b/erpnext/public/js/controllers/accounts.js @@ -155,7 +155,7 @@ cur_frm.cscript.account_head = function(doc, cdt, cdn) { if(d.charge_type!=="Actual"){ frappe.model.set_value(cdt, cdn, "rate", r.message.tax_rate || 0); frappe.model.set_value(cdt, cdn, "description", r.message.account_name); - } + } else if(d.charge_type == 'Actual'){ frappe.model.set_value(cdt, cdn, "description", r.message.account_name); } From b648b9cf93dcbc47a5f33fa49acbc601e14ff614 Mon Sep 17 00:00:00 2001 From: pateljannat Date: Tue, 10 Nov 2020 18:50:02 +0530 Subject: [PATCH 3/4] fix: code review changes --- erpnext/public/js/controllers/accounts.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js index 1bceec05470..9c746ab50b1 100644 --- a/erpnext/public/js/controllers/accounts.js +++ b/erpnext/public/js/controllers/accounts.js @@ -154,11 +154,8 @@ cur_frm.cscript.account_head = function(doc, cdt, cdn) { callback: function(r) { if(d.charge_type!=="Actual"){ frappe.model.set_value(cdt, cdn, "rate", r.message.tax_rate || 0); - frappe.model.set_value(cdt, cdn, "description", r.message.account_name); - } - else if(d.charge_type == 'Actual'){ - frappe.model.set_value(cdt, cdn, "description", r.message.account_name); } + frappe.model.set_value(cdt, cdn, "description", r.message.account_name); } }) } From 7e4d115e36d9026f8fe5ad60c6d80e56c19c826b Mon Sep 17 00:00:00 2001 From: pateljannat Date: Wed, 11 Nov 2020 09:52:27 +0530 Subject: [PATCH 4/4] fix: sider issues fixed --- erpnext/public/js/controllers/accounts.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js index 9c746ab50b1..29f35958e19 100644 --- a/erpnext/public/js/controllers/accounts.js +++ b/erpnext/public/js/controllers/accounts.js @@ -146,13 +146,13 @@ cur_frm.cscript.account_head = function(doc, cdt, cdn) { if(!d.charge_type && d.account_head){ frappe.msgprint(__("Please select Charge Type first")); frappe.model.set_value(cdt, cdn, "account_head", ""); - } else if(d.account_head) { + } else if (d.account_head) { frappe.call({ type:"GET", method: "erpnext.controllers.accounts_controller.get_tax_rate", args: {"account_head":d.account_head}, callback: function(r) { - if(d.charge_type!=="Actual"){ + if (d.charge_type!=="Actual") { frappe.model.set_value(cdt, cdn, "rate", r.message.tax_rate || 0); } frappe.model.set_value(cdt, cdn, "description", r.message.account_name);