mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-19 06:45:11 +00:00
fix: use stock qty instead of qty when updating transferred qty in WO
(cherry picked from commit 8e14249335)
This commit is contained in:
@@ -1543,6 +1543,7 @@ class WorkOrder(Document):
|
|||||||
"operation": item.operation or operation,
|
"operation": item.operation or operation,
|
||||||
"item_code": item.item_code,
|
"item_code": item.item_code,
|
||||||
"item_name": item.item_name,
|
"item_name": item.item_name,
|
||||||
|
"stock_uom": item.stock_uom,
|
||||||
"description": item.description,
|
"description": item.description,
|
||||||
"allow_alternative_item": item.allow_alternative_item,
|
"allow_alternative_item": item.allow_alternative_item,
|
||||||
"required_qty": item.qty,
|
"required_qty": item.qty,
|
||||||
@@ -1580,7 +1581,7 @@ class WorkOrder(Document):
|
|||||||
.select(
|
.select(
|
||||||
ste_child.item_code,
|
ste_child.item_code,
|
||||||
ste_child.original_item,
|
ste_child.original_item,
|
||||||
fn.Sum(ste_child.qty).as_("qty"),
|
fn.Sum(ste_child.transfer_qty).as_("qty"),
|
||||||
)
|
)
|
||||||
.where(
|
.where(
|
||||||
(ste.docstatus == 1)
|
(ste.docstatus == 1)
|
||||||
@@ -1653,7 +1654,7 @@ class WorkOrder(Document):
|
|||||||
.select(
|
.select(
|
||||||
ste_child.item_code,
|
ste_child.item_code,
|
||||||
ste_child.original_item,
|
ste_child.original_item,
|
||||||
fn.Sum(ste_child.qty).as_("qty"),
|
fn.Sum(ste_child.transfer_qty).as_("qty"),
|
||||||
)
|
)
|
||||||
.where(
|
.where(
|
||||||
(ste.docstatus == 1)
|
(ste.docstatus == 1)
|
||||||
@@ -2163,7 +2164,7 @@ def get_consumed_qty(work_order, item_code):
|
|||||||
frappe.qb.from_(stock_entry)
|
frappe.qb.from_(stock_entry)
|
||||||
.inner_join(stock_entry_detail)
|
.inner_join(stock_entry_detail)
|
||||||
.on(stock_entry_detail.parent == stock_entry.name)
|
.on(stock_entry_detail.parent == stock_entry.name)
|
||||||
.select(fn.Sum(stock_entry_detail.qty).as_("qty"))
|
.select(fn.Sum(stock_entry_detail.transfer_qty).as_("qty"))
|
||||||
.where(
|
.where(
|
||||||
(stock_entry.work_order == work_order)
|
(stock_entry.work_order == work_order)
|
||||||
& (stock_entry.purpose.isin(["Manufacture", "Material Consumption for Manufacture"]))
|
& (stock_entry.purpose.isin(["Manufacture", "Material Consumption for Manufacture"]))
|
||||||
|
|||||||
Reference in New Issue
Block a user