From c5dedab30478bef17bbc0b166795dab95f3578b7 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 19 Aug 2024 10:25:27 +0530 Subject: [PATCH] chore: resolve conflicts --- erpnext/public/js/controllers/accounts.js | 49 ++----------------- .../public/js/controllers/taxes_and_totals.js | 6 --- 2 files changed, 5 insertions(+), 50 deletions(-) diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js index 79770b83202..304b71e33d4 100644 --- a/erpnext/public/js/controllers/accounts.js +++ b/erpnext/public/js/controllers/accounts.js @@ -22,7 +22,6 @@ frappe.ui.form.on(cur_frm.doctype, { } else { var account_type = ["Tax", "Chargeable", "Income Account", "Expenses Included In Valuation"]; } -<<<<<<< HEAD return { query: "erpnext.controllers.queries.tax_account_query", @@ -30,18 +29,6 @@ frappe.ui.form.on(cur_frm.doctype, { "account_type": account_type, "company": doc.company, } -======= - }, - included_in_print_rate: function(frm, cdt, cdn) { - let tax = frappe.get_doc(cdt, cdn); - try { - me.validate_taxes_and_charges(cdt, cdn); - me.validate_inclusive_tax(tax, frm); - } catch(e) { - tax.included_in_print_rate = 0; - refresh_field("included_in_print_rate", tax.name, tax.parentfield); - throw e; ->>>>>>> 50d56db0c2 (fix: specify precision for net_amount (#39481)) } }); frm.set_query("cost_center", "taxes", function(doc) { @@ -66,24 +53,14 @@ frappe.ui.form.on(cur_frm.doctype, { erpnext.taxes.set_conditional_mandatory_rate_or_amount(frm.open_grid_row()); }, -<<<<<<< HEAD allocate_advances_automatically: function(frm) { frm.trigger('fetch_advances'); }, -======= - validate_inclusive_tax: function(tax, frm) { - this.frm = this.frm || frm; - let actual_type_error = function() { - var msg = __("Actual type tax cannot be included in Item rate in row {0}", [tax.idx]) - frappe.throw(msg); - }; ->>>>>>> 50d56db0c2 (fix: specify precision for net_amount (#39481)) only_include_allocated_payments: function(frm) { frm.trigger('fetch_advances'); }, -<<<<<<< HEAD fetch_advances: function(frm) { if(frm.doc.allocate_advances_automatically) { frappe.call({ @@ -91,23 +68,6 @@ frappe.ui.form.on(cur_frm.doctype, { method: "set_advances", callback: function(r, rt) { refresh_field("advances"); -======= - if(cint(tax.included_in_print_rate)) { - if(tax.charge_type == "Actual") { - // inclusive tax cannot be of type Actual - actual_type_error(); - } else if (tax.charge_type == "On Previous Row Amount" && this.frm && - !cint(this.frm.doc["taxes"][tax.row_id - 1].included_in_print_rate) - ) { - // referred row should also be an inclusive tax - on_previous_row_error(tax.row_id); - } else if (tax.charge_type == "On Previous Row Total" && this.frm) { - var taxes_not_included = $.map(this.frm.doc["taxes"].slice(0, tax.row_id), - function(t) { return cint(t.included_in_print_rate) ? null : t; }); - if(taxes_not_included.length > 0) { - // all rows above this tax should be inclusive - on_previous_row_error(tax.row_id == 1 ? "1" : "1 - " + tax.row_id); ->>>>>>> 50d56db0c2 (fix: specify precision for net_amount (#39481)) } }) } @@ -270,7 +230,8 @@ cur_frm.cscript.validate_taxes_and_charges = function(cdt, cdn) { } -cur_frm.cscript.validate_inclusive_tax = function(tax) { +cur_frm.cscript.validate_inclusive_tax = function(tax, frm) { + this.frm = this.frm || frm; var actual_type_error = function() { var msg = __("Actual type tax cannot be included in Item rate in row {0}", [tax.idx]) frappe.throw(msg); @@ -286,12 +247,12 @@ cur_frm.cscript.validate_inclusive_tax = function(tax) { if(tax.charge_type == "Actual") { // inclusive tax cannot be of type Actual actual_type_error(); - } else if(tax.charge_type == "On Previous Row Amount" && + } else if(tax.charge_type == "On Previous Row Amount" && this.frm && !cint(this.frm.doc["taxes"][tax.row_id - 1].included_in_print_rate) ) { // referred row should also be an inclusive tax on_previous_row_error(tax.row_id); - } else if(tax.charge_type == "On Previous Row Total") { + } else if(tax.charge_type == "On Previous Row Total" && this.frm) { var taxes_not_included = $.map(this.frm.doc["taxes"].slice(0, tax.row_id), function(t) { return cint(t.included_in_print_rate) ? null : t; }); if(taxes_not_included.length > 0) { @@ -334,7 +295,7 @@ if(!erpnext.taxes.flags[cur_frm.cscript.tax_table]) { var tax = frappe.get_doc(cdt, cdn); try { cur_frm.cscript.validate_taxes_and_charges(cdt, cdn); - cur_frm.cscript.validate_inclusive_tax(tax); + cur_frm.cscript.validate_inclusive_tax(tax, frm); } catch(e) { tax.included_in_print_rate = 0; refresh_field("included_in_print_rate", tax.name, tax.parentfield); diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index b164453e68c..82e1d518362 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -183,15 +183,9 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { $.each(tax_fields, function(i, fieldname) { tax[fieldname] = 0.0; }); -<<<<<<< HEAD if (!this.discount_amount_applied && cur_frm) { cur_frm.cscript.validate_taxes_and_charges(tax.doctype, tax.name); me.validate_inclusive_tax(tax); -======= - if (!this.discount_amount_applied) { - erpnext.accounts.taxes.validate_taxes_and_charges(tax.doctype, tax.name); - erpnext.accounts.taxes.validate_inclusive_tax(tax, this.frm); ->>>>>>> 50d56db0c2 (fix: specify precision for net_amount (#39481)) } frappe.model.round_floats_in(tax); });