[IMP] Multi-Website improve if condtion for write

This commit is contained in:
Siddharth Bhalgami 2017-12-28 11:13:03 +05:30
parent 0f6b09790c
commit bf476cdcd1

View File

@ -102,7 +102,9 @@ class Website(models.Model):
@api.multi
def write(self, values):
self._get_languages.clear_cache(self)
if values.get('website_code') or values.get('is_default_website'):
if values.get('website_code') or \
(values.get('is_default_website')
and self != self.env.ref('website.default_website')):
raise Warning(_('Unexpected bad things will happen!\n'
'Changing website code or default website '
'can have unintended side effects.\n'