Skip to content

Commit

Permalink
connector_importer: fix _compute_docs_html
Browse files Browse the repository at this point in the history
  • Loading branch information
simahawk committed Sep 2, 2024
1 parent e276091 commit 706d1dc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions connector_importer/models/recordset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Check warning on line 350 in connector_importer/models/recordset.py

View check run for this annotation

Codecov / codecov/patch

connector_importer/models/recordset.py#L348-L350

Added lines #L348 - L350 were not covered by tests
for item in self:
item.docs_html = False
if isinstance(item.id, models.NewId) or not item.backend_id:
Expand All @@ -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)

Check warning on line 360 in connector_importer/models/recordset.py

View check run for this annotation

Codecov / codecov/patch

connector_importer/models/recordset.py#L360

Added line #L360 was not covered by tests


# TODO
Expand Down

0 comments on commit 706d1dc

Please sign in to comment.