Created
June 25, 2019 02:06
-
-
Save ovnicraft/fc30f885f45687e6be6927f801562243 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select sum(product_qty) filter (spt.code = 'incoming') as incoming, product_id, sloc.name, sm.location_id, picking_type_id, spt.code | |
from stock_move sm | |
inner join stock_picking_type spt on sm.picking_type_id = spt.id | |
left join stock_location sloc on sm.location_id = sloc.id | |
left join stock_location slocd on sm.location_dest_id = slocd.id | |
where sm.state = 'done' | |
and inventory_id is null | |
group by product_id, sloc.name, sm.location_id, picking_type_id, spt.code; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment