Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • xcg/odoo-modules/redner
1 result
Show changes
Commits on Source (8)
Showing with 66 additions and 31 deletions
......@@ -16,3 +16,6 @@
842f6329464d30e06629ee4b3c2924c9cd39750d 13.0.3.4.0
1316d1c0a1293c147824d8f0992a1ef6c67b83c1 15.0.1.0.0
ba2ffdb0841f3f8558ac8b98714a203c1f53cf59 16.0.1.0.0
8bff79e8c7f8677b5962c2e4ba53b6ec4f08fcd2 16.0.1.0.1
4fc9f9dc48f9a982b9d0cfd25723b8d5d1b090fd 16.0.1.0.2
3840af9a7140629afa70f63d3e21be350cfcd5fe 16.0.1.0.3
......@@ -2,6 +2,26 @@
Changelog
=========
16.0.1.1.0
----------
Use pypdf (3+) if present, otherwise defaults to PyPDF2.
16.0.1.0.3
----------
Put back default template value.
16.0.1.0.2
----------
Fix missing default language when creating from another model’s form.
16.0.1.0.1
----------
* Fix display of model rendering variables.
16.0.1.0.0
----------
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2016, 2023 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2016, 2023 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......@@ -21,7 +21,7 @@
{
"name": "Redner",
"license": "AGPL-3",
"version": "16.0.1.0.0",
"version": "16.0.1.1.0",
"category": "Reporting",
"author": "XCG Consulting",
"website": "https://orbeet.io/",
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2016 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2016 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2016 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2016 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
......@@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014, 2018, 2022 XCG Consulting
# Copyright © 2014, 2018, 2022 XCG Consulting
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2016 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2016 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2016 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2016 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2016 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2016, 2024 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......@@ -36,5 +36,5 @@
logger = logging.getLogger(__name__)
_pypdf2 = False
try:
......@@ -40,2 +40,4 @@
try:
from pypdf import PdfWriter
except ImportError:
from PyPDF2 import PdfFileReader, PdfFileWriter
......@@ -41,6 +43,6 @@
from PyPDF2 import PdfFileReader, PdfFileWriter
except ImportError:
logger.debug("Cannot import PyPDF2")
_pypdf2 = True
class RednerReport(models.TransientModel):
......@@ -137,5 +139,5 @@
:param reports_path: list of path of pdf files
:returns: path of the merged pdf
"""
writer = PdfFileWriter()
writer = PdfFileWriter() if _pypdf2 else PdfWriter()
for path in reports_path:
......@@ -141,6 +143,9 @@
for path in reports_path:
reader = PdfFileReader(path)
writer.appendPagesFromReader(reader)
if _pypdf2:
reader = PdfFileReader(path)
writer.appendPagesFromReader(reader)
else:
writer.append(path)
merged_file_fd, merged_file_path = tempfile.mkstemp(
suffix=".pdf", prefix="report.merged.tmp."
)
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2016 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2016 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2016 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2016 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......@@ -29,6 +29,9 @@
_redner = None
LANGUAGE_MJML_MUSTACHE = "text/mjml|mustache"
DEFAULT_LANGUAGE = LANGUAGE_MJML_MUSTACHE
class RednerTemplate(models.Model):
_name = "redner.template"
......@@ -71,7 +74,7 @@
string="Language",
selection=[
("text/html|mustache", "HTML + mustache"),
("text/mjml|mustache", "MJML + mustache"),
(LANGUAGE_MJML_MUSTACHE, "MJML + mustache"),
(
"application/vnd.oasis.opendocument.text|od+mustache",
"OpenDocument + mustache",
......@@ -118,7 +121,7 @@
# Prepare template params according to the selected language.
# Use template data field if the selected language is "od";
# otherwise the body field is used.
produces, language = vals.get("language").split("|")
produces, language = vals.get("language", DEFAULT_LANGUAGE).split("|")
body, body_format = (
(vals.get("template_data", ""), "base64")
if language == "od+mustache"
......@@ -201,7 +204,7 @@
@api.depends("body", "template_data")
def _compute_keywords(self):
for record in self:
record.detected_keywords = record.template_varlist_fetch()
record.detected_keywords = "\n".join(record.template_varlist_fetch())
@api.model
def get_keywords(self):
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2016 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2016 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
/** @odoo-module **/
/*
Redner Odoo module
Copyright (C) 2016 XCG Consulting <https://xcg-consulting.fr>
Copyright © 2016 XCG Consulting <https://xcg-consulting.fr>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2023 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2023 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2023 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2023 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2023 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2023 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2023 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2023 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
##############################################################################
#
# Redner Odoo module
# Copyright (C) 2016 XCG Consulting <https://xcg-consulting.fr>
# Copyright © 2016 XCG Consulting <https://xcg-consulting.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
......@@ -48,10 +48,12 @@
</button>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1>
<field name="name" />
</h1>
<div>
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1>
<field name="name" />
</h1>
</div>
<group>
<field name="language" />
......@@ -56,5 +58,7 @@
<group>
<field name="language" />
</group>
<group>
<field name="detected_keywords" />
</group>
</div>
......