Multi is the default api for methods, it is not necessary to explicitly decorate methods with it, adds clutter and most people use it because they see that the rest of the code uses it. Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
16 lines
533 B
Python
16 lines
533 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"
|
|
|
|
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)
|