Quantity Relocated moves eliminated
This commit is contained in:
parent
b05015b7c8
commit
13cc147243
|
|
@ -45,8 +45,8 @@ class SamashtiDashboard(models.AbstractModel):
|
||||||
|
|
||||||
-- Opening Stock: includes inventory adjustments before fromDate
|
-- Opening Stock: includes inventory adjustments before fromDate
|
||||||
COALESCE(SUM(CASE
|
COALESCE(SUM(CASE
|
||||||
WHEN sm.date < {fromDate} AND sl_dest.usage = 'internal' THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
WHEN sm.date < {fromDate} AND sl_dest.usage = 'internal' AND sl_src.usage != 'internal' THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
||||||
WHEN sm.date < {fromDate} AND sl_src.usage = 'internal' THEN -sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
WHEN sm.date < {fromDate} AND sl_src.usage = 'internal' AND sl_dest.usage != 'internal' THEN -sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
||||||
WHEN sm.date < {fromDate} AND (sl_src.usage = 'inventory' OR sl_dest.usage = 'inventory') THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
WHEN sm.date < {fromDate} AND (sl_src.usage = 'inventory' OR sl_dest.usage = 'inventory') THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END), 0) AS opening_stock,
|
END), 0) AS opening_stock,
|
||||||
|
|
@ -86,8 +86,8 @@ class SamashtiDashboard(models.AbstractModel):
|
||||||
-- Closing Stock = Opening + Receipts + Production - Consumption - Dispatch + Inventory adjustments
|
-- Closing Stock = Opening + Receipts + Production - Consumption - Dispatch + Inventory adjustments
|
||||||
(
|
(
|
||||||
COALESCE(SUM(CASE
|
COALESCE(SUM(CASE
|
||||||
WHEN sm.date < {fromDate} AND sl_dest.usage = 'internal' THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
WHEN sm.date < {fromDate} AND sl_dest.usage = 'internal' AND sl_src.usage != 'internal' THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
||||||
WHEN sm.date < {fromDate} AND sl_src.usage = 'internal' THEN -sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
WHEN sm.date < {fromDate} AND sl_src.usage = 'internal' AND sl_dest.usage != 'internal' THEN -sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
||||||
WHEN sm.date < {fromDate} AND (sl_src.usage = 'inventory' OR sl_dest.usage = 'inventory') THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
WHEN sm.date < {fromDate} AND (sl_src.usage = 'inventory' OR sl_dest.usage = 'inventory') THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
||||||
WHEN sm.date BETWEEN {fromDate} AND {toDate} AND sl_dest.usage = 'internal' AND sl_src.usage IN ('supplier', 'production') THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
WHEN sm.date BETWEEN {fromDate} AND {toDate} AND sl_dest.usage = 'internal' AND sl_src.usage IN ('supplier', 'production') THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
||||||
WHEN sm.date BETWEEN {fromDate} AND {toDate} AND (sl_src.usage = 'inventory' OR sl_dest.usage = 'inventory') THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
WHEN sm.date BETWEEN {fromDate} AND {toDate} AND (sl_src.usage = 'inventory' OR sl_dest.usage = 'inventory') THEN sm.product_uom_qty * (uom.factor /sm_uom.factor)
|
||||||
|
|
@ -117,7 +117,7 @@ class SamashtiDashboard(models.AbstractModel):
|
||||||
WHERE
|
WHERE
|
||||||
sl_src.usage IN ('internal', 'supplier', 'production', 'customer', 'inventory') AND
|
sl_src.usage IN ('internal', 'supplier', 'production', 'customer', 'inventory') AND
|
||||||
sl_dest.usage IN ('internal', 'supplier', 'production', 'customer', 'inventory') AND
|
sl_dest.usage IN ('internal', 'supplier', 'production', 'customer', 'inventory') AND
|
||||||
sm.state = 'done' AND sm.name != 'Quantity Relocated' AND
|
sm.state = 'done' AND
|
||||||
pt.type = 'consu' AND pp.default_code is not null
|
pt.type = 'consu' AND pp.default_code is not null
|
||||||
|
|
||||||
GROUP BY
|
GROUP BY
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue