From 61998e991b261cb3dc7cdb1e76ab7a3f818c647e Mon Sep 17 00:00:00 2001 From: Iryna Vyshnevska Date: Thu, 30 Dec 2021 11:44:08 +0200 Subject: [PATCH] [14.0][IMP] add layout for clean template --- report_layout_config/__manifest__.py | 1 + report_layout_config/data/report_layout.xml | 19 ++- .../migrations/14.0.1.0.0/pre-migrate.py | 18 ++ .../models/base_document_layout.py | 18 +- report_layout_config/readme/CONTRIBUTORS.rst | 1 + .../static/src/scss/style.scss | 11 ++ report_layout_config/templates/assets.xml | 14 ++ .../templates/report_templates.xml | 159 ++++++++++++------ .../views/document_layout.xml | 35 +--- 9 files changed, 180 insertions(+), 96 deletions(-) create mode 100644 report_layout_config/migrations/14.0.1.0.0/pre-migrate.py create mode 100644 report_layout_config/static/src/scss/style.scss create mode 100644 report_layout_config/templates/assets.xml diff --git a/report_layout_config/__manifest__.py b/report_layout_config/__manifest__.py index e27c0401e..6524f68fa 100644 --- a/report_layout_config/__manifest__.py +++ b/report_layout_config/__manifest__.py @@ -12,6 +12,7 @@ "depends": ["web", "base"], "data": [ "views/document_layout.xml", + "templates/assets.xml", "templates/report_templates.xml", "data/report_layout.xml", ], diff --git a/report_layout_config/data/report_layout.xml b/report_layout_config/data/report_layout.xml index 480a10408..1d41271b8 100644 --- a/report_layout_config/data/report_layout.xml +++ b/report_layout_config/data/report_layout.xml @@ -1,14 +1,27 @@ - - Layout images + + Layout images standard /report_layout_config/static/img/preview_standard.png /report_layout_config/static/pdf/preview_standard.pdf + + + Layout images clean + + /report_layout_config/static/img/preview_standard.png + /report_layout_config/static/pdf/preview_standard.pdf + + diff --git a/report_layout_config/migrations/14.0.1.0.0/pre-migrate.py b/report_layout_config/migrations/14.0.1.0.0/pre-migrate.py new file mode 100644 index 000000000..fd4459fee --- /dev/null +++ b/report_layout_config/migrations/14.0.1.0.0/pre-migrate.py @@ -0,0 +1,18 @@ +# Copyright 2021 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + + +from openupgradelib.openupgrade import rename_xmlids + + +def migrate(cr, version): + + rename_xmlids( + cr, + [ + ( + "report_layout_config.external_layout_images", + "report_layout_config.external_standard_layout_images_template", + ) + ], + ) diff --git a/report_layout_config/models/base_document_layout.py b/report_layout_config/models/base_document_layout.py index 387ce0ba4..11a353d1f 100644 --- a/report_layout_config/models/base_document_layout.py +++ b/report_layout_config/models/base_document_layout.py @@ -8,22 +8,16 @@ class BaseDocumentLayout(models.TransientModel): _inherit = "base.document.layout" full_header_img = fields.Binary( - related="company_id.full_header_img", readonly=False + related="company_id.full_header_img", + readonly=False, + help="Replaces whole header with image", ) full_footer_img = fields.Binary( - related="company_id.full_footer_img", readonly=False + related="company_id.full_footer_img", + readonly=False, + help="Replaces whole footer, disables footer logo", ) - need_images_layout = fields.Boolean( - compute="_compute_need_images_layout", readonly=True - ) - - @api.depends("report_layout_id") - def _compute_need_images_layout(self): - self.ensure_one() - img_lay = self.env.ref("report_layout_config.external_layout_images").view_id - self.need_images_layout = self.external_report_layout_id == img_lay - @api.depends( "full_footer_img", "full_header_img", diff --git a/report_layout_config/readme/CONTRIBUTORS.rst b/report_layout_config/readme/CONTRIBUTORS.rst index 0a9139f76..429d07530 100644 --- a/report_layout_config/readme/CONTRIBUTORS.rst +++ b/report_layout_config/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Thomas Nowicki +* Iryna Vyshnevska diff --git a/report_layout_config/static/src/scss/style.scss b/report_layout_config/static/src/scss/style.scss new file mode 100644 index 000000000..bc9b9350f --- /dev/null +++ b/report_layout_config/static/src/scss/style.scss @@ -0,0 +1,11 @@ +.footer-image { + max-width: 500px; +} + +.header-image { + margin-top: 22px; +} + +.header-full-image { + max-height: 60px; +} diff --git a/report_layout_config/templates/assets.xml b/report_layout_config/templates/assets.xml new file mode 100644 index 000000000..e27fd9d89 --- /dev/null +++ b/report_layout_config/templates/assets.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/report_layout_config/templates/report_templates.xml b/report_layout_config/templates/report_templates.xml index e9665acd0..d10909717 100644 --- a/report_layout_config/templates/report_templates.xml +++ b/report_layout_config/templates/report_templates.xml @@ -1,7 +1,7 @@ -