diff --git a/erpnext/stock/deprecated_serial_batch.py b/erpnext/stock/deprecated_serial_batch.py index 08ac3eea91f013504cecc7c18e1d0a285e668455..7d08639c268d797519f100c2394a9b2a290bd156 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 frappe.utils.deprecations import deprecated from pypika import Order @@ -110,7 +110,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 f829419355da72e3ba46a0ae436d09c14c2037db..11e45c9922ecec3f8e8fe734e00a9784807f0d10 100644 --- a/erpnext/stock/serial_batch_bundle.py +++ b/erpnext/stock/serial_batch_bundle.py @@ -657,7 +657,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 )