[FIX] models: copy_data call in new API.
Context are frozendict in the new API. Therefore, they cannot be altered. Any attempt to alter a frozendict will lead to a crash. Fixes #7362
This commit is contained in:
parent
67b1be7f57
commit
1658bee8d4
|
@ -4718,8 +4718,10 @@ class BaseModel(object):
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
# avoid recursion through already copied records in case of circular relationship
|
# avoid recursion through already copied records in case of circular relationship
|
||||||
seen_map = context.setdefault('__copy_data_seen', {})
|
if '__copy_data_seen' not in context:
|
||||||
if id in seen_map.setdefault(self._name, []):
|
context = dict(context, __copy_data_seen=defaultdict(list))
|
||||||
|
seen_map = context['__copy_data_seen']
|
||||||
|
if id in seen_map[self._name]:
|
||||||
return
|
return
|
||||||
seen_map[self._name].append(id)
|
seen_map[self._name].append(id)
|
||||||
|
|
||||||
|
@ -4789,8 +4791,10 @@ class BaseModel(object):
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
# avoid recursion through already copied records in case of circular relationship
|
# avoid recursion through already copied records in case of circular relationship
|
||||||
seen_map = context.setdefault('__copy_translations_seen',{})
|
if '__copy_data_seen' not in context:
|
||||||
if old_id in seen_map.setdefault(self._name,[]):
|
context = dict(context, __copy_data_seen=defaultdict(list))
|
||||||
|
seen_map = context['__copy_data_seen']
|
||||||
|
if old_id in seen_map[self._name]:
|
||||||
return
|
return
|
||||||
seen_map[self._name].append(old_id)
|
seen_map[self._name].append(old_id)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue