summaryrefslogtreecommitdiff
path: root/odoo/modules/db.py
AgeCommit message (Collapse)Author
2019-08-14[MERGE] forward port branch saas-12.4 up to 98a55917a60Christophe Simonis
2019-07-25[FIX] core: auto_install modules being very stickyXavier Morel
An unintended side-effect of #29431 is apparently that auto_install applications automatically get reinstalled when uninstalled, which was not the goal. Move the auto_install selection back into db.py, this version seems to work even though the previous attempt was apparently unsuccessful. closes odoo/odoo#35180 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-06-11[FIX] base: proper removal of xmlid after updateMartin Trigaux
Context: After a module update, the records present in ir_model_data table but not in self.pool.loaded_xmlids are considered as no longer needed and should be removed. An exception is done with noupdate=true entries. Bug 1: Entries with noupdate=NULL are not considered in the evaluation and are ignored while it may be worth deleting. Bug 2: Some records with their external id being automatically created are not present in self.pool.loaded_xmlids and may get removed after updating a module. By a lucky coincidence, bug 1 make it so that records targeted by bug 2 are ignored and not deleted (the "automagically" created ir.model.data often lack a noupdate value). Fix Bug 1: Use a COALESCE to find both records with noupdate=NULL and noupdate=false Fix Bug 2: Depends on the source of the generated external id: - ir.model: The entries created through _reflect_model were not loaded in self.loaded_xmlids Use the proper ORM method _update_xmlids that correctly populates self.pool.loaded_xmlids - ir.model.category: The categories were generated when the db was initalised, doing SQL was not avoidable. Create the categories in noupdate to avoid it being considered for removal. - ir.property: Are always created in noupdate in data files but in stock_account it was manually created without being in noupdate closes odoo/odoo#32881 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com> Co-authored-by: Raphael Collet <rco@odoo.com>
2019-05-07[IMP] core: allow auto_install restriction on a subset of dependenciesXavier Morel
Currently, auto_install is triggered when all dependencies get installed, but there are cases where one would want such trigger on only a subset thereof. e.g. we want `website_sale_dashboard` to auto-install when `website_sale` is installed. Currently, it requires `web_dashboard` to also be auto-installed otherwise `website_sale_dashboard` would "wait" for both dependencies to be explicitly installed before the auto-install triggers. That's despite `web_dashboard` not being very useful on its own. More generally this is an issue with technical modules which need to be marked as auto_install so as not to block e.g. bridge modules from automatically installing. This change allows setting `auto_install` to a subset of `depends`: * if auto_install is set to `False`, the module does not get automatically installed (no change in semantics) * if auto_install is set to `True`, the module gets automatically installed if and only if all its dependencies are installed (also no change in semantics) * if auto_install is set to a list of dependencies, the module will be installed when all *these* dependencies are installed, other dependencies (excluded from auto_install) will be installed alongside as a consequence * auto_install can be set to an empty list, in this case the module will always be automatically installed regardless of its dependencies (and will force their installation). So after this change, `web_dashboard`'s auto_install can be set to `False` (such that it's not installed if no module defining dashboards is installed) and `website_sale_dashboard`'s manifest can be edited to: 'auto_install': ['website_sale'] possibilities: # no automatic installation 'depends': ['a', 'b'], 'auto_install': False # automatic installation if both a and b are installed 'depends': ['a', 'b'], 'auto_install': True # automatic installation if both a and b are installed (explicit) 'depends': ['a', 'b'], 'auto_install': ['a', 'b'] # automatic installation if b is installed, a will get forcefully # installed if it isn't yet 'depends': ['a', 'b'], 'auto_install': ['b'] # always automatically installed, will cause the installation of # its dependencies even if they're not marked explicitly 'depends': ['a', 'b'], 'auto_install': [] Task 1851328 closes odoo/odoo#29431 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2018-07-16[IMP] de-commit-ify db/module installXavier Morel
Try to remove cr.commit (and rollback) from module and db install: * put a savepoint around test data loading * remove a bunch of commits sprinkled throughout * remove rollback on data loading failure (assuming it bubbles up, the entire module's installation should be rolled back) * add commit right before the tests are run, so they can run isolated and still see whatever was done when installing their module * convert a few explicit closing to context managers
2017-11-27[MOV] base: move base.sql to data/base_data.sqlThibault Delavallée
2017-05-10[FIX] P3: list -> iterable builtins (#16811)xmo-odoo
In Python 3: * various builtins and dict methods were changed to return view/iterable objects rather than lists * and the separate Python 2 view/iterable builtins and methods were removed altogether This is problematic when using these items as list (which the happens repeatedly in Odoo), but more viciously when iterating *multiple times* over them (which also happens, which I've messed up multiple times while writing this, and which is a pain to debug even when you've just created the issue). Convert all code using these to semantics-matching cross-version helper functions to get the LCD behaviour between P2 and P3, and forbid the builtins via lint. issue #8530
2017-02-22[REF] tools: add functions for SQL schema manipulationRaphael Collet
This helps factoring out a certain number of similar queries, and removing a few methods from `BaseModel`.
2016-09-02[FIX] odoo: rename imports and adapt import hooksRaphael Collet
2016-09-02[REF] openerp: move `openerp` to `odoo`Raphael Collet