From 33bad6ea60716af5e356716410215a92c0c4eb15 Mon Sep 17 00:00:00 2001 From: axtr Date: Wed, 17 Apr 2024 12:07:58 +0200 Subject: [PATCH] [FIX] pos_self_order_sale: check if the field really exists When the module "sale_product_configurator" is not installed, an AttributeError is raised Steps to reproduce: Install the "point_of_sale" app, the "pos_self_order_sale" module and remove the "sale_product_configurator" module Go to settings -> point of sale -> Self ordering: QR Menu -> preview web interface Cause: The field "optional_product_ids" is provided by the module "sale_product_configurator" which is not a dependency of this module opw-3850421 closes odoo/odoo#161921 Signed-off-by: Joseph Caburnay (jcb) --- addons/pos_self_order_sale/models/product_product.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/pos_self_order_sale/models/product_product.py b/addons/pos_self_order_sale/models/product_product.py index 05654e8d14a..f3b68cbbe9a 100644 --- a/addons/pos_self_order_sale/models/product_product.py +++ b/addons/pos_self_order_sale/models/product_product.py @@ -9,5 +9,8 @@ class ProductProduct(models.Model): def _get_product_for_ui(self, pos_config): self.ensure_one() product = super()._get_product_for_ui(pos_config) - product["optional_product_ids"] = self.optional_product_ids.product_variant_ids.ids + + if "optional_product_ids" in self.env["product.product"]: + product["optional_product_ids"] = self.optional_product_ids.product_variant_ids.ids + return product