Set up env & tools for module website multiwebsite (blog, event, sale..)
website_id in modelConverter and ir_rule
add _compute_domain_keys to have a different cache per website
or rules would not be correctly website_dependant
eg: blog 1 on website 1, blog 2 on website 2
access blog 1 from website 1 => can access -> normal
access blog 1 from website 2 => can access -> should crash because (ir rule)
split mixing website.published.mixin and website.published.multi.mixin to have
website_id only on last one.
multi mixing will:
- override website_published compute to take current_website into account (not in backend)
- force website when clicking on published in backend
- website blog, website_sale, website_event, website_forum, website_slides are now multi website
Co-authored-by: Derie Romain <rde@odoo.com>
Co-authored-by: Kersten Jérémy <jke@odoo.com>
17 lines
487 B
Python
17 lines
487 B
Python
# coding: utf-8
|
|
from odoo import api, models
|
|
|
|
|
|
class IrRule(models.Model):
|
|
_inherit = 'ir.rule'
|
|
|
|
@api.model
|
|
def _eval_context(self):
|
|
res = super(IrRule, self)._eval_context()
|
|
res['website_id'] = self.env['website'].get_current_website().id
|
|
return res
|
|
|
|
def _compute_domain_keys(self):
|
|
""" Return the list of context keys to use for caching ``_compute_domain``. """
|
|
return super(IrRule, self)._compute_domain_keys() + ['website_id']
|