-1

请我使用 rml 在 OpenERP 中创建一个新报告。所以我在我的 rml 中使用这段代码为每个结果创建一个新的 td,但问题是我得到了 Exception: 'NoneType' object has no attribute 'tag' 作为错误。这是我的代码:

    <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>

所以,请谁能帮我找到真正需要帮助的解决方案。这是所有错误:

 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>))
4

1 回答 1

0

这是答案。

首先,我必须更改我的 OpenOffice 版本,即 v4.1.X。

其次,我使用 [[ repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_end), 'o', 'td') ]] 在每一行上循环并为每一行创建一个新的表格单元格。所以这是正确的答案:

    <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>

最好的祝福。

于 2015-09-03T09:56:22.620 回答