summaryrefslogtreecommitdiff
path: root/addons/mail/models/ir_model_fields.py
AgeCommit message (Collapse)Author
2020-04-03[IMP] core: reflect models, fields and selections in batchRaphael Collet
This saves 4.5% of the total installation time. X-original-commit: 8519064dce975af542ccd30dc14c56b9bb36d07b
2019-11-19[IMP] mail: track fields based on ir_model_fieldsKevin Baptiste
The tracked field is now a relation to the corresponding ir.model.field. This prevents potential privacy issues should the field be deleted or renamed. closes odoo/odoo#39232 Taskid: 2088634 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-10-10[FIX] base_sparse_field,mail: handle None _instanciate_attrs overridefw-bot
The parent was expected to return a dict, but it can also return None in some cases. When that happens, the overrides were crashing because it is impossible to assign a key/val to None. Note that using `if` conditions like this also prevents from writing on the dict if it is existing but empty, but due to the definition of the parent, if there is a dict, it will not be empty. closes odoo/odoo#38316 X-original-commit: 3525fad3b1729286d139b19a4a92f1821d94ad88 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2019-08-20[IMP] models: ORM speedupRaphael Collet
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>
2019-04-17[IMP] mail: Delete tracking values when uninstalling moduleLucas Lefèvre
Purpose ======= mail.tracking.values should be deleted when the corresponding field is deleted (when the module which defined it is uninstalled). Firstly because we don't want useless data in db. Secondly because the groups associated with the field can no longer be checked if it was deleted. As we don't know to whom the value was restricted, the value should not be displayed anyway. Note: this case was fixed in saas-12.2 by b9e96b7 but the proper way to fix it is to delete the tracking values. Specification ============= Delete `mail.tracking.value` when the associated `ir.model.fields` is deleted. Two alternatives were considered: 1. Change the `field` field of `mail.tracking.value` from Char to a m2o to `ir.model.fields` which allows to use delete oncascade. This implies to modify existing code, but more importantly it adds database queries. 2. Override the unlink method of `ir.model.fields` to first unlink associated tracking values. The first method is probably cleaner but the second method was nonetheless chosen as we don't want to impact performance in the main tracking flow only to better support module uninstalls which happens rarely. Note: when a module is uninstalled, `ir.model.fields` are unlinked one by one (in a for loop). Tracking values are therefore also unlinked field by field. Batchifying field deletion would greatly reduce the amount of queries.