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.
32 lines
881 B
Python
32 lines
881 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from . import mail_message_subtype
|
|
from . import mail_tracking_value
|
|
from . import mail_alias
|
|
from . import mail_followers
|
|
from . import mail_notification
|
|
from . import mail_message
|
|
from . import mail_activity
|
|
from . import mail_mail
|
|
from . import mail_thread
|
|
from . import mail_cc_mixin
|
|
from . import mail_address_mixin
|
|
from . import mail_blacklist
|
|
from . import mail_channel
|
|
from . import mail_template
|
|
from . import mail_shortcode
|
|
from . import res_partner
|
|
from . import res_users
|
|
from . import res_company
|
|
from . import res_config_settings
|
|
from . import update
|
|
from . import ir_action_act_window
|
|
from . import ir_actions
|
|
from . import ir_attachment
|
|
from . import ir_autovacuum
|
|
from . import ir_http
|
|
from . import ir_model
|
|
from . import ir_model_fields
|
|
from . import ir_ui_view
|