From e542c4a01fc19b98b4a47e40e4d15c2afc987dee Mon Sep 17 00:00:00 2001
From: Lucas Perais <lpe@odoo.com>
Date: Mon, 22 May 2023 11:27:22 +0000
Subject: [PATCH] [FIX] web: test document layout should be post_install

Initialize a DB. Install website when it is initialized.
Launch tests of the class TestBaseDocumentLayout

Before this commit, there was a crash because those tests render the report_layout and its
assets.

The full explanation is that, the module website adds an ir.asset `website.s_badge_000_variables_scss`
that the report wants to fetch. But, the class of tests is executed at_install. Given the topological order
and the order of the modules installation, website is not in the registry at that point, but the ir.asset is retrieved
from the database.
The ir.asset algorithm determines at that point that `/website/` is not an admissible path and raise an exception.

This commit solves the problem by tagging this class of test "post_install" and not "at_install".

runbot-error-21203
runbot-error-21204
runbot-error-21205
runbot-error-21206
runbot-error-21207
runbot-error-21208
runbot-error-21352
runbot-error-21353
runbot-error-21354
runbot-error-21355
runbot-error-21356
runbot-error-21357

closes odoo/odoo#121970

X-original-commit: 48b833513ac8f76febbc4ca7b935260d7ea85522
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
---
 addons/web/tests/test_base_document_layout.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/web/tests/test_base_document_layout.py b/addons/web/tests/test_base_document_layout.py
index 14afbc0acdbc..84c403773f6e 100644
--- a/addons/web/tests/test_base_document_layout.py
+++ b/addons/web/tests/test_base_document_layout.py
@@ -104,7 +104,7 @@ class TestBaseDocumentLayoutHelpers(TransactionCase):
         })
 
 
-@tagged('document_layout')
+@tagged('document_layout', "post_install", "-at_install")
 class TestBaseDocumentLayout(TestBaseDocumentLayoutHelpers):
     # Logo change Tests
     def test_company_no_color_change_logo(self):
-- 
GitLab