diff options
| author | Raphael Collet <rco@odoo.com> | 2019-08-19 15:04:22 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2019-08-22 10:05:52 +0000 |
| commit | 8918bbbb5e0e3ac70b89470dd79b9717f3b67ab6 (patch) | |
| tree | 2c3f3bac03ccd1065a0f0e280c4d0f6a84d502da /odoo/fields.py | |
| parent | 723a2682bc5c9ae0af821bb461b0121818882dd9 (diff) | |
[IMP] fields: do not trigger recomputations on transient models from regular models
This is a performance optimization: modifying a regular record will not
trigger some recomputation on a transient record. Most transient
records are simply waiting to be garbage-collected, so there is no need
to keep their fields up-to-date.
closes odoo/odoo#35909
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'odoo/fields.py')
| -rw-r--r-- | odoo/fields.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/odoo/fields.py b/odoo/fields.py index 3a6824433cc..295ac96cbf4 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -730,6 +730,12 @@ class Field(MetaField('DummyField', (object,), {})): path = [] # fields from model to field_model for fname in dotnames.split('.'): field = field_model._fields[fname] + + if model._transient and not field_model._transient: + # modifying fields on regular models should not trigger + # recomputations of fields on transient models + break + # Do not make self trigger itself # e.g. `fields.One2many('stock.move.line', 'move_id', domain=[('product_qty', '=', 0.0)])` # will have 'move_line_nosuggest_ids.product_qty' as a dependency |
