diff --git a/addons/pos_self_order/models/product_product.py b/addons/pos_self_order/models/product_product.py index 7bdd490a7a1..fe5a6b043ad 100644 --- a/addons/pos_self_order/models/product_product.py +++ b/addons/pos_self_order/models/product_product.py @@ -97,16 +97,34 @@ class ProductProduct(models.Model): self, qty, currency=pos_config.currency_id ) - price_info = pos_config.default_fiscal_position_id.map_tax(self.taxes_id).compute_all( + # Declare variables, will be the return values. + display_price_default = price + display_price_alternative = price + + taxes_default = pos_config.default_fiscal_position_id.map_tax(self.taxes_id) + taxes_alternative = pos_config.self_ordering_alternative_fp_id.map_tax(self.taxes_id) + + all_prices_default = taxes_default.compute_all( + price, pos_config.currency_id, qty, product=self + ) + all_prices_alternative = taxes_alternative.compute_all( price, pos_config.currency_id, qty, product=self ) - display_price = price_info["total_included"] if pos_config.iface_tax_included == "total" else price_info["total_excluded"] - display_price = self.lst_price if self.combo_ids else display_price + if self.combo_ids: + display_price_default = self.lst_price + display_price_alternative = self.lst_price + else: + if pos_config.iface_tax_included == 'total': + display_price_default = all_prices_default["total_included"] + display_price_alternative = all_prices_alternative["total_included"] + else: + display_price_default = all_prices_default["total_excluded"] + display_price_alternative = all_prices_alternative["total_excluded"] return { - "display_price": display_price, - "lst_price": self.lst_price + 'display_price_default': display_price_default, + 'display_price_alternative': display_price_alternative, } def _get_product_for_ui(self, pos_config): diff --git a/addons/pos_self_order/static/src/app/components/product_card/product_card.xml b/addons/pos_self_order/static/src/app/components/product_card/product_card.xml index 9e540b82f45..6cce6883348 100644 --- a/addons/pos_self_order/static/src/app/components/product_card/product_card.xml +++ b/addons/pos_self_order/static/src/app/components/product_card/product_card.xml @@ -14,7 +14,7 @@
- +
Out of stock
diff --git a/addons/pos_self_order/static/src/app/models/product.js b/addons/pos_self_order/static/src/app/models/product.js index 0fe76657e44..a82f3dd2341 100644 --- a/addons/pos_self_order/static/src/app/models/product.js +++ b/addons/pos_self_order/static/src/app/models/product.js @@ -40,10 +40,6 @@ export class Product extends Reactive { this.showPriceTaxIncluded = showPriceTaxIncluded; } - get prices() { - return this.price_info.display_price; - } - get isCombo() { return this.pos_combo_ids; } diff --git a/addons/pos_self_order/static/src/app/pages/product_page/product_page.xml b/addons/pos_self_order/static/src/app/pages/product_page/product_page.xml index 46c14696636..1c1cf8e6cde 100644 --- a/addons/pos_self_order/static/src/app/pages/product_page/product_page.xml +++ b/addons/pos_self_order/static/src/app/pages/product_page/product_page.xml @@ -16,7 +16,7 @@ class="o_self_order_main_desc flex-grow-1 pb-3 mb-3 bg-view text-muted " t-esc="product.description_sale" /> - +
diff --git a/addons/pos_self_order/static/src/app/self_order_service.js b/addons/pos_self_order/static/src/app/self_order_service.js index 79d2f1704b5..6d9203d3e12 100644 --- a/addons/pos_self_order/static/src/app/self_order_service.js +++ b/addons/pos_self_order/static/src/app/self_order_service.js @@ -434,6 +434,14 @@ export class SelfOrder extends Reactive { return result; } + + getProductDisplayPrice(product) { + if (this.currentOrder.take_away) { + return product.price_info.display_price_alternative; + } else { + return product.price_info.display_price_default; + } + } } export const selfOrderService = {