From 714fc08150678aebbd6272fc2c156552f36b1eb0 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 4 Apr 2022 20:05:10 +0530 Subject: [PATCH 1/3] fix: Do not apply shipping rule for POS transactions (cherry picked from commit c0ebcfb39331caa678d36cc4694490a2363f10a0) # Conflicts: # erpnext/public/js/controllers/taxes_and_totals.js --- erpnext/controllers/taxes_and_totals.py | 5 +++++ erpnext/public/js/controllers/taxes_and_totals.js | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 8183b6e2c99..42cd7de4c99 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -307,6 +307,11 @@ class calculate_taxes_and_totals(object): self.doc.round_floats_in(self.doc, ["total", "base_total", "net_total", "base_net_total"]) def calculate_shipping_charges(self): + + # Do not apply shipping rule for POS + if self.doc.is_pos: + return + if hasattr(self.doc, "shipping_rule") and self.doc.shipping_rule: shipping_rule = frappe.get_doc("Shipping Rule", self.doc.shipping_rule) shipping_rule.apply(self.doc) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 047ec814b64..728835795cc 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -272,7 +272,16 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { }); } +<<<<<<< HEAD calculate_shipping_charges() { +======= + calculate_shipping_charges: function() { + // Do not apply shipping rule for POS + if (this.frm.doc.is_pos) { + return; + } + +>>>>>>> c0ebcfb393 (fix: Do not apply shipping rule for POS transactions) frappe.model.round_floats_in(this.frm.doc, ["total", "base_total", "net_total", "base_net_total"]); if (frappe.meta.get_docfield(this.frm.doc.doctype, "shipping_rule", this.frm.doc.name)) { this.shipping_rule(); From 631545aa3287bde2db15ace490b242c3f3f02c41 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 6 Apr 2022 09:27:40 +0530 Subject: [PATCH 2/3] fix: Use get instead of dot (cherry picked from commit 95298f04000c0299f35cdee7bce0f5f0d8c59525) --- erpnext/controllers/taxes_and_totals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 42cd7de4c99..2144055b343 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -309,7 +309,7 @@ class calculate_taxes_and_totals(object): def calculate_shipping_charges(self): # Do not apply shipping rule for POS - if self.doc.is_pos: + if self.doc.get("is_pos"): return if hasattr(self.doc, "shipping_rule") and self.doc.shipping_rule: From e30cc8422c1621070934e433fe3e13d407325081 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Sat, 9 Apr 2022 19:53:40 +0530 Subject: [PATCH 3/3] fix: Resolve conflicts --- erpnext/public/js/controllers/taxes_and_totals.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 728835795cc..7a48fbdbd96 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -272,16 +272,12 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments { }); } -<<<<<<< HEAD calculate_shipping_charges() { -======= - calculate_shipping_charges: function() { // Do not apply shipping rule for POS if (this.frm.doc.is_pos) { return; } ->>>>>>> c0ebcfb393 (fix: Do not apply shipping rule for POS transactions) frappe.model.round_floats_in(this.frm.doc, ["total", "base_total", "net_total", "base_net_total"]); if (frappe.meta.get_docfield(this.frm.doc.doctype, "shipping_rule", this.frm.doc.name)) { this.shipping_rule();