[FIX] models: batch field set on creation when company_dependent

This may be completely broken/wrong, but damn if it doesn't speed
import up (2mn to 30s, the main cost center goes back to updating
computed fields during/after creation fields).
This commit is contained in:
Xavier Morel
2018-09-11 16:43:55 +02:00
committed by xmo-odoo
parent 0ecc5d50fb
commit 5fade72656
+1 -1
View File
@@ -3513,7 +3513,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
# If a field is not stored, its inverse method will probably
# write on its dependencies, which will invalidate the field on
# all records. We therefore inverse the field record by record.
if all(field.store for field in fields):
if all(field.store or field.company_dependent for field in fields):
batches = [rec_vals]
else:
batches = [[rec_data] for rec_data in rec_vals]