Skip to content

Commit

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

fix: handle NoneType error when updating ordered_qty in SO for remove… (backport #43762)
  • Loading branch information
ruthra-kumar authored Nov 8, 2024
2 parents 0cdb4cb + 1446aa3 commit 82cd42b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions erpnext/buying/doctype/purchase_order/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,11 @@ def update_ordered_qty_in_so_for_removed_items(self, removed_items):
if not self.is_against_so():
return
for item in removed_items:
prev_ordered_qty = frappe.get_cached_value(
"Sales Order Item", item.get("sales_order_item"), "ordered_qty"
prev_ordered_qty = (
frappe.get_cached_value("Sales Order Item", item.get("sales_order_item"), "ordered_qty")
or 0.0
)

frappe.db.set_value(
"Sales Order Item", item.get("sales_order_item"), "ordered_qty", prev_ordered_qty - item.qty
)
Expand Down

0 comments on commit 82cd42b

Please sign in to comment.