Multiwebsite in Sec.Rulesby IT-Projects LLC https://twitter.com/OdooFree , Ildar Nasyrov https://twitter.com/OdooFree
|Lines of code||732|
|License||See License tab|
|Also available in version||v 13.0 v 11.0 v 10.0|
Multiwebsite in Sec.Rules
Make website-dependent access to pages, products, etc.
Tested and maintained by
IT Projects Labs
- Show a blog on specific websites only
- Show an event on specific websites only
- Show a product on specific websites only
Multiwebsite in Sec.Rules
- Install this module in a usual way
- 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 error when trying to configure your product's website_ids field from odoo backend:
The requested operation cannot be completed due to security restrictions. Please contact your system administrator. (Document type: product.template, Operation: read)
from web-interface, or
INFO rw odoo.models: The requested operation cannot be completed due to record rules: Document type: product.template, Operation: read, Records: 47, User: 5
in odoo logs
This is so because in backend rules work in non-website context. In other words the setting is mandatory for website rules.
- 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.