test case fixed

This commit is contained in:
Nabin Hait 2015-03-17 10:14:59 +05:30
parent 5b73da99d6
commit d3fd8965de
5 changed files with 9 additions and 10 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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",

View File

@ -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",

View File

@ -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