Search code examples
odoorml

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


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:

    <tr>
    <para style="P7">[[ repeatIn(get_employee_lines(), 'o', 'td') ]]</para> 
  <td> 
    <para style="P9">NOM EMPLOYÉ</para>
  </td>

    <td>
      <para style="P7">[[ o['name'] ]]</para>
    </td>
</tr>

So, please who can help me to find the solution really need help. Here is all the error:

 2015-09-01 10:21:45,562 6030 ERROR openerp openerp.service.web_services:    Exception: 'NoneType' object has no  attribute 'tag'
Traceback (most recent call last):
  File "/opt/openerp/v7/server/openerp/service/web_services.py", line 712, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
  File "/opt/openerp/v7/server/openerp/report/report_sxw.py", line 443, in create
    fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
  File "/opt/openerp/v7/server/openerp/report/report_sxw.py", line 512, in create_source_pdf
    return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
  File "/opt/openerp/v7/server/openerp/report/report_sxw.py", line 530, in create_single_pdf
    processed_rml = self.preprocess_rml(processed_rml,report_xml.report_type)
  File "/opt/openerp/v7/server/openerp/report/preprocess.py", line 82, in preprocess_rml
self.preprocess_rml(node,type)
  File "/opt/openerp/v7/server/openerp/report/preprocess.py", line 82, in preprocess_rml
    self.preprocess_rml(node,type)
  File "/opt/openerp/v7/server/openerp/report/preprocess.py", line 82, in preprocess_rml
self.preprocess_rml(node,type)
  File "/opt/openerp/v7/server/openerp/report/preprocess.py", line 77, in preprocess_rml
t = _regex1.sub(_sub1, node.text or node.tail)
  File "/opt/openerp/v7/server/openerp/report/preprocess.py", line 73, in _sub1
while n.tag not in match:
AttributeError: 'NoneType' object has no attribute 'tag'
2015-09-01 10:21:45,793 6030 ERROR openerp openerp.netsvc: 'NoneType' object     has no attribute 'tag'
(<type 'exceptions.AttributeError'>, AttributeError("'NoneType' object has no attribute 'tag'",), <traceback object at 0x7fdea5a5c950>)
Traceback (most recent call last):
  File "/opt/openerp/v7/server/openerp/netsvc.py", line 296, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
  File "/opt/openerp/v7/server/openerp/service/web_services.py", line 654, in dispatch
res = fn(db, uid, *params)
  File "/opt/openerp/v7/server/openerp/service/web_services.py", line 760, in exp_report_get
return self._check_report(report_id)
  File "/opt/openerp/v7/server/openerp/service/web_services.py", line 738, in _check_report
netsvc.abort_response(exc, exc.message, 'warning', exc.traceback)
  File "/opt/openerp/v7/server/openerp/netsvc.py", line 71, in abort_response
raise openerp.osv.osv.except_osv(description, details)
except_osv: (u"'NoneType' object has no attribute 'tag'", (<type     'exceptions.AttributeError'>, AttributeError("'NoneType' object has no     attribute 'tag'",), <traceback object at 0x7fdea5a5c950>))

Solution

  • Here is the answer.

    First, i had to change the version of my OpenOffice which is v4.1.X.

    Second, i used [[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end), 'o', 'td') ]] which Loop on every line and make a new table cell for each line. So here is the right answer:

        <tr>
          <td>
             <para style="P8">NOM EMPLOYÉ</para>
          </td>
          <td>
          <para style="P7">[[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.d              ate_end), 'o', 'td') ]]</para>
           <para style="P7">[[ o['name'] ]]</para>
          </td>
          </tr>
    

    Best Regards.