Files
odoo_source/addons/website/wizard/base_language_install.py
T
99b50d18e2 [REF] test_website, *: adapt tours to new client action
*: website, website_blog, website_crm, website_event, website_forum,
   website_hr_recruitment, website_mass_mailing, website_sale,
   website_sale_loyalty, website_slides

This commit adds the current website displayed view xmlid outside of the
iframe, on its container, so that the tours registered with
registerThemeHomepageTour can continue to prepend their triggers with
the view xml id.

Introduce registerEditionTour: this function will allow tour maker to
more easily register a tour that needs to start in the iframe's backend
and go in edit mode.

See merge commit for more information.

task-2687506

Co-authored-by: Benjamin Vray <bvr@odoo.com>
Co-authored-by: Younn Olivier <yol@odoo.com>
2022-06-24 10:28:07 +02:00

36 lines
1.2 KiB
Python

# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class BaseLanguageInstall(models.TransientModel):
_inherit = "base.language.install"
website_ids = fields.Many2many('website', string='Websites to translate')
@api.model
def default_get(self, fields):
defaults = super(BaseLanguageInstall, self).default_get(fields)
website_id = self._context.get('params', {}).get('website_id')
if website_id:
if 'website_ids' not in defaults:
defaults['website_ids'] = []
defaults['website_ids'].append(website_id)
return defaults
def lang_install(self):
action = super(BaseLanguageInstall, self).lang_install()
if self.website_ids and self.lang_ids:
self.website_ids.language_ids |= self.lang_ids
params = self._context.get('params', {})
if 'url_return' in params:
url = params['url_return'].replace('[lang]', self.first_lang_id.code)
return {
'url': self.env['website'].get_client_action_url(url),
'type': 'ir.actions.act_url',
'target': 'self'
}
return action