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 /addons/mrp/wizard | |
| 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 'addons/mrp/wizard')
| -rw-r--r-- | addons/mrp/wizard/mrp_product_produce.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/mrp/wizard/mrp_product_produce.py b/addons/mrp/wizard/mrp_product_produce.py index 6cdde0f8ae4..c1a7dc1bba2 100644 --- a/addons/mrp/wizard/mrp_product_produce.py +++ b/addons/mrp/wizard/mrp_product_produce.py @@ -134,6 +134,11 @@ class MrpProductProduce(models.TransientModel): move_id = self.env['stock.move'].create(values) line.move_id = move_id.id + # because of an ORM limitation (fields on transient models are not + # recomputed by updates in non-transient models), the related fields on + # this model are not recomputed by the creations above + self.invalidate_cache(['move_raw_ids', 'move_finished_ids']) + # Save product produce lines data into stock moves/move lines quantity = self.qty_producing if float_compare(quantity, 0, precision_rounding=self.product_uom_id.rounding) <= 0: |
