Merge pull request #44872 from frappe/mergify/bp/version-15-hotfix/pr-44870

fix: posting_time issue (backport #44870)
This commit is contained in:
ruthra kumar
2024-12-24 13:56:10 +05:30
committed by GitHub
2 changed files with 9 additions and 3 deletions

View File

@@ -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
@@ -112,7 +112,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)

View File

@@ -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
)