Skip to content

Commit 6de1cc1

Browse files
committed
[FIX] website: restore proper uninstallation of the website app
Before this commit, we had an error following those steps: 1. Install website app. 2. Customize the first website default theme settings (like the font-size of the header logo). 3. Uninstall the website app. 4. Reinstall the website app. 5. Try step (2) again => It does not work. This is due to custom SCSS attachments which were not properly removed after we uninstalled the app. The problem was actually already solved at some point with [1] but was later broken by [2] which prevented to properly call the `unlink` method for the only remaining website. [1]: odoo@2f361be [2]: odoo@93a2e85 Fixes odoo#44240 opw-2947919 closes odoo#97874 X-original-commit: 4658afd Signed-off-by: Romain Derie (rde) <[email protected]> Signed-off-by: Quentin Smetz (qsm) <[email protected]>
1 parent 374d422 commit 6de1cc1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

addons/website/models/website.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from werkzeug.exceptions import NotFound
1414

1515
from odoo import api, fields, models, tools, http
16+
from odoo.addons.base.models.ir_model import MODULE_UNINSTALL_FLAG
1617
from odoo.addons.http_routing.models.ir_http import slugify, _guess_mimetype, url_for
1718
from odoo.addons.website.models.ir_http import sitemap_qs2dom
1819
from odoo.addons.portal.controllers.portal import pager
@@ -238,9 +239,11 @@ def _handle_favicon(self, vals):
238239
vals['favicon'] = tools.image_process(vals['favicon'], size=(256, 256), crop='center', output_format='ICO')
239240

240241
def unlink(self):
241-
website = self.search([('id', 'not in', self.ids)], limit=1)
242-
if not website:
243-
raise UserError(_('You must keep at least one website.'))
242+
if not self.env.context.get(MODULE_UNINSTALL_FLAG, False):
243+
website = self.search([('id', 'not in', self.ids)], limit=1)
244+
if not website:
245+
raise UserError(_('You must keep at least one website.'))
246+
244247
# Do not delete invoices, delete what's strictly necessary
245248
attachments_to_unlink = self.env['ir.attachment'].search([
246249
('website_id', 'in', self.ids),

0 commit comments

Comments
 (0)