Merge pull request #23836 from pateljannat/purchase-taxes-and-charges-account-name-issue
fix: correcting description field in taxes and charges for accounts with account number + account name
This commit is contained in:
commit
a0b17c4ef6
@ -146,18 +146,18 @@ cur_frm.cscript.account_head = function(doc, cdt, cdn) {
|
|||||||
if(!d.charge_type && d.account_head){
|
if(!d.charge_type && d.account_head){
|
||||||
frappe.msgprint(__("Please select Charge Type first"));
|
frappe.msgprint(__("Please select Charge Type first"));
|
||||||
frappe.model.set_value(cdt, cdn, "account_head", "");
|
frappe.model.set_value(cdt, cdn, "account_head", "");
|
||||||
} else if(d.account_head && d.charge_type!=="Actual") {
|
} else if (d.account_head) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
type:"GET",
|
type:"GET",
|
||||||
method: "erpnext.controllers.accounts_controller.get_tax_rate",
|
method: "erpnext.controllers.accounts_controller.get_tax_rate",
|
||||||
args: {"account_head":d.account_head},
|
args: {"account_head":d.account_head},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
frappe.model.set_value(cdt, cdn, "rate", r.message.tax_rate || 0);
|
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);
|
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]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user