Merge branch 'develop' into shipping-rule-updation-error
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 667edab..e30a0a1 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -258,6 +258,10 @@
self.doc.round_floats_in(self.doc, ["total", "base_total", "net_total", "base_net_total"])
+ 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)
+
def calculate_taxes(self):
if not self.doc.get('is_consolidated'):
self.doc.rounding_adjustment = 0
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index b5a6d8f..0ada660 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -268,6 +268,9 @@
});
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()
+ }
}
add_taxes_from_item_tax_template(item_tax_map) {
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 63fd8a1..0cfc008 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -1085,16 +1085,8 @@
return this.frm.call({
doc: this.frm.doc,
method: "apply_shipping_rule",
- callback: function(r) {
- if(!r.exc) {
- me.calculate_taxes_and_totals();
- }
- }
}).fail(() => this.frm.set_value('shipping_rule', ''));
}
- else {
- me.calculate_taxes_and_totals();
- }
}
set_margin_amount_based_on_currency(exchange_rate) {