v 10.0 v 11.0 v 12.0 Third Party 24
Required Apps Website Builder (website)
Included Dependencies
Website Switcher in Backend (400 lines of code)
Lines of code 455
Technical Name ir_rule_website
LicenseSee License tab
Websitehttps://it-projects.info/team/iledarn
Also available in version v 13.0 v 11.0 v 12.0
You bought this module and need support? Click here!

Multi-website support in Security Rules

Make website-dependent access to pages, products, etc.

Technical module that allows implementing different features. For example:
  • Show a blog on specific websites only
  • Show an event on specific websites only
  • Show a product on specific websites only

Need our service?

Contact us by email or fill out request form

Tested on Odoo
10.0 community

Multi-website support in Security Rules

Installation

  • Install this module in a usual way

Configuration

  • There is a new setting in each rule now - it is relevant only for website rules with special website_id parameter in them
  • As usual open [[ Settings ]] >> Technical >> Security >> Record Rules to create a new rule or edit existing one
  • You should see on rule form a new group named Multi-website extension with the Backend behaviour setting in it
  • Leave this field empty if your rule has nothing to do with websites
  • Select Grant access if you want to give access to model from backend, or Deny access - if you want to restrict
  • Note: if you leave this fields empty for a rule that is using website_id parameter - you may have this kind of exception when trying to access data from odoo backend:
ProgrammingError: syntax error at or near ")"
...duct_template_website_rel" WHERE "website_id" IN ()))

This is so because in backend rules work in non-website context. In other words the setting is mandatory for website rules.

Usage

  • If you have a model accessible through a website (by means of controller methods) - specify this module into the "depends" section of your manifest file
  • Now you can create security rules using website_id in domain_force fields. For example,
<?xml version="1.0" encoding="utf-8"?>
<odoo>
  <record id="blog_rule_all" model="ir.rule">
    <field name="name">Blogs available only for specifed websites</field>
    <field name="model_id" ref="model_blog_blog"/>
    <field name="domain_force">[('website_ids', 'in', [website_id])]</field>
    <field name="backend_behaviour">true</field>
  </record>
</odoo>
The MIT License (MIT)

Copyright 2020 IT-Projects Labs
Copyright 2015-2020 IT-Projects LLC
Copyright 2014-2015 Ivan Yelizariev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.