Merge pull request #30585 from frappe/mergify/bp/develop/pr-30575

fix: Do not apply shipping rule for POS transactions (backport #30575)
This commit is contained in:
Deepesh Garg 2022-04-10 20:12:53 +05:30 committed by GitHub
commit 227a711d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -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.get("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)

View File

@ -273,6 +273,11 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
}
calculate_shipping_charges() {
// Do not apply shipping rule for POS
if (this.frm.doc.is_pos) {
return;
}
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)) {
return this.shipping_rule();