[FIX] orm: As float fields are stateful (the .digit attribute depend of the database (decimal_precision)), registry model instances need their owm copy.
lp bug: https://launchpad.net/bugs/929483 fixed bzr revid: chs@openerp.com-20140116153708-061aq2k0n1qsb2n3
This commit is contained in:
parent
212b6bc480
commit
2f90f80ba0
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue