Skip to content

Commit

Permalink
fix: posting_time issue (#44870)
Browse files Browse the repository at this point in the history
(cherry picked from commit 079b860)

# Conflicts:
#	erpnext/stock/deprecated_serial_batch.py
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed Dec 24, 2024
1 parent f0671d4 commit 7a5c30f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion erpnext/stock/deprecated_serial_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

import frappe
from frappe.query_builder.functions import CombineDatetime, Sum
<<<<<<< HEAD
from frappe.utils import flt
from frappe.utils.deprecations import deprecated
=======
from frappe.utils import flt, nowtime
>>>>>>> 079b86044e (fix: posting_time issue (#44870))
from pypika import Order


Expand Down Expand Up @@ -112,7 +116,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 7a5c30f

Please sign in to comment.