diff options
| author | Raphael Collet <rco@odoo.com> | 2019-08-14 07:35:49 +0000 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2019-08-20 12:43:59 +0000 |
| commit | 9920f20e4c7753bc17bea71dea3a90f7de687196 (patch) | |
| tree | 6a3d0258c10a8ccb1d85949ddafdeb070de78121 /addons/sale_mrp | |
| parent | e28d3aa4d3851d72deba08c236072d002f83216a (diff) | |
[IMP] models: ORM speedup
This branch is the combination of several optimizations in the ORM:
* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;
* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;
* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);
* make method `modified` take advantage of inverse fields to inverse
dependencies;
* filter records by evaluating a domain on records in Python;
* a computed field with `readonly=False` behaves like a normal field
with an onchange method;
* computed fields are computed in superuser mode by default.
Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.
closes odoo/odoo#35659
Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
Diffstat (limited to 'addons/sale_mrp')
| -rw-r--r-- | addons/sale_mrp/tests/test_sale_mrp_flow.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/sale_mrp/tests/test_sale_mrp_flow.py b/addons/sale_mrp/tests/test_sale_mrp_flow.py index a849b8e82c4..ecd7f4c4380 100644 --- a/addons/sale_mrp/tests/test_sale_mrp_flow.py +++ b/addons/sale_mrp/tests/test_sale_mrp_flow.py @@ -540,7 +540,7 @@ class TestSaleMrpFlow(common.SavepointCase): self.assertEqual(del_qty, 0.0, 'Sale MRP: delivered quantity should be zero after partial delivery of a kit') # deliver remaining products, check the so's invoice_status and delivered quantities self.assertEqual(len(so.picking_ids), 2, 'Sale MRP: number of pickings should be 2') - pick_2 = so.picking_ids[0] + pick_2 = so.picking_ids.filtered('backorder_id') for move in pick_2.move_lines: if move.product_id.id == self.env.ref('mrp.product_product_computer_desk_bolt').id: move.write({'quantity_done': 19}) @@ -729,7 +729,7 @@ class TestSaleMrpFlow(common.SavepointCase): self._assert_quantities(move_lines, expected_quantities) # Process only x1 of the first component then create a backorder for the missing components - picking_original.move_lines[0].write({'quantity_done': 1}) + picking_original.move_lines.sorted()[0].write({'quantity_done': 1}) backorder_wizard = self.env['stock.backorder.confirmation'].create({'pick_ids': [(4, so.picking_ids[0].id)]}) backorder_wizard.process() |
