OCA/reporting-engine

[report_qweb_parameter] Error when create new file Factura-E

Closed this issue · 2 comments

Module

report_qweb_parameter
l10n_es_facturae

Describe the bug

When I created new file of Factura-E there is a exception caused by report_qweb_parameter like this:

  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 219, in render_template
    yield from compiled_fn(self, values, log)
  File "<template_810>", line 28, in template_810
  File "/mnt/extra-addons/report_qweb_parameter/models/ir_qweb.py", line 13, in check_length
    if min_length and len(value) < min_length:
TypeError: object of type 'bool' has no len()

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. Install modules and all dependencies for l10n_es_facturae (report_qweb_parameter is included)
  2. Create new invoice
  3. Create new file "Factura-E"
  4. Push 'Export' button

Expected behavior
Export Factura-E file

Additional context
Error code:

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 219, in render_template
    yield from compiled_fn(self, values, log)
  File "<template_810>", line 28, in template_810
  File "/mnt/extra-addons/report_qweb_parameter/models/ir_qweb.py", line 13, in check_length
    if min_length and len(value) < min_length:
TypeError: object of type 'bool' has no len()

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 688, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 360, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 349, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 917, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 536, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1352, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1340, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 464, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 451, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/mnt/extra-addons/l10n_es_facturae/wizard/create_facturae.py", line 65, in create_facturae_file
    move_file = self.env.ref("l10n_es_facturae.report_facturae")._render(
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 911, in _render
    return render_func(res_ids, data=data)
  File "/mnt/extra-addons/report_xml/models/ir_actions_report.py", line 59, in _render_qweb_xml
    content, ttype = report_model.generate_report(
  File "/mnt/extra-addons/report_xml/reports/report_report_xml_abstract.py", line 54, in generate_report
    result_bin = ir_report._render_template(ir_report.report_name, data)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 615, in _render_template
    return view_obj._render_template(template, values).encode()
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 1975, in _render_template
    return self.browse(self.get_view_id(template))._render(values, engine)
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_ui_view.py", line 29, in _render
    return super(IrUiView, self)._render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 1983, in _render
    return self.env[engine]._render(self.id, qcontext)
  File "/usr/lib/python3/dist-packages/odoo/tools/profiler.py", line 289, in _tracked_method_render
    return method_render(self, template, values, **options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb.py", line 76, in _render
    result = super()._render(template, values=values, **compile_options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 134, in _render
    result = ''.join(rendering)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 221, in render_template
    raise e
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 219, in render_template
    yield from compiled_fn(self, values, log)
  File "<template_812>", line 1728, in template_812
  File "<template_812>", line 225, in t_call_content
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 223, in render_template
    raise QWebException("Error when render the template", self, options,
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 644, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 302, in _handle_exception
    raise exception.with_traceback(None) from new_cause
odoo.addons.base.models.qweb.QWebException: object of type 'bool' has no len()
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 219, in render_template
    yield from compiled_fn(self, values, log)
  File "<template_810>", line 28, in template_810
  File "/mnt/extra-addons/report_qweb_parameter/models/ir_qweb.py", line 13, in check_length
    if min_length and len(value) < min_length:
TypeError: object of type 'bool' has no len()

Error when render the template
TypeError: object of type 'bool' has no len()
Template: l10n_es_facturae.entity
Path: /t/TaxIdentification/TaxIdentificationNumber
Node: <TaxIdentificationNumber t-minlength="3" t-length="30" t-esc="partner.vat"/>
        

This has nothing to do with this module. The problem is a missing VAT in your side.

True! Company VAT numbers were empty.
Thanks a lot!