fix: Linting issues
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index ff4898e..0b9d771 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -12,7 +12,7 @@
if (in_list(["Sales Order", "Quotation"], item.parenttype) && item.blanket_order_rate) {
effective_item_rate = item.blanket_order_rate;
}
- if(item.margin_type == "Percentage") {
+ if (item.margin_type == "Percentage") {
item.rate_with_margin = flt(effective_item_rate)
+ flt(effective_item_rate) * ( flt(item.margin_rate_or_amount) / 100);
} else {
@@ -22,7 +22,7 @@
item_rate = flt(item.rate_with_margin , precision("rate", item));
- if(item.discount_percentage){
+ if (item.discount_percentage) {
item.discount_amount = flt(item.rate_with_margin) * flt(item.discount_percentage) / 100;
}
@@ -271,14 +271,14 @@
let item_codes = [];
let item_rates = {};
$.each(this.frm.doc.items || [], function(i, item) {
- if(item.item_code) {
+ if (item.item_code) {
// Use combination of name and item code in case same item is added multiple times
item_codes.push([item.item_code, item.name]);
item_rates[item.name] = item.net_rate;
}
});
- if(item_codes.length) {
+ if (item_codes.length) {
return this.frm.call({
method: "erpnext.stock.get_item_details.get_item_tax_info",
args: {
@@ -288,21 +288,18 @@
item_rates: item_rates
},
callback: function(r) {
- if(!r.exc) {
+ if (!r.exc) {
$.each(me.frm.doc.items || [], function(i, item) {
- if(item.name && r.message.hasOwnProperty(item.name)) {
+ if (item.name && r.message.hasOwnProperty(item.name)) {
item.item_tax_template = r.message[item.name].item_tax_template;
item.item_tax_rate = r.message[item.name].item_tax_rate;
me.add_taxes_from_item_tax_template(item.item_tax_rate);
- }
- else {
+ } else {
item.item_tax_template = "";
item.item_tax_rate = "{}";
}
});
}
-
- this.frm.refresh_fields();
}
});
}
@@ -311,14 +308,14 @@
add_taxes_from_item_tax_template: function(item_tax_map) {
let me = this;
- if(item_tax_map && cint(frappe.defaults.get_default("add_taxes_from_item_tax_template"))) {
- if(typeof (item_tax_map) == "string") {
+ if (item_tax_map && cint(frappe.defaults.get_default("add_taxes_from_item_tax_template"))) {
+ if (typeof (item_tax_map) == "string") {
item_tax_map = JSON.parse(item_tax_map);
}
$.each(item_tax_map, function(tax, rate) {
let found = (me.frm.doc.taxes || []).find(d => d.account_head === tax);
- if(!found) {
+ if (!found) {
let child = frappe.model.add_child(me.frm.doc, "taxes");
child.charge_type = "On Net Total";
child.account_head = tax;
@@ -632,6 +629,8 @@
tax.item_wise_tax_detail = JSON.stringify(tax.item_wise_tax_detail);
});
}
+
+ this.frm.refresh_fields();
},
set_discount_amount: function() {
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 6f51053..746cbbf 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -509,7 +509,7 @@
# do not change if already a valid template
if args.get('item_tax_template') in taxes:
- return arg.get('item_tax_template')
+ return args.get('item_tax_template')
for tax in taxes:
if cstr(tax.tax_category) == cstr(args.get("tax_category")):