Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
# Copyright 2017 Avoin.Systems
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import report_paperformat_parameter
from . import report_paperformat
from . import report

View File

@@ -0,0 +1,29 @@
# Copyright 2017 Avoin.Systems
# Copyright 2017 ForgeFlow, S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, models
class IrActionsReport(models.Model):
_inherit = "ir.actions.report"
@api.model
def _build_wkhtmltopdf_args(
self,
paperformat_id,
landscape,
specific_paperformat_args=None,
set_viewport_size=False,
):
# noinspection PyUnresolvedReferences,PyProtectedMember
command_args = super()._build_wkhtmltopdf_args(
paperformat_id, landscape, specific_paperformat_args, set_viewport_size
)
for param in paperformat_id.custom_params:
command_args.extend([param.name])
if param.value:
command_args.extend([param.value])
return command_args

View File

@@ -0,0 +1,43 @@
# Copyright 2017 Avoin.Systems
# Copyright 2017 ForgeFlow, S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging
from odoo import api, fields, models
from odoo.exceptions import ValidationError
_logger = logging.getLogger(__name__)
class Paper(models.Model):
_inherit = "report.paperformat"
custom_params = fields.One2many(
"report.paperformat.parameter",
"paperformat_id",
"Custom Parameters",
help="Custom Parameters passed forward as wkhtmltopdf command arguments",
)
@api.constrains("custom_params")
def _check_recursion_custom_params(self):
for paperformat in self:
sample_html = """
<!DOCTYPE html>
<html style="height: 0;">
<body>
<div>
<span itemprop="name">Hello World!</span>
</div>
</body>
</html>
"""
report = self.env["ir.actions.report"].new(
{"paperformat_id": paperformat.id}
)
content = report._run_wkhtmltopdf([sample_html])
if not content:
raise ValidationError(
self.env._("Failed to create a PDF using the provided parameters.")
)

View File

@@ -0,0 +1,22 @@
# Copyright 2017 Avoin.Systems
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ReportPaperformatParameter(models.Model):
_name = "report.paperformat.parameter"
_description = "wkhtmltopdf parameters"
paperformat_id = fields.Many2one(
"report.paperformat",
"Paper Format",
required=True,
)
name = fields.Char(
required=True,
help="The command argument name. Remember to add prefix -- or -",
)
value = fields.Char()