Skip to content

Commit

Permalink
Merge pull request #43762 from bhavesh95863/fix-item-update
Browse files Browse the repository at this point in the history
fix: handle NoneType error when updating ordered_qty in SO for remove…
  • Loading branch information
ruthra-kumar authored Nov 8, 2024
2 parents 625ce41 + 442cdd7 commit a978fd1
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 @@ -629,9 +629,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 a978fd1

Please sign in to comment.