fix: consider stock_qty
if picked_qty
is zero
This commit is contained in:
parent
57c8871de0
commit
6ffdeb1af8
@ -346,14 +346,16 @@ class PickList(Document):
|
|||||||
pi_item.item_code,
|
pi_item.item_code,
|
||||||
pi_item.warehouse,
|
pi_item.warehouse,
|
||||||
pi_item.batch_no,
|
pi_item.batch_no,
|
||||||
Sum(pi_item.picked_qty).as_("picked_qty"),
|
Sum(Case().when(pi_item.picked_qty > 0, pi_item.picked_qty).else_(pi_item.stock_qty)).as_(
|
||||||
|
"picked_qty"
|
||||||
|
),
|
||||||
Replace(GROUP_CONCAT(pi_item.serial_no), ",", "\n").as_("serial_no"),
|
Replace(GROUP_CONCAT(pi_item.serial_no), ",", "\n").as_("serial_no"),
|
||||||
)
|
)
|
||||||
.where(
|
.where(
|
||||||
(pi_item.item_code.isin([x.item_code for x in items]))
|
(pi_item.item_code.isin([x.item_code for x in items]))
|
||||||
& (pi_item.docstatus != 2)
|
& ((pi_item.picked_qty > 0) | (pi_item.stock_qty > 0))
|
||||||
& (pi_item.picked_qty > 0)
|
|
||||||
& (pi.status != "Completed")
|
& (pi.status != "Completed")
|
||||||
|
& (pi_item.docstatus != 2)
|
||||||
)
|
)
|
||||||
.groupby(
|
.groupby(
|
||||||
pi_item.item_code,
|
pi_item.item_code,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user