7aa1e727798ac58375c96bbab634a20f33fad427
[IMP] mail: Delete tracking values when uninstalling module -------------- ### 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. [IMP] mail: Rename groups field of mail.tracking.value ---------------- This commit renames the `groups` field into `field_groups`. The previous name was impossible to grep as the word `groups` is everywhere in the code base. Also the new name better follows the implicit convention that fields related to the tracked field all start with `field_`. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr closes odoo/odoo#31861 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
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
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%