[FIX] fields: copy origin to avoid sharing field objects between registries
Fix a bug introduced in revision f229974
, where shared columns objects are
systematically reintroduced in registries.
This commit is contained in:
parent
2796604b49
commit
30a0814159
|
@ -598,7 +598,9 @@ class Field(object):
|
|||
assert self.store
|
||||
if self._origin:
|
||||
assert isinstance(self._origin, fields._column)
|
||||
return self._origin
|
||||
# some columns are registry-dependent, like float fields (digits);
|
||||
# duplicate them to avoid sharing between registries
|
||||
return copy(self._origin)
|
||||
|
||||
_logger.debug("Create fields._column for Field %s", self)
|
||||
args = {}
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
"""
|
||||
|
||||
import copy
|
||||
import datetime
|
||||
import functools
|
||||
import itertools
|
||||
|
@ -653,12 +652,6 @@ class BaseModel(object):
|
|||
}
|
||||
cls = type(cls._name, (cls,), attrs)
|
||||
|
||||
# float fields are registry-dependent (digit attribute); duplicate them
|
||||
# to avoid issues
|
||||
for key, col in cls._columns.items():
|
||||
if col._type == 'float':
|
||||
cls._columns[key] = copy.copy(col)
|
||||
|
||||
# instantiate the model, and initialize it
|
||||
model = object.__new__(cls)
|
||||
model.__init__(pool, cr)
|
||||
|
|
Loading…
Reference in New Issue