diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index 3b9fe7b97cda..e6f55275437a 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 @@ def get_batch_qty( 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 df01b14d11a6..e9c96084d99d 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 @@ def get_data(report_filters): & (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: