summaryrefslogtreecommitdiff
path: root/addons/theme_default
diff options
context:
space:
mode:
authorMichael Brown <mbrown@fensystems.co.uk>2016-08-08 21:18:31 +0100
committerOlivier Dony <odo@openerp.com>2016-10-06 17:52:03 +0200
commitd477dcc31606cd41cb1622a5d078407fad2e57a7 (patch)
treeacb17f79cc62943bee90ecdafbeffc3005423552 /addons/theme_default
parent22c4a0c1b06fef3d27fc6a0cd2c7d00ccc2816de (diff)
[FIX] models: fix behaviour of 'defer_parent_store_computation'
If a model uses nested sets to maintain a hierarchical record ordering, then bulk inserts (e.g. via a CSV import) are likely to suffer from an O(n^2) performance penalty, since there is a high chance that each new record will require many of the existing records' parent_left and parent_right fields to be updated. The context parameter 'defer_parent_store_computation' may be passed to the load() method, in order to defer updating the parent_left and parent_right fields until after the bulk operation is complete. This appears to have last been fully supported in version 7 (via the old import_data() method). It is still possible to specify 'defer_parent_store_computation', e.g. via an XML-RPC call such as m.execute_kw(dbname, uid, password, 'stock.location', 'load', [], {'fields': fields, 'data': data, 'context': {'defer_parent_store_computation': True}}) This will currently defer the recalculation of parent_left and parent_right, but does not correctly call _parent_store_compute() after the bulk operation is complete. Add the missing call to _parent_store_compute() to perform a one-time update of the parent_left and parent_right fields if needed after the import operation is complete. Also fix the child_of_domain() and parent_of_domain() expression methods, so that the 'child_of' and 'parent_of' operators give correct answers when updates to parent_left and parent_right have been deferred. Signed-off-by: Michael Brown <mbrown@fensystems.co.uk> Closes #13688 (part 2/2)
Diffstat (limited to 'addons/theme_default')
0 files changed, 0 insertions, 0 deletions