Files
odoo_source/odoo/addons/base/data/neutralize.sql
T
Moens Alexandre 3d54c3265c [FIX] base: neutralize keep only autovacuum_job
The root of the issue:
The external identifiers are not guaranteed to be unique on their `name`
alone, the unique constraint is on the `name` and on the `module` fields.

Before this commit:
If a user or third party app were for example to create an external identifier
"project.autovacuum_job" and point it to an `ir.cron` record,
then that `ir.cron` would also be kept activated, which could cause
major issue if it makes calls to external systems, sends mail, etc...

After this commit:
All the crons are deactivated by the neutralisation, except for
the autovacuum

closes odoo/odoo#152535

X-original-commit: 0cc89a026d05b37714864e7ebb695e77ef2d1e7d
Signed-off-by: Jérémy Kersten <jke@odoo.com>
Signed-off-by: Alexandre Moens (mao) <mao@odoo.com>
2024-02-04 08:19:21 +00:00

30 lines
889 B
SQL

-- deactivate mail servers
UPDATE ir_mail_server
SET active = false;
-- insert dummy mail server to prevent using fallback servers specified using command line
INSERT INTO ir_mail_server(name, smtp_port, smtp_host, smtp_encryption, active, smtp_authentication)
VALUES ('neutralization - disable emails', 1025, 'invalid', 'none', true, 'login');
-- deactivate crons
UPDATE ir_cron
SET active = false
WHERE id NOT IN (
SELECT res_id
FROM ir_model_data
WHERE model = 'ir.cron'
AND name = 'autovacuum_job'
AND module = 'base'
);
-- neutralization flag for the database
INSERT INTO ir_config_parameter (key, value)
VALUES ('database.is_neutralized', true)
ON CONFLICT (key) DO
UPDATE SET value = true;
-- deactivate webhooks
UPDATE ir_act_server
SET webhook_url = 'neutralization - disable webhook'
WHERE state = 'webhook';