From 4a8c48b4b1d2a310d778af655c13265951d2037d Mon Sep 17 00:00:00 2001 From: sebastien beau Date: Fri, 23 Sep 2011 13:26:18 +0200 Subject: [PATCH] [FIX] fix bug when updating a field. The support of renaming a field or changing the storing system will be done later, I not sure that I will have the time to implement it for 6.1. At least I will propose a new merge for 6.2 bzr revid: sebastien.beau@akretion.com.br-20110923112618-vq44f15cpcvxozxi --- openerp/addons/base/ir/ir_model.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index bbd021e237a..96e7a647372 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -295,11 +295,12 @@ class ir_model_fields(osv.osv): if context and context.get('manual',False): vals['state'] = 'manual' - if vals['serialization_field_id'] or vals['name']: + #For the moment renaming a sparse field or changing the storing system is not allowed. This will be done later + if 'serialization_field_id' in vals or 'name' in vals: for field in self.browse(cr, user, ids, context=context): - if field.serialization_field_id and field.serialization_field_id.id != vals['serialization_field_id'] or (not field.serialization_field_id and vals['serialization_field_id']): + if 'serialization_field_id' in vals and field.serialization_field_id.id != vals['serialization_field_id']: raise except_orm(_('Error!'), _('Changing the storing system for the field "%s" is not allowed.'%field.name)) - elif field.serialization_field_id and (field.name != vals['name']): + if field.serialization_field_id and (field.name != vals['name']): raise except_orm(_('Error!'), _('Renaming the sparse field "%s" is not allowed'%field.name)) column_rename = None # if set, *one* column can be renamed here