Optimized product Grocycode handling on consume page (and others / general) (fixes #2571)

This commit is contained in:
Bernd Bestel
2024-08-24 18:20:40 +02:00
parent 1246f402e5
commit d5dacb1053
8 changed files with 43 additions and 9 deletions

26
migrations/0238.sql Normal file
View File

@@ -0,0 +1,26 @@
CREATE VIEW product_barcodes_view
AS
SELECT
pb.id,
pb.product_id,
pb.barcode,
pb.qu_id,
pb.amount,
pb.shopping_location_id,
pb.last_price,
pb.note
FROM product_barcodes pb
UNION ALL
-- Product Grocycodes
SELECT
p.id,
p.id AS product_id,
'grcy:p:' || CAST(p.id AS TEXT) AS barcode,
p.qu_id_stock AS qu_id,
NULL AS amount,
NULL AS shopping_location_id,
NULL AS last_price,
NULL AS note
FROM products p;