mirror of
https://github.com/grocy/grocy.git
synced 2025-08-07 23:09:48 +00:00
Also convert prices when changing a products stock QU (references #1326)
This commit is contained in:
parent
a5ff947936
commit
7ad979cba9
@ -46,10 +46,12 @@ BEGIN
|
|||||||
AND product_id IS NOT NULL;
|
AND product_id IS NOT NULL;
|
||||||
|
|
||||||
UPDATE stock
|
UPDATE stock
|
||||||
SET amount = amount * IFNULL((SELECT factor FROM quantity_unit_conversions_resolved WHERE product_id = NEW.id AND from_qu_id = OLD.qu_id_stock AND to_qu_id = NEW.qu_id_stock AND source NOT LIKE '1%'), 1.0)
|
SET amount = amount * IFNULL((SELECT factor FROM quantity_unit_conversions_resolved WHERE product_id = NEW.id AND from_qu_id = OLD.qu_id_stock AND to_qu_id = NEW.qu_id_stock AND source NOT LIKE '1%'), 1.0),
|
||||||
|
price = price / IFNULL((SELECT factor FROM quantity_unit_conversions_resolved WHERE product_id = NEW.id AND from_qu_id = OLD.qu_id_stock AND to_qu_id = NEW.qu_id_stock AND source NOT LIKE '1%'), 1.0)
|
||||||
WHERE product_id = NEW.id;
|
WHERE product_id = NEW.id;
|
||||||
|
|
||||||
UPDATE stock_log
|
UPDATE stock_log
|
||||||
SET amount = amount * IFNULL((SELECT factor FROM quantity_unit_conversions_resolved WHERE product_id = NEW.id AND from_qu_id = OLD.qu_id_stock AND to_qu_id = NEW.qu_id_stock AND source NOT LIKE '1%'), 1.0)
|
SET amount = amount * IFNULL((SELECT factor FROM quantity_unit_conversions_resolved WHERE product_id = NEW.id AND from_qu_id = OLD.qu_id_stock AND to_qu_id = NEW.qu_id_stock AND source NOT LIKE '1%'), 1.0),
|
||||||
|
price = price / IFNULL((SELECT factor FROM quantity_unit_conversions_resolved WHERE product_id = NEW.id AND from_qu_id = OLD.qu_id_stock AND to_qu_id = NEW.qu_id_stock AND source NOT LIKE '1%'), 1.0)
|
||||||
WHERE product_id = NEW.id;
|
WHERE product_id = NEW.id;
|
||||||
END;
|
END;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user