2015-09-01 61 views
-1

請使用rml在OpenERP中創建一個新報告。 因此,我在我的rml中使用此代碼爲每個結果創建一個新的td,但問題是我得到異常:'NoneType'對象沒有屬性'標記'作爲錯誤。 這裏是我的代碼:例外:'NoneType'對象沒有'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>)) 
+1

這個問題得到回答[這裏] [1] [1]:http://stackoverflow.com/questions/8949252/python-attribute-error-nonetype-object-has-no-attribute - 什麼東西 – mryuso92

+0

其同樣的錯誤,但不是一回事。這是由於重複中的td,所以我想知道如何在rml中使用它 –

+0

歡迎來到SO。這不是錯誤轉儲。請在此提出明確的問題。只是發佈你的代碼希望其他人調試它也不理解。 – Adriaan

回答

0

這是答案。

首先,我必須更改我的OpenOffice版本,它是v4.1.X.

第二,我用[[repeatIn(get_employee_lines(example.company_id,example.date_start,example.date_id),'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> 

最好的問候。

相關問題