fix: wrong qty of remaining work orders to be created when using "Create" > "Work Order" (#34726)
fix: wrong qty of remaining work orders to be created when using "Create" > "Work Order" (#34726)
* fix: convert asynchronous field update to synchronous
* fix: wrong qty of remaining work orders to be created when using "Create" > "Work Order"
(cherry picked from commit 189b020d228bdb1c0c589697162cf91718b2fa27)
Co-authored-by: danjeremynavarro <46537526+danjeremynavarro@users.noreply.github.com>
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index ee9161b..d995517 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -1340,8 +1340,9 @@
.select(Sum(wo.qty))
.where(
(wo.production_item == i.item_code)
- & (wo.sales_order == so.name) * (wo.sales_order_item == i.name)
- & (wo.docstatus.lte(2))
+ & (wo.sales_order == so.name)
+ & (wo.sales_order_item == i.name)
+ & (wo.docstatus.lt(2))
)
.run()[0][0]
)