From f47459b7c5d994c6195f0e78f4e4f1d78e557c56 Mon Sep 17 00:00:00 2001 From: valen Date: Wed, 15 Jan 2025 12:35:41 +0100 Subject: [PATCH] [FIX] report_qweb_parameter: out and raw doesn't work with conditionals --- report_qweb_parameter/README.rst | 4 ++++ .../demo/test_report_field_length.xml | 19 +++++++++++++++++-- report_qweb_parameter/models/ir_qweb.py | 4 ++-- report_qweb_parameter/readme/CONTRIBUTORS.rst | 4 ++++ .../static/description/index.html | 19 ++++++++++++++----- .../tests/test_report_qweb_parameter.py | 13 +++++++++++-- 6 files changed, 52 insertions(+), 11 deletions(-) diff --git a/report_qweb_parameter/README.rst b/report_qweb_parameter/README.rst index 899c56f9e4..7ced29a67b 100644 --- a/report_qweb_parameter/README.rst +++ b/report_qweb_parameter/README.rst @@ -77,6 +77,10 @@ Contributors * Iván Antón +* `Sygel Technology `_: + + * Valentin Vinagre + Maintainers ~~~~~~~~~~~ diff --git a/report_qweb_parameter/demo/test_report_field_length.xml b/report_qweb_parameter/demo/test_report_field_length.xml index d786acce7f..9f637234f2 100644 --- a/report_qweb_parameter/demo/test_report_field_length.xml +++ b/report_qweb_parameter/demo/test_report_field_length.xml @@ -15,6 +15,11 @@ t-esc="docs[0].street" t-if="docs[0].street" /> +
  • +
  • +
  • + +* `Sygel Technology `_: + + * Valentin Vinagre \ No newline at end of file diff --git a/report_qweb_parameter/static/description/index.html b/report_qweb_parameter/static/description/index.html index c5c8f37cee..4e002abdc5 100644 --- a/report_qweb_parameter/static/description/index.html +++ b/report_qweb_parameter/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -428,12 +428,21 @@

    Contributors

  • Iván Antón <ozono@ozonomultimedia.com>

  • +
  • Sygel Technology:

    +
    +
      +
    • Valentin Vinagre
    • +
    +
    +
  • Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +Odoo Community Association +

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    diff --git a/report_qweb_parameter/tests/test_report_qweb_parameter.py b/report_qweb_parameter/tests/test_report_qweb_parameter.py index 19dd76c8ac..7468252006 100644 --- a/report_qweb_parameter/tests/test_report_qweb_parameter.py +++ b/report_qweb_parameter/tests/test_report_qweb_parameter.py @@ -24,9 +24,18 @@ def test_qweb_parameter(self): docs.website = "1234567890" # for avoding that Odoo adds http:// rep = report_object._render(report_name, docs.ids, False) root = ET.fromstring(rep[0]) + + # test length self.assertEqual(root[0].text, "1234567890") - self.assertEqual(root[2].text, "1234567890") - self.assertEqual(root[4].text, "1234567890") + self.assertEqual(root[3].text, "1234567890") + self.assertEqual(root[6].text, "1234567890") + + # test condicional length + self.assertEqual(root[1].text, "Tes") + self.assertEqual(root[4].text, "Test") + self.assertEqual(root[7].text, "Test ") + + # test maxlength docs.update({"street": "123456789"}) with self.assertRaises(QWebException): report_object._render(report_name, docs.ids, False)