From d3fd8965defc85aaa6a6614a2029bab4fb37f3ef Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 17 Mar 2015 10:14:59 +0530 Subject: [PATCH] test case fixed --- erpnext/accounts/utils.py | 4 ++-- .../doctype/production_order/production_order.py | 2 +- .../doctype/production_order/test_production_order.py | 2 +- erpnext/projects/doctype/time_log/test_time_log.py | 2 +- erpnext/stock/doctype/stock_entry/test_stock_entry.py | 9 ++++----- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 0f17e521d1..f6d9529713 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -338,12 +338,12 @@ def get_actual_expense(args): args["condition"] = " and posting_date<='%s'" % args.month_end_date \ if args.get("month_end_date") else "" - return frappe.db.sql(""" + return flt(frappe.db.sql(""" select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) from `tabGL Entry` where account='%(account)s' and cost_center='%(cost_center)s' and fiscal_year='%(fiscal_year)s' and company='%(company)s' %(condition)s - """ % (args))[0][0] + """ % (args))[0][0]) def get_currency_precision(currency=None): if not currency: diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index d0ad06e43c..673b966a63 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -124,7 +124,7 @@ class ProductionOrder(Document): def update_production_order_qty(self): """Update **Manufactured Qty** and **Material Transferred for Qty** in Production Order based on Stock Entry""" - print "call" + for purpose, fieldname in (("Manufacture", "produced_qty"), ("Material Transfer for Manufacture", "material_transferred_for_manufacturing")): qty = flt(frappe.db.sql("""select sum(fg_completed_qty) diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.py b/erpnext/manufacturing/doctype/production_order/test_production_order.py index 37df081432..625be51039 100644 --- a/erpnext/manufacturing/doctype/production_order/test_production_order.py +++ b/erpnext/manufacturing/doctype/production_order/test_production_order.py @@ -75,7 +75,7 @@ class TestProductionOrder(unittest.TestCase): prod_order = frappe.get_doc({ "doctype": "Production Order", "production_item": "_Test FG Item 2", - "bom_no": "BOM/_Test FG Item 2/002", + "bom_no": "BOM/_Test FG Item 2/001", "qty": 1, "wip_warehouse": "_Test Warehouse - _TC", "fg_warehouse": "_Test Warehouse 1 - _TC", diff --git a/erpnext/projects/doctype/time_log/test_time_log.py b/erpnext/projects/doctype/time_log/test_time_log.py index c21d8111e8..1920bf5d43 100644 --- a/erpnext/projects/doctype/time_log/test_time_log.py +++ b/erpnext/projects/doctype/time_log/test_time_log.py @@ -89,7 +89,7 @@ def make_prod_order(self): return frappe.get_doc({ "doctype":"Production Order", "production_item": "_Test FG Item 2", - "bom_no": "BOM/_Test FG Item 2/002", + "bom_no": "BOM/_Test FG Item 2/001", "qty": 1, "wip_warehouse": "_Test Warehouse - _TC", "fg_warehouse": "_Test Warehouse 1 - _TC", diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index a5e82b9bcf..388ae63f2d 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -82,18 +82,17 @@ class TestStockEntry(unittest.TestCase): else: template = item - warehouse = "_Test Warehouse - _TC" - # stock entry reqd for auto-reorder - make_stock_entry(item_code=item_code, target="_Test Warehouse - _TC", qty=1, incoming_rate=1) + create_stock_reconciliation(item_code=item_code, warehouse="_Test Warehouse - _TC", + qty=10, rate=100) frappe.db.set_value("Stock Settings", None, "auto_indent", 1) projected_qty = frappe.db.get_value("Bin", {"item_code": item_code, - "warehouse": warehouse}, "projected_qty") or 0 + "warehouse": "_Test Warehouse - _TC"}, "projected_qty") or 0 # update re-level qty so that it is more than projected_qty if projected_qty > template.reorder_levels[0].warehouse_reorder_level: - template.reorder_levels[0].warehouse_reorder_level = projected_qty + template.reorder_levels[0].warehouse_reorder_level += projected_qty template.save() from erpnext.stock.reorder_item import reorder_item