Files
odoo_source/addons/website/__init__.py
T
Raphael ColletandXavier Dollé 1595c0ee27 [REF] core: replace thread-local "envs" by cursor-bound "transaction"
Refactor the Environments object into a Transaction object, which is
bound to one cursor, and is no longer shared among several cursors.

The following methods/properties have been changed:
 - Environment.envs no longer works (because of the design change);
 - Environment.manage() is deprecated (no longer useful);
 - Environment.reset() is now an instance method;
 - env.clear_upon_failure() is deprecated in favor of cr.savepoint().

closes odoo/odoo#75598

Related: odoo/enterprise#20451
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Xavier Dollé <xdo@odoo.com>
2021-09-03 15:45:46 +00:00

29 lines
849 B
Python

# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import controllers
from . import models
from . import wizard
import odoo
from odoo import api, SUPERUSER_ID
from functools import partial
def uninstall_hook(cr, registry):
def rem_website_id_null(dbname):
db_registry = odoo.modules.registry.Registry.new(dbname)
with db_registry.cursor() as cr:
env = api.Environment(cr, SUPERUSER_ID, {})
env['ir.model.fields'].search([
('name', '=', 'website_id'),
('model', '=', 'res.config.settings'),
]).unlink()
cr.postcommit.add(partial(rem_website_id_null, cr.dbname))
def post_init_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
env['ir.module.module'].update_theme_images()