Adrian Torres 1aa8663444 [IMP] base: unlink module data in batch
Before this commit, during a module uninstall, module data would be
unlinked in a record-by-record basis, this was done this way for two
elementary reasons:

- To guarantee an unlink order, as some module data being deleted
might only be deleted if some other module data has already been
deleted.
e.g. [a, b, c, a] -> we could batch unlink both `a` in the
list, however the second `a` could depend on the unlink
of either b or c, making the groupby erroneous.

- To create a savepoint before every module data unlink (record), so
that in case it fails, we can simply skip it and proceed with the
uninstall.

After this commit, batch unlink of module data is now possible without
losing the aforementioned key features.

- The first problem is fixed by using `itertools.groupby`, which
will group **adjacent** data of the same type and unlinks them all
in batch while guaranteeing correct unlink order.
e.g. [a, a, a, b, b, c, a, c, c, c] -> this will unlink in
batches of [a, a, a], [b, b], [c], [a], [c, c, c]

- The second problem is fixed by making a savepoint per batch, if
a single element of the batch fails and the recordset contains more
than one element, we split the recordset into two and we repeat the
unlink process recursively until we weed out the undeletable record

Real world example: l10n_mx_edi takes 20min to uninstall because it
contains a lot of master data (~55k records), with this patch the
uninstall takes a measly 20s.

It should generally reduce the uninstallation time for all modules, but
those with lots of master data will see greater benefits in terms of
time.

opw-2025895

closes odoo/odoo#34435

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-07-01 14:24:39 +00: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, Warehouse Management, 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.

Then follow the developer tutorials

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%