From 706d1dc7e0437dd1fd8f1a5fb5c0b0c256648d5f Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Mon, 6 Mar 2023 15:55:27 +0100 Subject: [PATCH] connector_importer: fix _compute_docs_html --- connector_importer/models/recordset.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/connector_importer/models/recordset.py b/connector_importer/models/recordset.py index f061279f..2d198bbb 100644 --- a/connector_importer/models/recordset.py +++ b/connector_importer/models/recordset.py @@ -8,6 +8,7 @@ from odoo import api, fields, models from odoo.addons.base_sparse_field.models.fields import Serialized +from odoo.addons.component.utils import is_component_registry_ready from odoo.addons.queue_job.job import DONE, STATES from ..log import logger @@ -342,7 +343,11 @@ def _get_importers(self): @api.depends("import_type_id") def _compute_docs_html(self): - template = self.env.ref("connector_importer.recordset_docs") + if not is_component_registry_ready(self.env.cr.dbname): + # We cannot render anything if we cannot load components + self.docs_html = False + return + qweb = self.env["ir.qweb"].sudo() for item in self: item.docs_html = False if isinstance(item.id, models.NewId) or not item.backend_id: @@ -352,7 +357,7 @@ def _compute_docs_html(self): continue importers = item._get_importers() data = {"recordset": item, "importers": importers} - item.docs_html = template._render(data) + item.docs_html = qweb._render("connector_importer.recordset_docs", data) # TODO