mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Show amount of opened products on stock overview page and in product card
This commit is contained in:
@@ -15,3 +15,14 @@ ADD default_best_before_days_after_open INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
UPDATE products
|
||||
SET default_best_before_days_after_open = 0;
|
||||
|
||||
DROP VIEW stock_current;
|
||||
CREATE VIEW stock_current
|
||||
AS
|
||||
SELECT
|
||||
s.product_id,
|
||||
SUM(s.amount) AS amount,
|
||||
MIN(s.best_before_date) AS best_before_date,
|
||||
IFNULL((SELECT SUM(amount) FROM stock WHERE product_id = s.product_id AND open = 1), 0) AS amount_opened
|
||||
FROM stock s
|
||||
GROUP BY s.product_id;
|
||||
|
Reference in New Issue
Block a user