From f60bdcba032ad2226605a7fe01f97ecb90a70eba Mon Sep 17 00:00:00 2001 From: diptanilsaha Date: Sat, 27 Jun 2026 01:49:43 +0530 Subject: [PATCH] chore: fix eslint issues --- erpnext/public/js/controllers/accounts.js | 10 ------ .../public/js/controllers/taxes_and_totals.js | 28 +++------------ erpnext/public/js/controllers/transaction.js | 34 ++----------------- 3 files changed, 7 insertions(+), 65 deletions(-) diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js index df2b8ecc870..1b1c45e38ea 100644 --- a/erpnext/public/js/controllers/accounts.js +++ b/erpnext/public/js/controllers/accounts.js @@ -16,15 +16,6 @@ erpnext.accounts.taxes = { } }); }, -<<<<<<< HEAD - onload: function(frm) { - if(frm.get_field("taxes")) { - frm.set_query("account_head", "taxes", function(doc) { - if(frm.cscript.tax_table == "Sales Taxes and Charges") { - var account_type = ["Tax", "Chargeable", "Expense Account"]; - } else { - var account_type = ["Tax", "Chargeable", "Income Account", "Expenses Included In Valuation"]; -======= onload: function (frm) { if (frm.get_field("taxes")) { frm.set_query("account_head", "taxes", function (doc) { @@ -34,7 +25,6 @@ erpnext.accounts.taxes = { account_type.push("Expense Account"); } else { account_type.push("Income Account", "Expenses Included In Valuation"); ->>>>>>> 485e9041de (chore: removing `controllers` from pre-commit eslint hooks exclude list (#56575)) } return { diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 17dd88cc16c..1f091f3934d 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -498,7 +498,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { } else if(tax.charge_type == "On Net Total") { if (tax.account_head in item_tax_map) { current_net_amount = item.net_amount - }; + } current_tax_amount = (tax_rate / 100.0) * item.net_amount; } else if(tax.charge_type == "On Previous Row Amount") { current_net_amount = this.frm.doc["taxes"][cint(tax.row_id) - 1].tax_amount_for_current_item @@ -864,26 +864,13 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { let base_grand_total = this.frm.doc.base_rounded_total || this.frm.doc.base_grand_total; let total_amount_to_pay; -<<<<<<< HEAD if(this.frm.doc.party_account_currency == this.frm.doc.currency) { - var total_amount_to_pay = flt((grand_total - this.frm.doc.total_advance + total_amount_to_pay = flt((grand_total - this.frm.doc.total_advance - this.frm.doc.write_off_amount), precision("grand_total")); } else { - var total_amount_to_pay = flt( + total_amount_to_pay = flt( (flt(base_grand_total, precision("base_grand_total")) - this.frm.doc.total_advance - this.frm.doc.base_write_off_amount), -======= - if (this.frm.doc.party_account_currency == this.frm.doc.currency) { - total_amount_to_pay = flt( - grand_total - this.frm.doc.total_advance - this.frm.doc.write_off_amount, - precision("grand_total") - ); - } else { - total_amount_to_pay = flt( - flt(base_grand_total, precision("base_grand_total")) - - this.frm.doc.total_advance - - this.frm.doc.base_write_off_amount, ->>>>>>> 485e9041de (chore: removing `controllers` from pre-commit eslint hooks exclude list (#56575)) precision("base_grand_total") ); } @@ -923,8 +910,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { precision("grand_total") ); } else { -<<<<<<< HEAD - var total_amount_to_pay = flt( + total_amount_to_pay = flt( ( flt( base_grand_total, @@ -932,12 +918,6 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { ) - this.frm.doc.total_advance - this.frm.doc.base_write_off_amount ), -======= - total_amount_to_pay = flt( - flt(base_grand_total, precision("base_grand_total")) - - this.frm.doc.total_advance - - this.frm.doc.base_write_off_amount, ->>>>>>> 485e9041de (chore: removing `controllers` from pre-commit eslint hooks exclude list (#56575)) precision("base_grand_total") ); } diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 23bd75089af..88dc01d5845 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1007,18 +1007,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe var set_party_account = function(set_pricing) { if (["Sales Invoice", "Purchase Invoice"].includes(me.frm.doc.doctype)) { -<<<<<<< HEAD - if(me.frm.doc.doctype=="Sales Invoice") { - var party_type = "Customer"; - var party_account_field = 'debit_to'; - } else { - var party_type = "Supplier"; - var party_account_field = 'credit_to'; - } -======= let party_type = me.frm.doc.doctype == "Sales Invoice" ? "Customer" : "Supplier"; let party_account_field = me.frm.doc.doctype == "Sales Invoice" ? "debit_to" : "credit_to"; ->>>>>>> 485e9041de (chore: removing `controllers` from pre-commit eslint hooks exclude list (#56575)) var party = me.frm.doc[frappe.model.scrub(party_type)]; if(party && me.frm.doc.company && (!me.frm.doc.__onload?.load_after_mapping || !me.frm.doc[party_account_field])) { @@ -1432,7 +1422,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe let first_row = this.frm.doc.items[0]; if (!first_row) { return false - }; + } let mapped_rows = mappped_fields.filter(d => first_row[d]) @@ -1601,36 +1591,23 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe this.toggle_item_grid_columns(company_currency); if (this.frm.doc.operations && this.frm.doc.operations.length > 0) { -<<<<<<< HEAD this.frm.set_currency_labels(["operating_cost", "hour_rate"], this.frm.doc.currency, "operations"); this.frm.set_currency_labels(["base_operating_cost", "base_hour_rate"], company_currency, "operations"); - var item_grid = this.frm.fields_dict["operations"].grid; + let item_grid = this.frm.fields_dict["operations"].grid; $.each(["base_operating_cost", "base_hour_rate"], function(i, fname) { if(frappe.meta.get_docfield(item_grid.doctype, fname)) -======= - let item_grid = this.frm.fields_dict["operations"].grid; - $.each(["base_operating_cost", "base_hour_rate"], function (i, fname) { - if (frappe.meta.get_docfield(item_grid.doctype, fname)) ->>>>>>> 485e9041de (chore: removing `controllers` from pre-commit eslint hooks exclude list (#56575)) item_grid.set_column_disp(fname, me.frm.doc.currency != company_currency); }); } -<<<<<<< HEAD if (this.frm.doc.scrap_items && this.frm.doc.scrap_items.length > 0) { this.frm.set_currency_labels(["rate", "amount"], this.frm.doc.currency, "scrap_items"); this.frm.set_currency_labels(["base_rate", "base_amount"], company_currency, "scrap_items"); - var item_grid = this.frm.fields_dict["scrap_items"].grid; + let item_grid = this.frm.fields_dict["scrap_items"].grid; $.each(["base_rate", "base_amount"], function(i, fname) { if(frappe.meta.get_docfield(item_grid.doctype, fname)) -======= - if (this.frm.doc.secondary_items && this.frm.doc.secondary_items.length > 0) { - let item_grid = this.frm.fields_dict["secondary_items"].grid; - $.each(["base_rate", "base_amount"], function (i, fname) { - if (frappe.meta.get_docfield(item_grid.doctype, fname)) ->>>>>>> 485e9041de (chore: removing `controllers` from pre-commit eslint hooks exclude list (#56575)) item_grid.set_column_disp(fname, me.frm.doc.currency != company_currency); }); } @@ -2255,17 +2232,12 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe }, callback: function(r) { if (!r.exc) { -<<<<<<< HEAD - $.each(me.frm.doc.items || [], function(i, item) { - if (item.name && r.message.hasOwnProperty(item.name) && r.message[item.name].item_tax_template) { -======= $.each(me.frm.doc.items || [], function (i, item) { if ( item.name && Object.prototype.hasOwnProperty.call(r.message, item.name) && r.message[item.name].item_tax_template ) { ->>>>>>> 485e9041de (chore: removing `controllers` from pre-commit eslint hooks exclude list (#56575)) 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);