[FIX] base_sparse_field: remove pre_init_hook
This commit is contained in:
@@ -2,11 +2,3 @@
|
||||
|
||||
from . import models
|
||||
from . import tests
|
||||
|
||||
def _update_database_schema(cr):
|
||||
# The reflection of fields is done before updating the model's schema,
|
||||
# therefore we first update the schema.
|
||||
cr.execute("""
|
||||
ALTER TABLE ir_model_fields
|
||||
ADD COLUMN serialization_field_id integer REFERENCES ir_model_fields ON DELETE cascade
|
||||
""")
|
||||
|
||||
@@ -14,5 +14,4 @@
|
||||
'data': [
|
||||
'views/views.xml',
|
||||
],
|
||||
'pre_init_hook': '_update_database_schema',
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class IrModelFields(models.Model):
|
||||
|
||||
def _instanciate_attrs(self, field_data, partial):
|
||||
attrs = super(IrModelFields, self)._instanciate_attrs(field_data, partial)
|
||||
if field_data['serialization_field_id']:
|
||||
if field_data.get('serialization_field_id'):
|
||||
serialization_record = self.browse(field_data['serialization_field_id'])
|
||||
attrs['sparse'] = serialization_record.name
|
||||
return attrs
|
||||
|
||||
Reference in New Issue
Block a user