style: fixed formatting

This commit is contained in:
noahjacob 2021-05-18 14:52:50 +05:30 committed by Noah Jacob
parent 4fb1b6b80c
commit 74bcb987f3
2 changed files with 17 additions and 17 deletions

View File

@ -85,12 +85,12 @@ def _get_pricing_rules(doc, child_doc, discount_fields, rules = {}):
if docname:
pr = frappe.get_doc('Pricing Rule', docname[0].get('name'))
temp_args[applicable_for] = applicable_for_value
pr = set_args(temp_args,pr,doc,child_doc,discount_fields,d)
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
else:
pr = frappe.new_doc("Pricing Rule")
pr.title = make_autoname("{0}/.####".format(doc.name))
temp_args[applicable_for] = applicable_for_value
pr = set_args(temp_args,pr,doc,child_doc,discount_fields,d)
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
new_doc.append(pr)
@ -101,7 +101,7 @@ def _get_pricing_rules(doc, child_doc, discount_fields, rules = {}):
pr.title = make_autoname("{0}/.####".format(doc.name))
temp_args = args.copy()
temp_args[applicable_for] = args[applicable_for][i]
pr = set_args(temp_args,pr,doc,child_doc,discount_fields,d)
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
new_doc.append(pr)
return new_doc

View File

@ -12,10 +12,10 @@ class TestPromotionalScheme(unittest.TestCase):
price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name", "creation"],
filters = {'promotional_scheme': ps.name})
self.assertTrue(len(price_rules),1)
price_doc_details = frappe.db.get_value('Pricing Rule',price_rules[0].name,['customer','min_qty','discount_percentage'],as_dict = 1)
self.assertTrue(price_doc_details.customer,'_Test Customer')
self.assertTrue(price_doc_details.min_qty,4)
self.assertTrue(price_doc_details.discount_percentage,20)
price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[0].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
self.assertTrue(price_doc_details.customer, '_Test Customer')
self.assertTrue(price_doc_details.min_qty, 4)
self.assertTrue(price_doc_details.discount_percentage, 20)
ps.price_discount_slabs[0].min_qty = 6
ps.append('customer', {
@ -23,21 +23,21 @@ class TestPromotionalScheme(unittest.TestCase):
ps.save()
price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
filters = {'promotional_scheme': ps.name})
self.assertTrue(len(price_rules),2)
self.assertTrue(len(price_rules), 2)
price_doc_details = frappe.db.get_value('Pricing Rule',price_rules[1].name,['customer','min_qty','discount_percentage'],as_dict = 1)
self.assertTrue(price_doc_details.customer,'_Test Customer 2')
self.assertTrue(price_doc_details.min_qty,6)
self.assertTrue(price_doc_details.discount_percentage,20)
price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[1].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
self.assertTrue(price_doc_details.customer, '_Test Customer 2')
self.assertTrue(price_doc_details.min_qty, 6)
self.assertTrue(price_doc_details.discount_percentage, 20)
price_doc_details = frappe.db.get_value('Pricing Rule',price_rules[0].name,['customer','min_qty','discount_percentage'],as_dict = 1)
self.assertTrue(price_doc_details.customer,'_Test Customer')
self.assertTrue(price_doc_details.min_qty,6)
price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[0].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
self.assertTrue(price_doc_details.customer, '_Test Customer')
self.assertTrue(price_doc_details.min_qty, 6)
frappe.delete_doc('Promotional Scheme',ps.name)
frappe.delete_doc('Promotional Scheme', ps.name)
price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
filters = {'promotional_scheme': ps.name})
self.assertEqual(price_rules,[])
self.assertEqual(price_rules, [])
def make_promotional_scheme():
ps = frappe.new_doc('Promotional Scheme')