Allow different locations per product in stock (closes #124)

Kind of basic for now, a different location can be set on purchase, the filters on the stock overview page handles different locations
This commit is contained in:
Bernd Bestel
2019-03-01 20:25:01 +01:00
parent 32e878afc9
commit b89643ddb1
8 changed files with 63 additions and 10 deletions

15
migrations/0051.sql Normal file
View File

@@ -0,0 +1,15 @@
ALTER TABLE stock
ADD location_id INTEGER;
ALTER TABLE stock_log
ADD location_id INTEGER;
CREATE VIEW stock_current_locations
AS
SELECT
s.product_id,
IFNULL(s.location_id, p.location_id) AS location_id
FROM stock s
JOIN products p
ON s.product_id = p.id
GROUP BY s.product_id, IFNULL(s.location_id, p.location_id);