[FIX] l10n_sa_edi: markup usage

`''.join` would strip the `Markup` out, so the markup would appear
literally in the result instead of being interpreted as HTML.

Also switch to using dict-style formatting, it's a touch clearer (and
shorter) for this case, since `e` is already a dict (hopefully).

closes odoo/odoo#140496

X-original-commit: 4d88e1df4deb5f1aab23ca117f6b6261babec3f7
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Xavier Morel
2023-10-31 15:54:29 +00:00
parent 99f03b3d12
commit f6e01d6b53
+2 -2
View File
@@ -324,10 +324,10 @@ class AccountJournal(models.Model):
if result.get('error'):
raise UserError(Markup("<p class='mb-0'>%s <b>%s</b></p>") % (_("Could not complete Compliance Checks for the following file:"), fname))
if result['validationResults']['status'] == 'WARNING':
warnings = "".join(Markup("<li><b>%s</b>: %s </li>") % (e['code'], e['message']) for e in result['validationResults']['warningMessages'])
warnings = Markup().join(Markup("<li><b>%(code)s</b>: %(message)s </li>") % e for e in result['validationResults']['warningMessages'])
self.l10n_sa_csr_errors = Markup("<br/><br/><ul class='pl-3'><b>%s</b>%s</ul>") % (_("Warnings:"), warnings)
elif result['validationResults']['status'] != 'PASS':
errors = "".join(Markup("<li><b>%s</b>: %s </li>") % (e['code'], e['message']) for e in result['validationResults']['errorMessages'])
errors = Markup().join(Markup("<li><b>%(code)s</b>: %(message)s </li>") % e for e in result['validationResults']['errorMessages'])
raise UserError(Markup("<p class='mb-0'>%s <b>%s</b> %s</p>")
% (_("Could not complete Compliance Checks for the following file:"), fname, Markup("<br/><br/><ul class='pl-3'><b>%s</b>%s</ul>") % (_("Errors:"), errors)))
self.l10n_sa_compliance_checks_passed = True