[FIX] base: allow write() on ir.model as long as values are not changed

This should enable the re-import of model exported to XML.
This commit is contained in:
Raphael Collet
2016-11-07 10:25:50 +01:00
committed by Aaron Bohy
parent 3555625990
commit 530909405d
+3 -3
View File
@@ -152,11 +152,11 @@ class IrModel(models.Model):
def write(self, vals):
if '__last_update' in self._context:
self = self.with_context({k: v for k, v in self._context.iteritems() if k != '__last_update'})
if 'model' in vals:
if 'model' in vals and any(rec.model != vals['model'] for rec in self):
raise UserError(_('Field "Model" cannot be modified on models.'))
if 'state' in vals:
if 'state' in vals and any(rec.state != vals['state'] for rec in self):
raise UserError(_('Field "Type" cannot be modified on models.'))
if 'transient' in vals:
if 'transient' in vals and any(rec.transient != vals['transient'] for rec in self):
raise UserError(_('Field "Transient Model" cannot be modified on models.'))
# Filter out operations 4 from field id, because the web client always
# writes (4,id,False) even for non dirty items.