From cd6c8986436ab5d0b23f861de75495d90ad7ac51 Mon Sep 17 00:00:00 2001
From: rde <rde@odoo.com>
Date: Mon, 9 Oct 2017 13:27:11 +0200
Subject: [PATCH] [FIX] website_sale_options: public user can't add item to
 cart

Before this commit, clicking on add to cart as a public user* would throw an
error because it would access uom.name on which public user has no right.
*From the product page (/shop/product/xxx) having an optional product, the
access error is really on the optional product.

Now, we allow user to read name with sudo().
---
 .../views/website_sale_options_templates.xml                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/website_sale_options/views/website_sale_options_templates.xml b/addons/website_sale_options/views/website_sale_options_templates.xml
index 4f0cc1cf1bc0..e19b68951565 100644
--- a/addons/website_sale_options/views/website_sale_options_templates.xml
+++ b/addons/website_sale_options/views/website_sale_options_templates.xml
@@ -121,7 +121,7 @@
                     <input type="hidden" class="js_optional_same_quantity" t-attf-name="optional-add-#{product_index}" value="0"/>
                     <a href="#" class="js_add btn btn-sm btn-info"><strong>Add<span class='hidden-xs'> to Cart</span></strong></a>
                     <span class="js_remove hidden">
-                      <span class="js_item">1 </span><span class="js_items hidden">5 </span> <span t-field="product.uom_id.name"/><br/>
+                      <span class="js_item">1 </span><span class="js_items hidden">5 </span> <span t-field="product.uom_id.sudo().name"/><br/>
                       <a href="#" class="js_remove btn btn-xs btn-info"><small>Remove <span class='hidden-xs'> from Cart</span></small></a>
                     </span>
                   </div>
-- 
GitLab