Share record's _ids when saving new records

Closes #12657
This commit is contained in:
Nicolas Évrard
2023-11-11 13:48:16 +01:00
parent d35d519ea1
commit 02650a0ffd
+4
View File
@@ -1968,9 +1968,13 @@ class ModelStorage(Model):
without_check_access():
if to_create:
news = cls.create([save_values[r] for r in to_create])
new_ids = []
for record, new in zip(to_create, news):
record._ids.remove(record.id)
record._id = new.id
# Group all records that are alone
if not record._ids:
record._ids = new_ids
record._ids.append(record.id)
if to_write:
cls.write(*sum(