Skip to content

Commit

Permalink
fix: Negative value in Reserved Qty for Production Plan
Browse files Browse the repository at this point in the history
(cherry picked from commit a37608a)
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed May 24, 2023
1 parent 1fe22f0 commit 6fe42c9
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ def get_reserved_qty_for_production_plan(item_code, warehouse):
frappe.qb.from_(table)
.inner_join(child)
.on(table.name == child.parent)
.select(Sum(child.quantity * IfNull(child.conversion_factor, 1.0)))
.select(Sum(child.required_bom_qty * IfNull(child.conversion_factor, 1.0)))
.where(
(table.docstatus == 1)
& (child.item_code == item_code)
Expand All @@ -1552,6 +1552,9 @@ def get_reserved_qty_for_production_plan(item_code, warehouse):
get_reserved_qty_for_production(item_code, warehouse, check_production_plan=True)
)

if reserved_qty_for_production > reserved_qty_for_production_plan:
return 0.0

return reserved_qty_for_production_plan - reserved_qty_for_production


Expand Down

0 comments on commit 6fe42c9

Please sign in to comment.