[FIX] website: Add onchange language_ids on website model

On res.config.settings for website, when removing a language from language_ids, if this language is defined as default_lang_id, the default language will be updated by an onchange to prevent any inconsistency.
The same should happen when doing this directly on the form view of a website record.

closes odoo/odoo#27727
This commit is contained in:
Akim Juillerat
2018-10-19 13:58:42 +00:00
parent 9e5126d22f
commit b4ca8d0bc6
+5
View File
@@ -72,6 +72,11 @@ class Website(models.Model):
homepage_id = fields.Many2one('website.page', string='Homepage')
favicon = fields.Binary(string="Website Favicon", help="This field holds the image used to display a favicon on the website.")
@api.onchange('language_ids')
def _onchange_language_ids(self):
if self.language_ids and self.default_lang_id not in self.language_ids:
self.default_lang_id = self.language_ids[0]
@api.multi
def _compute_menu(self):
Menu = self.env['website.menu']