Odoo Help

0

Exception: 'NoneType' object has no attribute 'tag' RepeatIn

By
ELIASS BENFATEH
on 4/11/16, 5:43 AM 670 views

Please i am using rml to create a new report in OpenERP. So that i use in my rml this code to create for each result a new td but the problem is that i got Exception: 'NoneType' object has no attribute 'tag' as an error. Here is my code:
in python:

def gross_wage_line(self, salary_line_ids) :

list=[ ]

for line in salary_line_ids :

        if line.type == 'brute' and line.afficher:

                  if line.deductible:

                         gain=0

                         retenu=float(line.subtotal_employee)

                  else:

                       gain=float(line.subtotal_employee)

                      retenu=0

               dict={'name' : line.name,

                          'base' : line.base,

                          'rate_employee' : float(line.rate_employee),

                          'gain' : gain,

                          'retenu': retenu,

                         }

                  list.append(dict)

            return list


In RML:

<section>

<para style="P1">[[ repeatIn(gross_wage_line(s.salary_line_ids),'line') ]]</para>

<blockTable colWidths="206.0,53.0,41.0,38.0,47.0,42.0,55.0" style="Table6">

<tr>

<td>

<para style="P22">[[ line['name'] ]]</para>

</td>

<td>

<para style="P24">[[ str(line['base']) ]]</para>

</td>

<td>

<para style="P13">[[ line['rate_employee'] ]]</para>

</td>

<td>

<para style="P24">[[ line['gain'] or '']]</para>

</td>

<td>

<para style="P24">[[ line['retenu'] or '' ]]</para>

</td>

<td>

<para style="P20">

<font color="white"> </font>

</para>

</td>

<td>

<para style="P20">

<font color="white"> </font>

</para>

</td>

</tr>

</blockTable>

</section>

l'error is :

"name 'gross_wage_line' is not defined" while evaluating"repeatIn(gross_wage_line(s.salary_line_ids),'line')"<type 'exceptions.ValueError'>,"name 'gross_wage_line' is not defined" while evaluating"repeatIn(gross_wage_line(s.salary_line_ids),'line')",<traceback object at 0x7f8186722320>

Can someone help me

0
Axel Mendoza
On 4/11/16, 9:35 AM

That python function should be defined in a report parser so after everything is correct and the parser is used that error will vanish. I personally recommends you to switch to QWEB based reports instead of use RML ones.

Here you can see how to define parsers (https://www.odoo.com/es_ES/forum/ayuda-1/question/how-to-define-a-custom-methods-functions-to-be-used-in-a-qweb-report-how-to-define-and-use-a-report-parser-92244), without the last report Transient model (for QWEB) you could finish your parser registration using something like this complete example:

import time

from openerp.report import report_sxw

class annual_parser(report_sxw.rml_parse):

def _get_calendar(self, string):

if string:

return string.replace("\n", ", ")

return ""

def __init__(self, cr, uid, name, context=None):

super(annual_parser, self).__init__(cr, uid, name, context=context)

self.localcontext.update({

'time': time,

'_get_calendar': self._get_calendar

})

report_sxw.report_sxw('report.Annual_Maintenance_Plan', 'solt.maintenance.plan', 'solt_maintenance_plan/report/solt_maintenance_plan_annual_report.rml', parser=annual_parser, header="False")


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 4/11/16, 5:43 AM
Seen: 670 times
Last updated: 4/11/16, 9:35 AM