Esteban Echeverry b14ef6346d [FIX] openerp models.py: Add recompute conditional in unlink
Description of the issue/feature this PR addresses:

This commit adds the recompute conditional clause in the ORM unlink method.
This behaviour is already present in branch 10.0 as it can be seen in line 3431.
With this, the possibility of disabling the automatic recalculation of computed fields is given back to the developer of custom modules in performance critical scenarios. By using the Environment class "norecompute" context manager, the developer can now unlink records in a very fast manner and afterwards, execute the computed fields manually if needed (via an explicit method call or a direct sql update).

Current behavior before PR:

Having this option in the ORM will allow to speed up the system if needed when massive collateral changes must be made. One of this scenarios has to do with the modification of one2many fields and the write_uid and write_date computed fields. In the account module for example, when unreconciling account move lines,  the deletion of the partial reconcile records involved in the reconciliation triggers a one by one update of the related account move lines and account moves. If the involved documents are big, such an account move (Journal Entry) with thousands of lines, if one of its lines is reconciled and afterwards unreconciled, the process can take several minutes due to expensive one by one recomputations such as the ones involved in the modification of the write_uid and the write_date in the models.py recompute() method. This modifications can however be enforced later with a couple of SQL update statements, instead of thousands of them executed by a for loop.

Desired behavior after PR is merged:

Developers of custom modules will now have the possibility of disabling the automatic calculation of computed fields, as it can be done in the create method (models.py "_create()" line 4370). This is vital for performance reasons, specially when handling big documents such as thousands of lines account moves or sales orders.

This is basically a backport of revision f259e74f8a
2017-01-30 13:51:32 +01:00
2016-09-22 15:42:02 +02:00
2017-01-30 13:51:32 +01:00
…
…
…
…
2016-12-09 12:02:31 +01:00
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

If you are a developer you may type the following command at your terminal:

wget -O- https://raw.githubusercontent.com/odoo/odoo/9.0/odoo.py | python

Then follow the developer tutorials

For Odoo employees

To add the odoo-dev remote use this command:

$ ./odoo.py setup_git_dev

To fetch odoo merge pull requests refs use this command:

$ ./odoo.py setup_git_review
S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%