[MIG] report_qweb_parameter: Migration to 16.0

This commit is contained in:
David Ramia
2022-10-26 21:53:47 +02:00
parent 41fcda22c2
commit bd9f0a12b2
12 changed files with 93 additions and 43 deletions

View File

@@ -2,10 +2,13 @@
Report QWeb Parameter Report QWeb Parameter
===================== =====================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6e50557d8d49cab3485b6aa968d1dbc2a8d55f1fd8cdc34b3b269db65edf9693
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status :target: https://odoo-community.org/page/development-status
@@ -14,16 +17,16 @@ Report QWeb Parameter
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
:target: https://github.com/OCA/reporting-engine/tree/15.0/report_qweb_parameter :target: https://github.com/OCA/reporting-engine/tree/16.0/report_qweb_parameter
:alt: OCA/reporting-engine :alt: OCA/reporting-engine
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-report_qweb_parameter :target: https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_qweb_parameter
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/143/15.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=16.0
:alt: Try me on Runbot :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module allows you to add new parameters on QWeb reports. This module allows you to add new parameters on QWeb reports.
Currently, we have defined a field maximum on a report and a validation of Currently, we have defined a field maximum on a report and a validation of
@@ -50,8 +53,8 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_qweb_parameter%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_qweb_parameter%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@@ -87,6 +90,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/15.0/report_qweb_parameter>`_ project on GitHub. This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/16.0/report_qweb_parameter>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -3,7 +3,7 @@
{ {
"name": "Report QWeb Parameter", "name": "Report QWeb Parameter",
"version": "15.0.1.0.0", "version": "16.0.1.0.0",
"license": "AGPL-3", "license": "AGPL-3",
"summary": """ "summary": """
Add new parameters for qweb templates in order to reduce field length Add new parameters for qweb templates in order to reduce field length

View File

@@ -34,6 +34,19 @@
t-raw="docs[0].company_registry" t-raw="docs[0].company_registry"
t-if="docs[0].company_registry" t-if="docs[0].company_registry"
/> />
<li
name="raw_length"
t-minlength="10"
t-length="10"
t-out="docs[0].vat"
t-if="docs[0].vat"
/>
<li
name="raw_maxlength"
t-maxlength="10"
t-out="docs[0].company_registry"
t-if="docs[0].company_registry"
/>
</data> </data>
</template> </template>
</odoo> </odoo>

View File

@@ -22,12 +22,14 @@ msgid "Length Report"
msgstr "Longitud de l'informe" msgstr "Longitud de l'informe"
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be less than %s" msgid "Length cannot be less than %s"
msgstr "La longitut no pot ser menor que %s" msgstr "La longitut no pot ser menor que %s"
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be more than %s" msgid "Length cannot be more than %s"

View File

@@ -23,12 +23,14 @@ msgid "Length Report"
msgstr "Longitud del informe" msgstr "Longitud del informe"
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be less than %s" msgid "Length cannot be less than %s"
msgstr "La longitud no puede ser menor a %s" msgstr "La longitud no puede ser menor a %s"
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be more than %s" msgid "Length cannot be more than %s"

View File

@@ -24,12 +24,14 @@ msgid "Length Report"
msgstr "Longueur du rapport " msgstr "Longueur du rapport "
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be less than %s" msgid "Length cannot be less than %s"
msgstr "La longueur du rapport ne peut pas être inférieure à %s" msgstr "La longueur du rapport ne peut pas être inférieure à %s"
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be more than %s" msgid "Length cannot be more than %s"

View File

@@ -22,12 +22,14 @@ msgid "Length Report"
msgstr "Lunghezza Report" msgstr "Lunghezza Report"
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be less than %s" msgid "Length cannot be less than %s"
msgstr "La lunghezza non può essere meno di %s" msgstr "La lunghezza non può essere meno di %s"
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be more than %s" msgid "Length cannot be more than %s"

View File

@@ -22,12 +22,14 @@ msgid "Length Report"
msgstr "Relatório de Comprimento" msgstr "Relatório de Comprimento"
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be less than %s" msgid "Length cannot be less than %s"
msgstr "Comprimento não pode ser superior a %s" msgstr "Comprimento não pode ser superior a %s"
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be more than %s" msgid "Length cannot be more than %s"

View File

@@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 15.0\n" "Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@@ -19,12 +19,14 @@ msgid "Length Report"
msgstr "" msgstr ""
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be less than %s" msgid "Length cannot be less than %s"
msgstr "" msgstr ""
#. module: report_qweb_parameter #. module: report_qweb_parameter
#. odoo-python
#: code:addons/report_qweb_parameter/models/ir_qweb.py:0 #: code:addons/report_qweb_parameter/models/ir_qweb.py:0
#, python-format #, python-format
msgid "Length cannot be more than %s" msgid "Length cannot be more than %s"

View File

@@ -16,7 +16,7 @@ class IrQWeb(models.AbstractModel):
raise ValidationError(_("Length cannot be more than %s") % str(max_length)) raise ValidationError(_("Length cannot be more than %s") % str(max_length))
return value return value
def _compile_directive_esc(self, el, options, indent): def _compile_directive_esc(self, el, compile_context, level):
min_value = el.attrib.pop("t-minlength", False) min_value = el.attrib.pop("t-minlength", False)
max_value = el.attrib.pop("t-maxlength", False) max_value = el.attrib.pop("t-maxlength", False)
if min_value or max_value: if min_value or max_value:
@@ -32,9 +32,28 @@ class IrQWeb(models.AbstractModel):
if "t-length" in el.attrib: if "t-length" in el.attrib:
tlength = el.attrib.pop("t-length") tlength = el.attrib.pop("t-length")
el.attrib["t-esc"] = "(" + el.attrib["t-esc"] + ")[:" + tlength + "]" el.attrib["t-esc"] = "(" + el.attrib["t-esc"] + ")[:" + tlength + "]"
return super()._compile_directive_esc(el, options, indent) return super()._compile_directive_esc(el, compile_context, level)
def _compile_directive_raw(self, el, options, indent): def _compile_directive_out(self, el, compile_context, level):
min_value = el.attrib.pop("t-minlength", False)
max_value = el.attrib.pop("t-maxlength", False)
if min_value or max_value:
el.attrib["t-out"] = (
'docs.env["ir.qweb"].check_length('
+ el.attrib["t-out"]
+ ", "
+ (min_value or "False")
+ ", "
+ (max_value or "False")
+ ")"
)
if "t-length" in el.attrib:
tlength = el.attrib.pop("t-length")
el.attrib["t-out"] = el.attrib["t-out"] + "[:" + tlength + "]"
return super()._compile_directive_out(el, compile_context, level)
def _compile_directive_raw(self, el, compile_context, level):
# TODO: t-raw is deprecated, can it be removed?
min_value = el.attrib.pop("t-minlength", False) min_value = el.attrib.pop("t-minlength", False)
max_value = el.attrib.pop("t-maxlength", False) max_value = el.attrib.pop("t-maxlength", False)
if min_value or max_value: if min_value or max_value:
@@ -50,4 +69,4 @@ class IrQWeb(models.AbstractModel):
if "t-length" in el.attrib: if "t-length" in el.attrib:
tlength = el.attrib.pop("t-length") tlength = el.attrib.pop("t-length")
el.attrib["t-raw"] = el.attrib["t-raw"] + "[:" + tlength + "]" el.attrib["t-raw"] = el.attrib["t-raw"] + "[:" + tlength + "]"
return super()._compile_directive_raw(el, options, indent) return super()._compile_directive_raw(el, compile_context, level)

View File

@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Report QWeb Parameter</title> <title>Report QWeb Parameter</title>
<style type="text/css"> <style type="text/css">
/* /*
:Author: David Goodger (goodger@python.org) :Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $ :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain. :Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils. Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet. customize this style sheet.
*/ */
@@ -366,8 +366,10 @@ ul.auto-toc {
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6e50557d8d49cab3485b6aa968d1dbc2a8d55f1fd8cdc34b3b269db65edf9693
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/15.0/report_qweb_parameter"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-report_qweb_parameter"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/143/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/16.0/report_qweb_parameter"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_qweb_parameter"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to add new parameters on QWeb reports. <p>This module allows you to add new parameters on QWeb reports.
Currently, we have defined a field maximum on a report and a validation of Currently, we have defined a field maximum on a report and a validation of
maximal and minimal size. maximal and minimal size.
@@ -378,18 +380,18 @@ length and format must be validated in several fields in order to send an invoic
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li> <li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li> <li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul> <li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li> <li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li> <li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li> <li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1> <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Add a t-length attribute on report templates fields that will truncate the field</li> <li>Add a t-length attribute on report templates fields that will truncate the field</li>
<li>Add a t-minlength attribute on report template fields that will check the min length</li> <li>Add a t-minlength attribute on report template fields that will check the min length</li>
@@ -397,23 +399,23 @@ length and format must be validated in several fields in order to send an invoic
</ol> </ol>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1> <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_qweb_parameter%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_qweb_parameter%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
<h1><a class="toc-backref" href="#id3">Credits</a></h1> <h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2> <h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Creu Blanca</li> <li>Creu Blanca</li>
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2> <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul> <ul>
<li><p class="first">Enric Tobella &lt;<a class="reference external" href="mailto:etobella&#64;creublanca.es">etobella&#64;creublanca.es</a>&gt;</p> <li><p class="first">Enric Tobella &lt;<a class="reference external" href="mailto:etobella&#64;creublanca.es">etobella&#64;creublanca.es</a>&gt;</p>
</li> </li>
@@ -429,13 +431,13 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2> <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p> <p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/15.0/report_qweb_parameter">OCA/reporting-engine</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/16.0/report_qweb_parameter">OCA/reporting-engine</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@@ -5,14 +5,14 @@ import xml.etree.ElementTree as ET
from odoo.tests import common from odoo.tests import common
from odoo.addons.base.models.qweb import QWebException from odoo.addons.base.models.ir_qweb import QWebException
class TestReportQWebParameter(common.TransactionCase): class TestReportQWebParameter(common.TransactionCase):
def test_qweb_parameter(self): def test_qweb_parameter(self):
report_name = "report_qweb_parameter.test_report_length" report_name = "report_qweb_parameter.test_report_length"
report_obj = self.env["ir.actions.report"] report_obj = self.env["ir.actions.report"]
report_object = report_obj._get_report_from_name(report_name) report_object = report_obj
docs = self.env["res.company"].create( docs = self.env["res.company"].create(
{ {
"name": "Test company", "name": "Test company",
@@ -22,19 +22,20 @@ class TestReportQWebParameter(common.TransactionCase):
} }
) )
docs.website = "1234567890" # for avoding that Odoo adds http:// docs.website = "1234567890" # for avoding that Odoo adds http://
rep = report_object._render(docs.ids, False) rep = report_object._render(report_name, docs.ids, False)
root = ET.fromstring(rep[0]) root = ET.fromstring(rep[0])
self.assertEqual(root[0].text, "1234567890") self.assertEqual(root[0].text, "1234567890")
self.assertEqual(root[2].text, "1234567890") self.assertEqual(root[2].text, "1234567890")
self.assertEqual(root[4].text, "1234567890")
docs.update({"street": "123456789"}) docs.update({"street": "123456789"})
with self.assertRaises(QWebException): with self.assertRaises(QWebException):
report_object._render(docs.ids, False) report_object._render(report_name, docs.ids, False)
docs.update({"street": "1234567890", "vat": "123456789"}) docs.update({"street": "1234567890", "vat": "123456789"})
with self.assertRaises(QWebException): with self.assertRaises(QWebException):
report_object._render(docs.ids, False) report_object._render(report_name, docs.ids, False)
docs.update({"vat": "1234567890", "website": "12345678901"}) docs.update({"vat": "1234567890", "website": "12345678901"})
with self.assertRaises(QWebException): with self.assertRaises(QWebException):
report_object._render(docs.ids, False) report_object._render(report_name, docs.ids, False)
docs.update({"website": "1234567890", "company_registry": "12345678901"}) docs.update({"website": "1234567890", "company_registry": "12345678901"})
with self.assertRaises(QWebException): with self.assertRaises(QWebException):
report_object._render(docs.ids, False) report_object._render(report_name, docs.ids, False)