From d9ce732d3e57d31a4ee30cebd4153ceac3253668 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 7 Feb 2019 21:58:56 +0530 Subject: [PATCH 1/5] fix(py3): Explicitly convert to float for comparison --- erpnext/controllers/accounts_controller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 6be282d0a3..23849c254e 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1124,10 +1124,10 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil else: child_item = frappe.get_doc(parent_doctype + ' Item', d.get("docname")) - if parent_doctype == "Sales Order" and flt(d.get("qty")) < child_item.delivered_qty: + if parent_doctype == "Sales Order" and flt(d.get("qty")) < flt(child_item.delivered_qty): frappe.throw(_("Cannot set quantity less than delivered quantity")) - if parent_doctype == "Purchase Order" and flt(d.get("qty")) < child_item.received_qty: + if parent_doctype == "Purchase Order" and flt(d.get("qty")) < flt(child_item.received_qty): frappe.throw(_("Cannot set quantity less than received quantity")) child_item.qty = flt(d.get("qty")) From e1f867f29f10f3e28a6a6874dea0d9153823a967 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 7 Feb 2019 22:04:58 +0530 Subject: [PATCH 2/5] fix(py3): Explicitly convert to float for comparison --- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index f006d00176..8563d46568 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -120,12 +120,12 @@ class PurchaseReceipt(BuyingController): self.company, self.base_grand_total) self.update_prevdoc_status() - if self.per_billed < 100: + if flt(self.per_billed) < 100: self.update_billing_status() else: self.status = "Completed" - + # Updating stock ledger should always be called after updating prevdoc status, # because updating ordered qty, reserved_qty_for_subcontract in bin # depends upon updated ordered qty in PO @@ -311,7 +311,7 @@ class PurchaseReceipt(BuyingController): "\n".join(warehouse_with_no_account)) return process_gl_map(gl_entries) - + def get_asset_gl_entry(self, gl_entries): for d in self.get("items"): if d.is_fixed_asset: From 6e1bb60b585fd2370f466ddf177cb5bbb89546d0 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 7 Feb 2019 22:09:13 +0530 Subject: [PATCH 3/5] fix(py3): Convert filter to list for indexing --- erpnext/stock/doctype/stock_entry/test_stock_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 9095075b41..448e2db76d 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -562,7 +562,7 @@ class TestStockEntry(unittest.TestCase): for d in stock_entry.get("items"): if d.item_code != "_Test FG Item 2": rm_cost += flt(d.amount) - fg_cost = filter(lambda x: x.item_code=="_Test FG Item 2", stock_entry.get("items"))[0].amount + fg_cost = list(filter(lambda x: x.item_code=="_Test FG Item 2", stock_entry.get("items")))[0].amount self.assertEqual(fg_cost, flt(rm_cost + bom_operation_cost + work_order.additional_operating_cost, 2)) From 3e954734d095c13cfcb484e5ae2a2a4b0148cfea Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 7 Feb 2019 22:13:38 +0530 Subject: [PATCH 4/5] fix(py3): Convert filter to list for indexing --- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index 8f3289c6c2..11b0a6dbe6 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -369,7 +369,7 @@ def apply_internal_priority(pricing_rules, field_set, args): filtered_rules = [] for field in field_set: if args.get(field): - filtered_rules = filter(lambda x: x[field]==args[field], pricing_rules) + filtered_rules = list(filter(lambda x: x[field]==args[field], pricing_rules)) if filtered_rules: break return filtered_rules or pricing_rules From a86a5697877094bcb1306be9f4a2de52f5297e98 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 7 Feb 2019 22:15:44 +0530 Subject: [PATCH 5/5] fix(py3): Convert dict.values() to list for indexing --- .../sales_payment_summary/test_sales_payment_summary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py index 62843e74ef..3628c9ddf4 100644 --- a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py +++ b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py @@ -47,8 +47,8 @@ class TestSalesPaymentSummary(unittest.TestCase): pe.submit() mop = get_mode_of_payments(filters) - self.assertTrue('Credit Card' in mop.values()[0]) - self.assertTrue('Cash' in mop.values()[0]) + self.assertTrue('Credit Card' in list(mop.values())[0]) + self.assertTrue('Cash' in list(mop.values())[0]) # Cancel all Cash payment entry and check if this mode of payment is still fetched. payment_entries = frappe.get_all("Payment Entry", filters={"mode_of_payment": "Cash", "docstatus": 1}, fields=["name", "docstatus"])