Merge pull request #16605 from adityahase/fix-py3
fix(py3): Python 3 compatibility fixes
This commit is contained in:
commit
1bfdceaf7e
@ -346,7 +346,7 @@ def filter_pricing_rules(args, pricing_rules):
|
||||
if len(pricing_rules) > 1:
|
||||
rate_or_discount = list(set([d.rate_or_discount for d in pricing_rules]))
|
||||
if len(rate_or_discount) == 1 and rate_or_discount[0] == "Discount Percentage":
|
||||
pricing_rules = filter(lambda x: x.for_price_list==args.price_list, pricing_rules) \
|
||||
pricing_rules = list(filter(lambda x: x.for_price_list==args.price_list, pricing_rules)) \
|
||||
or pricing_rules
|
||||
|
||||
if len(pricing_rules) > 1 and not args.for_shopping_cart:
|
||||
|
@ -57,8 +57,8 @@ class TestSalesPaymentSummary(unittest.TestCase):
|
||||
pe.cancel()
|
||||
|
||||
mop = get_mode_of_payments(filters)
|
||||
self.assertTrue('Credit Card' in mop.values()[0])
|
||||
self.assertTrue('Cash' not in mop.values()[0])
|
||||
self.assertTrue('Credit Card' in list(mop.values())[0])
|
||||
self.assertTrue('Cash' not in list(mop.values())[0])
|
||||
|
||||
def test_get_mode_of_payments_details(self):
|
||||
filters = get_filters()
|
||||
@ -84,7 +84,7 @@ class TestSalesPaymentSummary(unittest.TestCase):
|
||||
|
||||
mopd = get_mode_of_payment_details(filters)
|
||||
|
||||
mopd_values = mopd.values()[0]
|
||||
mopd_values = list(mopd.values())[0]
|
||||
for mopd_value in mopd_values:
|
||||
if mopd_value[0] == "Credit Card":
|
||||
cc_init_amount = mopd_value[1]
|
||||
@ -96,7 +96,7 @@ class TestSalesPaymentSummary(unittest.TestCase):
|
||||
pe.cancel()
|
||||
|
||||
mopd = get_mode_of_payment_details(filters)
|
||||
mopd_values = mopd.values()[0]
|
||||
mopd_values = list(mopd.values())[0]
|
||||
for mopd_value in mopd_values:
|
||||
if mopd_value[0] == "Credit Card":
|
||||
cc_final_amount = mopd_value[1]
|
||||
|
@ -1132,7 +1132,7 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
||||
|
||||
child_item.qty = flt(d.get("qty"))
|
||||
|
||||
if child_item.billed_amt > (flt(d.get("rate")) * flt(d.get("qty"))):
|
||||
if flt(child_item.billed_amt) > (flt(d.get("rate")) * flt(d.get("qty"))):
|
||||
frappe.throw(_("Row #{0}: Cannot set Rate if amount is greater than billed amount for Item {1}.")
|
||||
.format(child_item.idx, child_item.item_code))
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user