diff options
| author | Benoit Socias <bso@odoo.com> | 2020-10-05 12:05:59 +0000 |
|---|---|---|
| committer | Benoit Socias <bso@odoo.com> | 2020-10-13 13:00:21 +0000 |
| commit | 19d82ca5a85c2740aeced9052ace6a6799695b2c (patch) | |
| tree | 8b4010f8c2670aeb23d5b969b262c08788a0c2fc /addons/website/controllers/main.py | |
| parent | 3563738ca5dd97791d5f32d8ffc40d07a8a95386 (diff) | |
[FIX] website: filter filter_opt of dynamic snippet by website_id
Add a filtering by the contextual website_id when looking up available
website_snippet_filters via an rpc route limited to logged in users but
relying on a sudo to actually obtain the list of available filters.
Before this commit filters were visible on the editor for all websites.
After this commit filters are only visible on the editor of the website
that matches their website_id.
https://github.com/odoo/odoo/pull/59341
task-2312878
closes odoo/odoo#59341
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website/controllers/main.py')
| -rw-r--r-- | addons/website/controllers/main.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index e0cab93db9a..8601eb9e03b 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -276,6 +276,13 @@ class Website(Home): ) return dynamic_filter and dynamic_filter.render(template_key, limit, search_domain) or '' + @http.route('/website/snippet/options_filters', type='json', auth='user', website=True) + def get_dynamic_snippet_filters(self): + dynamic_filter = request.env['website.snippet.filter'].sudo().search_read( + request.website.website_domain(), ['id', 'name', 'limit'] + ) + return dynamic_filter + @http.route('/website/snippet/filter_templates', type='json', auth='public', website=True) def get_dynamic_snippet_templates(self, filter_id=False): # todo: if filter_id.model -> filter template |
