diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index 654c32c8..cb1a56fb 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -40,6 +40,7 @@ - Fixed that shopping list prints had a grey background (thanks @Forceu) - Fixed the form validation on the shopping list item page (thanks @Forceu) - Fixed that when adding products to the shopping list from the stock overview page, the used quantity unit was always the products default purchase QU (and not the selected one) +- Fixed that the displayed last unit/total price was wrong when the used quantity unit was not the products stock QU ### Recipe improvements/fixes - Recipe printing improvements (thanks @Ape) diff --git a/migrations/0134.sql b/migrations/0134.sql new file mode 100644 index 00000000..663212d6 --- /dev/null +++ b/migrations/0134.sql @@ -0,0 +1,26 @@ +DROP VIEW uihelper_shopping_list; +CREATE VIEW uihelper_shopping_list +AS +SELECT + sl.*, + p.name AS product_name, + plp.price AS last_price_unit, + plp.price * sl.amount AS last_price_total, + st.name AS default_shopping_location_name, + qu.name AS qu_name, + qu.name_plural AS qu_name_plural, + pg.name AS product_group_name, + pbcs.barcodes AS product_barcodes +FROM shopping_list sl +LEFT JOIN products p + ON sl.product_id = p.id +LEFT JOIN products_last_purchased plp + ON sl.product_id = plp.product_id +LEFT JOIN shopping_locations st + ON p.shopping_location_id = st.id +LEFT JOIN quantity_units qu + ON sl.qu_id = qu.id +LEFT JOIN product_groups pg + ON p.product_group_id = pg.id +LEFT JOIN product_barcodes_comma_separated pbcs + ON sl.product_id = pbcs.product_id;