Skip to content

Commit

Permalink
fix: NoneType while updating ordered_qty in SO for removed items
Browse files Browse the repository at this point in the history
(cherry picked from commit 442cdd7)
  • Loading branch information
bhaveshkumar.j authored and mergify[bot] committed Nov 8, 2024
1 parent 0cdb4cb commit 1446aa3
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 1446aa3

Please sign in to comment.