fix: use CombineDatetime instead of Timestamp in QB queries
diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py
index 3b9fe7b..e6f5527 100644
--- a/erpnext/stock/doctype/batch/batch.py
+++ b/erpnext/stock/doctype/batch/batch.py
@@ -6,7 +6,7 @@
from frappe import _
from frappe.model.document import Document
from frappe.model.naming import make_autoname, revert_series_if_last
-from frappe.query_builder.functions import CurDate, Sum, Timestamp
+from frappe.query_builder.functions import CombineDatetime, CurDate, Sum
from frappe.utils import cint, flt, get_link_to_form, nowtime
from frappe.utils.data import add_days
from frappe.utils.jinja import render_template
@@ -192,7 +192,8 @@
posting_time = nowtime()
query = query.where(
- Timestamp(sle.posting_date, sle.posting_time) <= Timestamp(posting_date, posting_time)
+ CombineDatetime(sle.posting_date, sle.posting_time)
+ <= CombineDatetime(posting_date, posting_time)
)
out = query.run(as_list=True)[0][0] or 0
diff --git a/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py b/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
index df01b14..e9c9608 100644
--- a/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
+++ b/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
@@ -5,7 +5,7 @@
import frappe
from frappe import _
from frappe.query_builder import Field
-from frappe.query_builder.functions import Min, Timestamp
+from frappe.query_builder.functions import CombineDatetime, Min
from frappe.utils import add_days, getdate, today
import erpnext
@@ -75,7 +75,7 @@
& (sle.company == report_filters.company)
& (sle.is_cancelled == 0)
)
- .orderby(Timestamp(sle.posting_date, sle.posting_time), sle.creation)
+ .orderby(CombineDatetime(sle.posting_date, sle.posting_time), sle.creation)
).run(as_dict=True)
for d in data: