Compare commits

...

5 Commits

Author SHA1 Message Date
ruthra kumar
6a91f9155f Merge pull request #45059 from frappe/mergify/bp/version-14/pr-45056
chore: partial revert #44989 (backport #45056)
2025-01-02 21:04:58 +05:30
ruthra kumar
77f612354f chore: partial revert #44989
(cherry picked from commit 63d547fb4a)
2025-01-02 15:29:53 +00:00
Frappe PR Bot
0e8a04f2cc chore(release): Bumped to Version 14.78.7
## [14.78.7](https://github.com/frappe/erpnext/compare/v14.78.6...v14.78.7) (2025-01-01)

### Bug Fixes

* slow stock transactions (backport [#45025](https://github.com/frappe/erpnext/issues/45025)) ([#45026](https://github.com/frappe/erpnext/issues/45026)) ([a85a103](a85a103bad))
2025-01-01 10:48:12 +00:00
rohitwaghchaure
2a40845f65 Merge pull request #45029 from frappe/mergify/bp/version-14/pr-45026
fix: slow stock transactions (backport #45025) (backport #45026)
2025-01-01 16:16:46 +05:30
mergify[bot]
a85a103bad fix: slow stock transactions (backport #45025) (#45026)
* fix: slow stock transactions (#45025)

(cherry picked from commit e92af10f14)

# Conflicts:
#	erpnext/stock/stock_ledger.py

* chore: fix conflicts

---------

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
(cherry picked from commit b7509e326e)
2025-01-01 10:00:11 +00:00
4 changed files with 9 additions and 10 deletions

View File

@@ -3,7 +3,7 @@ import inspect
import frappe
__version__ = "14.78.6"
__version__ = "14.78.7"
def get_default_company(user=None):

View File

@@ -713,7 +713,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
}
validate() {
this.apply_pricing_rule()
this.calculate_taxes_and_totals(false);
}

View File

@@ -80,7 +80,7 @@ def get_balance_qty_from_sle(item_code, warehouse):
balance_qty = frappe.db.sql(
"""select qty_after_transaction from `tabStock Ledger Entry`
where item_code=%s and warehouse=%s and is_cancelled=0
order by posting_date desc, posting_time desc, creation desc
order by posting_datetime desc, creation desc
limit 1""",
(item_code, warehouse),
)

View File

@@ -1263,7 +1263,7 @@ def get_previous_sle_of_current_voucher(args, operator="<", exclude_current_vouc
and (
posting_datetime {operator} %(posting_datetime)s
)
order by posting_date desc, posting_time desc, creation desc
order by posting_datetime desc, creation desc
limit 1
for update""",
{
@@ -1357,7 +1357,7 @@ def get_stock_ledger_entries(
where item_code = %(item_code)s
and is_cancelled = 0
{conditions}
order by posting_date {order}, posting_time {order}, creation {order}
order by posting_datetime {order}, creation {order}
{limit} {for_update}""".format(
conditions=conditions,
limit=limit or "",
@@ -1462,7 +1462,7 @@ def get_valuation_rate(
AND valuation_rate >= 0
AND is_cancelled = 0
AND NOT (voucher_no = %s AND voucher_type = %s)
order by posting_date desc, posting_time desc, name desc limit 1""",
order by posting_datetime desc, creation desc limit 1""",
(item_code, warehouse, voucher_no, voucher_type),
)
@@ -1711,8 +1711,8 @@ def get_future_sle_with_negative_qty(sle):
& (SLE.is_cancelled == 0)
& (SLE.qty_after_transaction < 0)
)
.orderby(SLE.posting_date)
.orderby(SLE.posting_time)
.orderby(SLE.posting_datetime)
.orderby(SLE.creation)
.limit(1)
)
@@ -1728,14 +1728,14 @@ def get_future_sle_with_negative_batch_qty(args):
with batch_ledger as (
select
posting_date, posting_time, posting_datetime, voucher_type, voucher_no,
sum(actual_qty) over (order by posting_date, posting_time, creation) as cumulative_total
sum(actual_qty) over (order by posting_datetime, creation) as cumulative_total
from `tabStock Ledger Entry`
where
item_code = %(item_code)s
and warehouse = %(warehouse)s
and batch_no=%(batch_no)s
and is_cancelled = 0
order by posting_date, posting_time, creation
order by posting_datetime, creation
)
select * from batch_ledger
where