Browse Source

[MIG] report_qweb_parameter: Migration to 11.0

myc-14.0-py3o
Enric Tobella 7 years ago
committed by Francisco Ivan Anton Prieto
parent
commit
025c3da28e
  1. 4
      report_qweb_parameter/README.rst
  2. 2
      report_qweb_parameter/__init__.py
  3. 9
      report_qweb_parameter/__manifest__.py
  4. 8
      report_qweb_parameter/demo/test_report_field_length.xml
  5. 41
      report_qweb_parameter/i18n/fr.po
  6. 37
      report_qweb_parameter/i18n/report_qweb_parameter.pot
  7. 2
      report_qweb_parameter/models/__init__.py
  8. 2
      report_qweb_parameter/models/ir_qweb.py
  9. 2
      report_qweb_parameter/tests/__init__.py
  10. 34
      report_qweb_parameter/tests/test_report_qweb_parameter.py

4
report_qweb_parameter/README.rst

@ -1,5 +1,5 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
===================== =====================
@ -24,7 +24,7 @@ Usage
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/143/10.0
:target: https://runbot.odoo-community.org/runbot/143/11.0
Bug Tracker Bug Tracker

2
report_qweb_parameter/__init__.py

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models from . import models

9
report_qweb_parameter/__manifest__.py

@ -1,11 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2017 Creu Blanca # Copyright 2017 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
# noinspection PyStatementEffect
{ {
"name": "Report QWeb Parameter", "name": "Report QWeb Parameter",
"version": "10.0.1.0.1",
"version": "11.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
@ -16,9 +15,7 @@
"website": "https://github.com/oca/reporting-engine", "website": "https://github.com/oca/reporting-engine",
"category": "Technical Settings", "category": "Technical Settings",
"depends": [ "depends": [
"report",
],
"data": [
"web",
], ],
"demo": [ "demo": [
"demo/test_report_field_length.xml" "demo/test_report_field_length.xml"

8
report_qweb_parameter/demo/test_report_field_length.xml

@ -5,14 +5,14 @@
id="test_report_length_report_id" id="test_report_length_report_id"
model="res.company" model="res.company"
string="Length Report" string="Length Report"
report_type="qweb-pdf"
report_type="qweb-html"
name="report_qweb_parameter.test_report_length" name="report_qweb_parameter.test_report_length"
/> />
<template id="test_report_length"> <template id="test_report_length">
<t t-call="report.html_container">
<data>
<li name="esc_length" t-minlength="10" t-length="10" <li name="esc_length" t-minlength="10" t-length="10"
t-esc="docs[0].fax" t-if="docs[0].fax"/>
t-esc="docs[0].street" t-if="docs[0].street"/>
<li name="esc_maxlength" t-maxlength="10" <li name="esc_maxlength" t-maxlength="10"
t-esc="docs[0].website" t-if="docs[0].website"/> t-esc="docs[0].website" t-if="docs[0].website"/>
<li name="raw_length" t-minlength="10" t-length="10" <li name="raw_length" t-minlength="10" t-length="10"
@ -20,6 +20,6 @@
<li name="raw_maxlength" t-maxlength="10" <li name="raw_maxlength" t-maxlength="10"
t-raw="docs[0].company_registry" t-raw="docs[0].company_registry"
t-if="docs[0].company_registry"/> t-if="docs[0].company_registry"/>
</t>
</data>
</template> </template>
</odoo> </odoo>

41
report_qweb_parameter/i18n/fr.po

@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_qweb_parameter
#
# Translators:
# Nicolas JEUDY <njeudy@panda-chi.io>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-05 17:53+0000\n"
"PO-Revision-Date: 2018-01-05 17:53+0000\n"
"Last-Translator: Nicolas JEUDY <njeudy@panda-chi.io>, 2018\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: report_qweb_parameter
#: model:ir.actions.report,name:report_qweb_parameter.test_report_length_report_id
msgid "Length Report"
msgstr "Longueur du rapport "
#. module: report_qweb_parameter
#: code:addons/report_qweb_parameter/models/ir_qweb.py:16
#, python-format
msgid "Length cannot be less than %s"
msgstr "La longueur du rapport ne peut pas être inférieure à %s"
#. module: report_qweb_parameter
#: code:addons/report_qweb_parameter/models/ir_qweb.py:19
#, python-format
msgid "Length cannot be more than %s"
msgstr "La longueur du rapport ne peut pas être supérieure à %s"
#. module: report_qweb_parameter
#: model:ir.model,name:report_qweb_parameter.model_ir_qweb
msgid "ir.qweb"
msgstr "ir.qweb"

37
report_qweb_parameter/i18n/report_qweb_parameter.pot

@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * report_qweb_parameter
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: report_qweb_parameter
#: model:ir.actions.report,name:report_qweb_parameter.test_report_length_report_id
msgid "Length Report"
msgstr ""
#. module: report_qweb_parameter
#: code:addons/report_qweb_parameter/models/ir_qweb.py:16
#, python-format
msgid "Length cannot be less than %s"
msgstr ""
#. module: report_qweb_parameter
#: code:addons/report_qweb_parameter/models/ir_qweb.py:19
#, python-format
msgid "Length cannot be more than %s"
msgstr ""
#. module: report_qweb_parameter
#: model:ir.model,name:report_qweb_parameter.model_ir_qweb
msgid "ir.qweb"
msgstr ""

2
report_qweb_parameter/models/__init__.py

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import ir_qweb from . import ir_qweb

2
report_qweb_parameter/models/ir_qweb.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2017 Creu Blanca # Copyright 2017 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models, _ from odoo import models, _
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError

2
report_qweb_parameter/tests/__init__.py

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_report_qweb_parameter from . import test_report_qweb_parameter

34
report_qweb_parameter/tests/test_report_qweb_parameter.py

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2017 Creu Blanca # Copyright 2017 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
@ -10,40 +10,40 @@ from odoo.tests import common
class TestReportQWebParameter(common.TransactionCase): class TestReportQWebParameter(common.TransactionCase):
def test_qweb_parameter(self): def test_qweb_parameter(self):
report_object = self.env['ir.actions.report.xml']
report_name = 'report_qweb_parameter.test_report_length' report_name = 'report_qweb_parameter.test_report_length'
report_obj = self.env['ir.actions.report']
report_object = report_obj._get_report_from_name(report_name)
docs = self.env['res.company'].search([], limit=1) docs = self.env['res.company'].search([], limit=1)
vat = docs.vat vat = docs.vat
website = docs.website website = docs.website
fax = docs.fax
street = docs.street
company_registry = docs.company_registry company_registry = docs.company_registry
docs.update({ docs.update({
'fax': '12345678901',
'street': '12345678901',
'vat': '12345678901', 'vat': '12345678901',
'website': '1234567890', 'website': '1234567890',
'company_registry': '1234567890' 'company_registry': '1234567890'
}) })
rep = report_object.render_report(docs.ids, report_name, False)
root = ET.fromstring(
rep[0]
)
self.assertEqual(root[1][0][0][0].text, "1234567890")
self.assertEqual(root[1][0][0][2].text, "1234567890")
docs.update({'fax': '123456789'})
rep = report_object.render(docs.ids, False)
root = ET.fromstring(rep[0])
self.assertEqual(root[0].text, "1234567890")
self.assertEqual(root[2].text, "1234567890")
docs.update({'street': '123456789'})
with self.assertRaises(QWebException): with self.assertRaises(QWebException):
report_object.render_report(docs.ids, report_name, False)
docs.update({'fax': '1234567890', 'vat': '123456789'})
report_object.render(docs.ids, False)
docs.update({'street': '1234567890', 'vat': '123456789'})
with self.assertRaises(QWebException): with self.assertRaises(QWebException):
report_object.render_report(docs.ids, report_name, False)
report_object.render(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_report(docs.ids, report_name, False)
report_object.render(docs.ids, False)
docs.update( docs.update(
{'website': '1234567890', 'company_registry': '12345678901'}) {'website': '1234567890', 'company_registry': '12345678901'})
with self.assertRaises(QWebException): with self.assertRaises(QWebException):
report_object.render_report(docs.ids, report_name, False)
report_object.render(docs.ids, False)
docs.update({ docs.update({
'fax': fax,
'street': street,
'vat': vat, 'vat': vat,
'website': website, 'website': website,
'company_registry': company_registry 'company_registry': company_registry

Loading…
Cancel
Save