Files
odoo_source/addons/website/models/ir_model.py
T
Adrian Torres b680dac375 [FIX] website: properly unlink res_config_settings recs
res_config_settings.website_id should be ondelete='cascade', however
that is not suitable for stable, so we emulate the ondelete cascade
with an SQL query during ir.model unlink (website uninstallation).

Fixes #25078
2018-06-11 09:45:20 +02:00

16 lines
489 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details
from odoo import api, models
# This is a nasty hack, targeted for V11 only
class IrModel(models.Model):
_inherit = 'ir.model'
@api.multi
def unlink(self):
self.env.cr.execute("DELETE FROM ir_model_fields WHERE name='website_id'")
self.env.cr.execute("DELETE FROM res_config_settings WHERE website_id IS NOT NULL")
return super(IrModel, self).unlink()