Skip to content

Commit

Permalink
Merge pull request #44872 from frappe/mergify/bp/version-15-hotfix/pr…
Browse files Browse the repository at this point in the history
…-44870

fix: posting_time issue (backport #44870)
  • Loading branch information
ruthra-kumar authored Dec 24, 2024
2 parents ddc58f0 + 90aadcd commit 72b7204
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions erpnext/stock/deprecated_serial_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

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

Expand Down Expand Up @@ -112,7 +112,10 @@ def get_sle_for_batches(self):
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)
Expand Down
5 changes: 4 additions & 1 deletion erpnext/stock/serial_batch_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,10 @@ def get_batch_no_ledgers(self) -> list[dict]:
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
)
Expand Down

0 comments on commit 72b7204

Please sign in to comment.