@@ -1571,7 +1571,7 @@ def get_previous_sle_of_current_voucher(args, operator="<", exclude_current_vouc
1571
1571
and (
1572
1572
posting_datetime { operator } %(posting_datetime)s
1573
1573
)
1574
- order by posting_date desc, posting_time desc, creation desc
1574
+ order by posting_datetime desc, creation desc
1575
1575
limit 1
1576
1576
for update""" ,
1577
1577
{
@@ -1665,7 +1665,7 @@ def get_stock_ledger_entries(
1665
1665
where item_code = %(item_code)s
1666
1666
and is_cancelled = 0
1667
1667
{conditions}
1668
- order by posting_date {order}, posting_time {order}, creation {order}
1668
+ order by posting_datetime {order}, creation {order}
1669
1669
{limit} {for_update}""" .format (
1670
1670
conditions = conditions ,
1671
1671
limit = limit or "" ,
@@ -1787,7 +1787,7 @@ def get_valuation_rate(
1787
1787
AND valuation_rate >= 0
1788
1788
AND is_cancelled = 0
1789
1789
AND NOT (voucher_no = %s AND voucher_type = %s)
1790
- order by posting_date desc, posting_time desc, name desc limit 1""" ,
1790
+ order by posting_datetime desc, creation desc limit 1""" ,
1791
1791
(item_code , warehouse , voucher_no , voucher_type ),
1792
1792
):
1793
1793
return flt (last_valuation_rate [0 ][0 ])
@@ -2038,7 +2038,7 @@ def get_future_sle_with_negative_qty(sle_args):
2038
2038
and posting_datetime >= %(posting_datetime)s
2039
2039
and is_cancelled = 0
2040
2040
and qty_after_transaction < 0
2041
- order by posting_date asc, posting_time asc
2041
+ order by posting_datetime asc, creation asc
2042
2042
limit 1
2043
2043
""" ,
2044
2044
sle_args ,
@@ -2052,14 +2052,14 @@ def get_future_sle_with_negative_batch_qty(sle_args):
2052
2052
with batch_ledger as (
2053
2053
select
2054
2054
posting_date, posting_time, posting_datetime, voucher_type, voucher_no,
2055
- sum(actual_qty) over (order by posting_date, posting_time , creation) as cumulative_total
2055
+ sum(actual_qty) over (order by posting_datetime , creation) as cumulative_total
2056
2056
from `tabStock Ledger Entry`
2057
2057
where
2058
2058
item_code = %(item_code)s
2059
2059
and warehouse = %(warehouse)s
2060
2060
and batch_no=%(batch_no)s
2061
2061
and is_cancelled = 0
2062
- order by posting_date, posting_time , creation
2062
+ order by posting_datetime , creation
2063
2063
)
2064
2064
select * from batch_ledger
2065
2065
where
0 commit comments