closes odoo/odoo#31520
---
backport of 8e2f9a4fe2
Initially a improvement, it is now backported in 12.0 to fix #34430
closes odoo/odoo#34474
Signed-off-by: Christophe Simonis <chs@odoo.com>
17 lines
548 B
Python
17 lines
548 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import api, models, _
|
|
from odoo.exceptions import UserError
|
|
|
|
|
|
class Lang(models.Model):
|
|
_inherit = "res.lang"
|
|
|
|
@api.multi
|
|
def write(self, vals):
|
|
if 'active' in vals and not vals['active']:
|
|
if self.env['website'].search([('language_ids', 'in', self._ids)]):
|
|
raise UserError(_("Cannot deactivate a language that is currently used on a website."))
|
|
return super(Lang, self).write(vals)
|