Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to restrict the access to the eCommerce menu?

Frédéric Gilson (fgi)
on 4/30/14, 10:28 AM 9,231 views

I would like to set up a B2B platform on my stunning OpenERP website. To achieve this, I need to hide the Shop menu and the ecommerce content (product pages, etc) for all the anonymous website viewers. How can I do this?

  1. How to hide the "Shop" menu item? Go to Settings > Technical > Security > Record rules and create a new rule:

    • Object: Website Menu
    • Apply for Read access
    • Rule definition: [('url','not like','%/shop%')]
    • Group: Public
  2. How to make the eCommerce pages unreachable for people who are not registered as employees or portal users?

    • Open your shop and access the page HTML editor
    • Select the Product page
    • Add the following attribute in the first <t> tag (name="Products"): groups="base.group_user,base.group_portal"

Now you can open your website as an anonymous person. You do not retrieve the Shop menu and if you try to reach yourdatabasename/shop, you get an empty page.

Hi Frédéric, Thanks for your post. Could this be applied in a similar manner to the following elements on the frontend: Add to Cart Shopping Cart (in header) Sales Price Quantity (ie. - +) And items in the navigation menu that are only meant for wholesale clients. I asked a similar question here (https://www.odoo.com/forum/Help-1/question/How-To-Remove-Pricing-For-Not-Logged-In-Users-on-E-commerceWebsite-for-Distributor-Business-to-Business-Sales-52924), but still do not fully understand how the Qweb markup works. I'm looking to implement something similar to Denise. Product catalog (no prices or ecommerce functionality) for the casual visitor, while allowing our distributors to sign in and place orders using the shopping cart and changing the button add to cart to add to quote. I've found a module that seems to be under development for v8 here also: https://github.com/maxmumford/website_b2b i'll post back here with what I find in regards to how it is implemented.

Luke Branch
on 7/11/14, 9:40 PM
Adam Moonen
On 9/9/15, 7:43 PM

Frédéric Gilson (fgi)   - Brilliant Answer, works every time.

Jonathan Hurtado
On 6/17/15, 4:25 PM


I followed the steps, and the user is no longer able to access to mysite.com/shop.

but... the public user can still access to my shop store via google (in google I see all the items that I have on the shop) and access to "add to cart" button.

To avoid this issue:

You need to install the "Warning Messages and Alerts" module; then you need to go to Sales -> Customers -> "Public User" -> Warnings -> Warning on the Sales Order -> Blocking Message.


Andrés Méndez
On 3/10/15, 6:54 PM

Hello Frédéric.

I have followed your steps, but I don't find "Rule definition" to enter that piece of code, instead I can see "Domain".

Do I have to enter it in the "Domain" field?



@Luke as I cannot add a new comment or answer I'll answer to you by editing my previous answer. As far as I understand from you my wish cannot be accomplished in the SAAS version so I will not start a new post for now. In case I plan to install on VPS instead I might get back to you. Thx for your help so far.



I would like to use the webshop as a catalogue only to users who are not logged in showing public price. However only invited users (retailers) are allowed to logon and able to order at the (wholesale) pricelist assigned to them.

Therefore I'm looking for a way to only remove the "add to cart" button from the product overview and product page. Tried looking for a submit tag in the html where I could put groups="base.group_user,base.group_portal to see if this would only hide the cart button but couldn't find a spot to put it.

Anybody any suggestions?

Best regards,



@Denis, I suggest you take a look at this post: https://www.odoo.com/forum/Help-1/question/How-To-Remove-Pricing-For-Not-Logged-In-Users-on-E-commerceWebsite-for-Distributor-Business-to-Business-Sales-52924 I've used the attribute/value t-if="not user_id.partner_id.name == 'Public user'" for hiding XHTML tags from the casual (ie. public user), although i think this could be modified to only show the cart button for portal users as well. Either way i'd recommend inheriting the add to cart code from website_sale.product and then modify it to suit your needs. Here's what I did: <xpath expr="//a[@id='add_to_cart']" position="replace"> &nbsp;&nbsp;&nbsp;Add to Quotation If you're on a local install you'd just need to create a very basic module to use this view. I'll be creating a module for this type of B2B functionality for the website/frontend soon, however if you need any tips on how to implement this as a custom module in the meantime please feel free to comment back and i'll walk you through it.

Luke Branch
on 11/19/14, 12:15 AM

@Denise, It seems that the comments are treating my code snippet as actual HTML instead of escaping it. Please create a new question thread in the forum with your question above and I will create an answer for it so as to conform with the guidelines of the forum properly.

Luke Branch
on 11/19/14, 12:17 AM

@Luke, no worries as I could still understand the post above. However I'm not on a local install and exploring ODOO SAAS for a couple of years now as I feel an easy to implement solution would be the way to go forward. ODOO 9 seems another great improvement again.

Denise van der Linden-Morris
on 8/17/15, 8:56 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

10 follower(s)


Asked: 4/30/14, 10:28 AM
Seen: 9231 times
Last updated: 3/1/16, 4:00 PM