diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 90428dfa21d..e7121bb4635 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -896,11 +896,6 @@ class BaseModel(object): for c in new.keys(): if new[c].manual: del new[c] - # Duplicate float fields because they have a .digits - # cache (which must be per-registry, not server-wide). - for c in new.keys(): - if new[c]._type == 'float': - new[c] = copy.copy(new[c]) if hasattr(new, 'update'): new.update(cls.__dict__.get(s, {})) elif s=='_constraints': @@ -936,6 +931,13 @@ class BaseModel(object): if not getattr(cls, '_original_module', None): cls._original_module = cls._module obj = object.__new__(cls) + + if hasattr(obj, '_columns'): + # float fields are registry-dependent (digit attribute). Duplicate them to avoid issues. + for c, f in obj._columns.items(): + if f._type == 'float': + obj._columns[c] = copy.copy(f) + obj.__init__(pool, cr) return obj