Files
odoo_source/addons/website_slides/models/website.py
T
Florian Charlier 70dbae8a01 [REF] website, *: make _search_get_details extensible
* = test_website, website_blog, website_event, website_forum, website_sale,
website_slides

`_search_get_details` extension in other modules can now be performed with
fewer lines of code by updating a search type-to-model mapping, without the
need for method override.

This will also have the benefit of slightly reducing the call stack length,
avoiding some unnecessary `if` statements and list lookups at runtime.

Task-2957361

closes odoo/odoo#98423

Related: odoo/enterprise#30946
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-01 11:32:25 +02:00

22 lines
812 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, _
from odoo.addons.http_routing.models.ir_http import url_for
from odoo.addons.website.models.website import SEARCH_TYPE_MODELS
SEARCH_TYPE_MODELS['slides'] |= 'slide.channel', 'slide.slide'
SEARCH_TYPE_MODELS['slide_channels_only'] |= 'slide.channel',
SEARCH_TYPE_MODELS['slides_only'] |= 'slide.slide',
class Website(models.Model):
_inherit = "website"
website_slide_google_app_key = fields.Char('Google Doc Key')
def get_suggested_controllers(self):
suggested_controllers = super(Website, self).get_suggested_controllers()
suggested_controllers.append((_('Courses'), url_for('/slides'), 'website_slides'))
return suggested_controllers