Make the quick consume buttons on the stock overview page configurable per product (closes #613)

This commit is contained in:
Bernd Bestel
2020-11-15 09:57:45 +01:00
parent 17ae7e3d0c
commit 1d1642b464
9 changed files with 54 additions and 14 deletions

View File

@@ -68,6 +68,7 @@ CREATE TABLE products (
parent_product_id INT,
calories INTEGER,
cumulate_min_stock_amount_of_sub_products TINYINT DEFAULT 0,
quick_consume_amount REAL NOT NULL DEFAULT 1,
row_created_timestamp DATETIME DEFAULT (datetime('now', 'localtime'))
);
@@ -88,6 +89,22 @@ BEGIN
) NOTNULL) THEN RAISE(ABORT, "qu_id_stock cannot be changed when the product was once added to stock") END;
END;
CREATE TRIGGER enforce_parent_product_id_null_when_empty_INS AFTER INSERT ON products
BEGIN
UPDATE products
SET parent_product_id = NULL
WHERE id = NEW.id
AND IFNULL(parent_product_id, '') = '';
END;
CREATE TRIGGER enforce_parent_product_id_null_when_empty_UPD AFTER UPDATE ON products
BEGIN
UPDATE products
SET parent_product_id = NULL
WHERE id = NEW.id
AND IFNULL(parent_product_id, '') = '';
END;
DROP VIEW stock_current_location_content;
CREATE VIEW stock_current_location_content
AS