Skip to content

Commit

Permalink
fix: consider zero valuation rate for serial nos (backport #44532) (#…
Browse files Browse the repository at this point in the history
…44534)

fix: consider zero valuation rate for serial nos (#44532)

(cherry picked from commit 14f2b0a)

Co-authored-by: rohitwaghchaure <[email protected]>
  • Loading branch information
mergify[bot] and rohitwaghchaure authored Dec 5, 2024
1 parent f4aa4c9 commit 3771c6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions erpnext/stock/serial_batch_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def calculate_stock_value_change(self):
serial_nos = self.get_serial_nos()
for serial_no in serial_nos:
incoming_rate = self.get_incoming_rate_from_bundle(serial_no)
if not incoming_rate:
if incoming_rate is None:
continue

self.stock_value_change += incoming_rate
Expand Down Expand Up @@ -553,7 +553,7 @@ def get_incoming_rate_from_bundle(self, serial_no) -> float:
query = query.where(timestamp_condition)

incoming_rate = query.run()
return flt(incoming_rate[0][0]) if incoming_rate else 0.0
return flt(incoming_rate[0][0]) if incoming_rate else None

def get_serial_nos(self):
if self.sle.get("serial_nos"):
Expand Down

0 comments on commit 3771c6e

Please sign in to comment.