From 079b86044efce7bf04c94900cdde6b1119c53fb2 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 24 Dec 2024 09:06:37 +0530 Subject: [PATCH] fix: posting_time issue (#44870) --- erpnext/stock/deprecated_serial_batch.py | 7 +++++-- erpnext/stock/serial_batch_bundle.py | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/deprecated_serial_batch.py b/erpnext/stock/deprecated_serial_batch.py index de31867fbd9..45a9acac3f7 100644 --- a/erpnext/stock/deprecated_serial_batch.py +++ b/erpnext/stock/deprecated_serial_batch.py @@ -3,7 +3,7 @@ from collections import defaultdict import frappe from frappe.query_builder.functions import CombineDatetime, Sum -from frappe.utils import flt +from frappe.utils import flt, nowtime from pypika import Order from erpnext.deprecation_dumpster import deprecated @@ -131,7 +131,10 @@ class DeprecatedBatchNoValuation: sle = frappe.qb.DocType("Stock Ledger Entry") timestamp_condition = None - if self.sle.posting_date and self.sle.posting_time: + if self.sle.posting_date: + if self.sle.posting_time is None: + self.sle.posting_time = nowtime() + posting_datetime = get_combine_datetime(self.sle.posting_date, self.sle.posting_time) if not self.sle.creation: posting_datetime = posting_datetime + datetime.timedelta(milliseconds=1) diff --git a/erpnext/stock/serial_batch_bundle.py b/erpnext/stock/serial_batch_bundle.py index 732a14c2fb5..c450bf1a086 100644 --- a/erpnext/stock/serial_batch_bundle.py +++ b/erpnext/stock/serial_batch_bundle.py @@ -643,7 +643,10 @@ class BatchNoValuation(DeprecatedBatchNoValuation): child = frappe.qb.DocType("Serial and Batch Entry") timestamp_condition = "" - if self.sle.posting_date and self.sle.posting_time: + if self.sle.posting_date: + if self.sle.posting_time is None: + self.sle.posting_time = nowtime() + timestamp_condition = CombineDatetime(parent.posting_date, parent.posting_time) < CombineDatetime( self.sle.posting_date, self.sle.posting_time )