[MIG] migrate report_wkhtmltopdf_param to 18.0

This commit is contained in:
Lukas Tran
2024-10-24 17:31:03 +07:00
committed by Lukas Tran
parent dc0e880baf
commit 8e13d2b154
8 changed files with 38 additions and 27 deletions

View File

@@ -4,7 +4,7 @@
import logging
from odoo import _, api, fields, models
from odoo import api, fields, models
from odoo.exceptions import ValidationError
_logger = logging.getLogger(__name__)
@@ -21,7 +21,7 @@ class Paper(models.Model):
)
@api.constrains("custom_params")
def _check_recursion(self):
def _check_recursion_custom_params(self):
for paperformat in self:
sample_html = """
<!DOCTYPE html>
@@ -36,8 +36,8 @@ class Paper(models.Model):
report = self.env["ir.actions.report"].new(
{"paperformat_id": paperformat.id}
)
content = report._run_wkhtmltopdf(sample_html)
content = report._run_wkhtmltopdf([sample_html])
if not content:
raise ValidationError(
_("Failed to create a PDF using the provided parameters.")
self.env._("Failed to create a PDF using the provided parameters.")
)