diff options
| author | Laurent Stukkens (LTU) <ltu@odoo.com> | 2020-06-17 14:48:40 +0000 |
|---|---|---|
| committer | Laurent Stukkens (LTU) <ltu@odoo.com> | 2020-08-18 17:40:25 +0000 |
| commit | 0e7640b5f22d2bea04bbe22d3189cff7e03af545 (patch) | |
| tree | b5c388d2bd5ab95239edba0547c44371afda1ff7 /addons/website/controllers/main.py | |
| parent | 8b6985eeed0a15ec673d96299b3ed331c684e62d (diff) | |
[IMP] website, website_sale: add dynamic snippets
* Implement new snippets that allow the user to choose a filter
and a template.
Three snippets have been created:
- Dynamic Snippet: Displays the data in a grid format
- Dynamic Carousel: Displays the date in a carousel
- Dynamic Products: Let the user pick a product category and
displays the products in a carousel
task-2276740
PR #53175
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 | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index d5f242e02f9..82c26ca0344 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -269,6 +269,21 @@ class Website(Home): ] } + @http.route('/website/snippet/filters', type='json', auth='public', website=True) + def get_dynamic_filter(self, filter_id, template_key, limit=None, search_domain=None): + dynamic_filter = request.env['website.snippet.filter'].sudo().search( + [('id', '=', filter_id)] + request.website.website_domain() + ) + return dynamic_filter and dynamic_filter.render(template_key, limit, search_domain) or '' + + @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 + templates = request.env['ir.ui.view'].sudo().search_read( + [['key', 'ilike', '.dynamic_filter_template_'], ['type', '=', 'qweb']], ['key', 'name'] + ) + return templates + # ------------------------------------------------------ # Edit # ------------------------------------------------------ |
