Fixed Stock Entry Test Cases frappe/frappe#478

This commit is contained in:
Anand Doshi
2014-04-07 18:51:58 +05:30
parent 103cc58cb6
commit 2ce39cf770
9 changed files with 573 additions and 573 deletions

View File

@@ -169,9 +169,13 @@ def get_sle_before_datetime(args, for_update=False):
def get_sle_after_datetime(args, for_update=False):
"""get Stock Ledger Entries after a particular datetime, for reposting"""
# NOTE: using for update of
return get_stock_ledger_entries(args,
["timestamp(posting_date, posting_time) > timestamp(%(posting_date)s, %(posting_time)s)"],
"asc", for_update=for_update)
conditions = ["timestamp(posting_date, posting_time) > timestamp(%(posting_date)s, %(posting_time)s)"]
# Excluding name: Workaround for MariaDB timestamp() floating microsecond issue
if args.get("name"):
conditions.append("name!=%(name)s")
return get_stock_ledger_entries(args, conditions, "asc", for_update=for_update)
def get_stock_ledger_entries(args, conditions=None, order="desc", limit=None, for_update=False):
"""get stock ledger entries filtered by specific posting datetime conditions"""
@@ -180,7 +184,7 @@ def get_stock_ledger_entries(args, conditions=None, order="desc", limit=None, fo
if not args.get("posting_time"):
args["posting_time"] = "00:00"
return frappe.db.sql("""select * from `tabStock Ledger Entry`
return frappe.db.sql("""select *, timestamp(posting_date, posting_time) as "timestamp" from `tabStock Ledger Entry`
where item_code = %%(item_code)s
and warehouse = %%(warehouse)s
and ifnull(is_cancelled, 'No')='No'