Skip to Content
Menu
This question has been flagged
1 Reply
3305 Views

Hello,

I'm a beginner, but I want to customize myself "employee" odoo module.

My view work fine, but I cant't create a custom report. Always the same error : IndexError: list index out of range

I try to found on the forum, but no solution....

Can somebody help me ?


ERROR :

Erreur:
Odoo Server Error

Traceback (most recent call last):
  File "/opt/odoo13/odoo/addons/web/controllers/main.py", line 2025, in report_download
    response = self.report_routes(reportname, docids=docids, converter=converter, context=context)
  File "/opt/odoo13/odoo/odoo/http.py", line 515, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo13/odoo/addons/web/controllers/main.py", line 1963, in report_routes
    pdf = report.with_context(context).render_qweb_pdf(docids, data=data)[0]
  File "/opt/odoo13/odoo/odoo/addons/base/models/ir_actions_report.py", line 739, in render_qweb_pdf
    bodies, html_ids, header, footer, specific_paperformat_args = self.with_context(context)._prepare_html(html)
  File "/opt/odoo13/odoo/odoo/addons/base/models/ir_actions_report.py", line 355, in _prepare_html
    body_parent = root.xpath('//main')[0]
IndexError: list index out of range

_manifest_.py

{
    'name': 'Gestion du personnel ',
    'version': '1.0',
    'category': '',
    'sequence': 5,
    'summary': 'Module gestion personnel pour - modification du module employé existant',
    'description': "Module de gestion du personnel et sous traitants",
    'website': 'https://www.dimdim.be',
    'depends':['base','hr','fetchmail','digest','mail',],
    'data': [
#    
                'views/custom_employees_view.xml',
                'reports/fiche_collaborateur.xml',
            ],
    'demo': [
        '',
    ],
    'css': [''],
    'installable': True,
    'application': False,
    'auto_install': False
}


fiche_collaborateur.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
  <data>
    <report
        id="fiche_collaborateur"
        string="Fiche Collaborateur"
        model="hr.employee"
        report_type="qweb-pdf"
        name="custom_employees.fiche_collaborateur"
        file="custom_employees.fiche_collaborateur"
        attachment="object.name"/>

    <template id="hr_fiche_collaborateur">
          <t t-call="web.html_container">
            <t t-call="web.external_layout">
            <t t-foreach="docs" t-as="o">
             <div class="page">
                    <h1 class="text-center">FICHE COLLABORATEUR</h1>
                    <span t-field="o.NISS"/>
             </div>
            </t>
            </t>
          </t>
        
    </template>
  </data>
</odoo>


Avatar
Discard
Best Answer

See this: https://www.youtube.com/watch?v=SkKAXURqNfQ&t=1s&ab_channel=OdooMates

Avatar
Discard
Related Posts Replies Views Activity
4
Aug 18
6509
1
Jun 23
1284
0
Mar 22
4780
0
Sep 21
1367
0
May 21
4