mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 03:29:16 +00:00
Merge pull request #54415 from aerele/fix/clear-condions-table
fix: clear conditions table when calculate_based_on is set to Fixed
This commit is contained in:
@@ -25,6 +25,10 @@ frappe.ui.form.on("Shipping Rule", {
|
|||||||
},
|
},
|
||||||
calculate_based_on: function (frm) {
|
calculate_based_on: function (frm) {
|
||||||
frm.trigger("toggle_reqd");
|
frm.trigger("toggle_reqd");
|
||||||
|
if (frm.doc.calculate_based_on === "Fixed") {
|
||||||
|
frm.clear_table("conditions");
|
||||||
|
frm.refresh_field("conditions");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
toggle_reqd: function (frm) {
|
toggle_reqd: function (frm) {
|
||||||
frm.toggle_reqd("shipping_amount", frm.doc.calculate_based_on === "Fixed");
|
frm.toggle_reqd("shipping_amount", frm.doc.calculate_based_on === "Fixed");
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ class ShippingRule(Document):
|
|||||||
self.validate_overlapping_shipping_rule_conditions()
|
self.validate_overlapping_shipping_rule_conditions()
|
||||||
|
|
||||||
def validate_from_to_values(self):
|
def validate_from_to_values(self):
|
||||||
|
if self.calculate_based_on == "Fixed":
|
||||||
|
if self.conditions:
|
||||||
|
self.set("conditions", [])
|
||||||
|
return
|
||||||
|
|
||||||
zero_to_values = []
|
zero_to_values = []
|
||||||
|
|
||||||
for d in self.get("conditions"):
|
for d in self.get("conditions"):
|
||||||
|
|||||||
Reference in New Issue
Block a user