fix(various)
This commit is contained in:
parent
20fb443f0c
commit
c35271aef5
@ -237,14 +237,14 @@ def remove_pricing_rules(item_list):
|
|||||||
def get_pricing_rules(args):
|
def get_pricing_rules(args):
|
||||||
def _get_tree_conditions(parenttype, allow_blank=True):
|
def _get_tree_conditions(parenttype, allow_blank=True):
|
||||||
field = frappe.scrub(parenttype)
|
field = frappe.scrub(parenttype)
|
||||||
if not frappe.flags.tree_conditions:
|
|
||||||
frappe.flags.tree_conditions = {}
|
|
||||||
key = (parenttype, args[field], )
|
|
||||||
if key in frappe.flags.tree_conditions:
|
|
||||||
return frappe.flags.tree_conditions[key]
|
|
||||||
|
|
||||||
condition = ""
|
condition = ""
|
||||||
if args.get(field):
|
if args.get(field):
|
||||||
|
if not frappe.flags.tree_conditions:
|
||||||
|
frappe.flags.tree_conditions = {}
|
||||||
|
key = (parenttype, args[field], )
|
||||||
|
if key in frappe.flags.tree_conditions:
|
||||||
|
return frappe.flags.tree_conditions[key]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
lft, rgt = frappe.db.get_value(parenttype, args[field], ["lft", "rgt"])
|
lft, rgt = frappe.db.get_value(parenttype, args[field], ["lft", "rgt"])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
|||||||
@ -139,10 +139,11 @@ class SellingController(StockController):
|
|||||||
|
|
||||||
def validate_max_discount(self):
|
def validate_max_discount(self):
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
discount = flt(frappe.get_cached_value("Item", d.item_code, "max_discount"))
|
if d.item_code:
|
||||||
|
discount = flt(frappe.get_cached_value("Item", d.item_code, "max_discount"))
|
||||||
|
|
||||||
if discount and flt(d.discount_percentage) > discount:
|
if discount and flt(d.discount_percentage) > discount:
|
||||||
frappe.throw(_("Maximum discount for Item {0} is {1}%").format(d.item_code, discount))
|
frappe.throw(_("Maximum discount for Item {0} is {1}%").format(d.item_code, discount))
|
||||||
|
|
||||||
def set_qty_as_per_stock_uom(self):
|
def set_qty_as_per_stock_uom(self):
|
||||||
for d in self.get("items"):
|
for d in self.get("items"):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user