style: fixed formatting
This commit is contained in:
parent
74bcb987f3
commit
b214e624bb
@ -30,8 +30,15 @@ class PromotionalScheme(Document):
|
|||||||
frappe.throw(_("Price or product discount slabs are required"))
|
frappe.throw(_("Price or product discount slabs are required"))
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
data = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name", "creation"], order_by = 'creation asc',
|
data = frappe.get_all(
|
||||||
filters = {'promotional_scheme': self.name, 'applicable_for': self.applicable_for}) or {}
|
'Pricing Rule',
|
||||||
|
fields = ["promotional_scheme_id", "name", "creation"],
|
||||||
|
filters = {
|
||||||
|
'promotional_scheme': self.name,
|
||||||
|
'applicable_for': self.applicable_for
|
||||||
|
},
|
||||||
|
order_by = 'creation asc',
|
||||||
|
) or {}
|
||||||
self.update_pricing_rules(data)
|
self.update_pricing_rules(data)
|
||||||
|
|
||||||
def update_pricing_rules(self, data):
|
def update_pricing_rules(self, data):
|
||||||
@ -77,10 +84,15 @@ def _get_pricing_rules(doc, child_doc, discount_fields, rules = {}):
|
|||||||
for d in doc.get(child_doc):
|
for d in doc.get(child_doc):
|
||||||
if d.name in rules:
|
if d.name in rules:
|
||||||
for applicable_for_value in args.get(applicable_for):
|
for applicable_for_value in args.get(applicable_for):
|
||||||
|
|
||||||
temp_args = args.copy()
|
temp_args = args.copy()
|
||||||
docname = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name", applicable_for],
|
docname = frappe.get_all(
|
||||||
filters = {'promotional_scheme_id': d.name, applicable_for: applicable_for_value})
|
'Pricing Rule',
|
||||||
|
fields = ["promotional_scheme_id", "name", applicable_for],
|
||||||
|
filters = {
|
||||||
|
'promotional_scheme_id': d.name,
|
||||||
|
applicable_for: applicable_for_value
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
if docname:
|
if docname:
|
||||||
pr = frappe.get_doc('Pricing Rule', docname[0].get('name'))
|
pr = frappe.get_doc('Pricing Rule', docname[0].get('name'))
|
||||||
@ -139,7 +151,6 @@ def get_args_for_pricing_rule(doc):
|
|||||||
for applicable_for_values in doc.get(applicable_for):
|
for applicable_for_values in doc.get(applicable_for):
|
||||||
items.append(applicable_for_values.get(applicable_for))
|
items.append(applicable_for_values.get(applicable_for))
|
||||||
args[d] = items
|
args[d] = items
|
||||||
|
|
||||||
else:
|
else:
|
||||||
args[d] = doc.get(d)
|
args[d] = doc.get(d)
|
||||||
return args
|
return args
|
||||||
|
Loading…
x
Reference in New Issue
Block a user