For now I solved this by making two websites with shops. But I still hope someone comes up with an answer on how to do it properly. I still can't believe that it isn't posible to show the logged in users their own price on their pricelist on the webshop. This should be very easy in my opinion.
This is how I did it for now.
The products are showing on both the shops. The b2c shop uses the b2c pricelist and the b2b-shop the b2b pricelist.
I made a module that allows only logged in users on the B2B shop. So if a user switches to the b2b-site they automatically get redirected to the login page for every page of the webshop they try to access.
redirecting non-logged in users to the loginpage can be don by inheriting the controller of the webshop eg:
@http.route()
def shop(self, page=0, category=None, search='', min_price=0.0, max_price=0.0, ppg=False, **post):
"""
check if website requires login for users to see the shop.
If so, check if user is logged in.
If not, rederect to login page.
"""
if request.env['website'].get_current_website().need_login:
if request.env.user.id == request.env.ref('base.public_user').id:
return request.render('web.login', {})
return super(WebsiteSaleNeedLogin,self).shop(page, category, search, min_price, max_price, ppg, **post)
Where need_login is a setting I added on the website-settings page. There you can set this website specific.
If you have multiple databases running on one server you do need to adjust your dbfilter for this. You can find a way to do this in this message: https://www.odoo.com/nl_NL/forum/help-1/how-to-configure-dbfilter-for-multi-website-environnement-204368