我使用OpenOffice Write创建了自己的销售/报价报告caleed sale_order.sxw。从那里我生成sale_order.rml文件。
我有两个OpenERP安装,一个安装在Windows上,另一个安装在Ubuntu上。
在OOWriter中,我有一个4列表,打印出每个单一订单行以及数量,“打印此”文本和小计。
根据包含“final”的价格表名称,仅在满足特定条件时才打印出第三列:
所以我希望:
如果“final”不在价目表中
产品A | 2 |打印本| 20
如果“final”位于价目表中:
产品A | 2 | 20
要解决此问题,我有以下代码:
(so.partner_id.property_product_pricelist.name.find('final') > 0) and "Print this" or removeParentNode('td')
从Windows安装中可以正常工作。
但是当我从Ubuntu安装中运行相同的文件时,我收到一条AssertionError消息,我无法打印出我的销售/报价pdf报告。
我专门用removeParentNode('td')进行了一些测试,错误似乎来自那里,但我无法理解为什么它在windows下工作!
以下是来自Ubuntu服务器的日志:
2013-04-15 13:09:07,822 1621 ERROR ? openerp.service.web_services: Exception:
Traceback (most recent call last):
File "/home/download/openerp-6.1-20121008-233119/openerp/service/web_services.py", line 727, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/report_sxw.py", line 442, in create
fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/report_sxw.py", line 511, in create_source_pdf
return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/report_sxw.py", line 533, in create_single_pdf
pdf = create_doc(etree.tostring(processed_rml),rml_parser.localcontext,logo,title.encode('utf8'))
File "/home/download/openerp-6.1-20121008-233119/openerp/report/interface.py", line 207, in create_pdf
obj.render()
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/render.py", line 59, in render
self._result = self._render()
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml.py", line 41, in _render
return rml2pdf.parseNode(self.rml, self.localcontext, images=self.bin_datas, path=self.path,title=self.title)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 1007, in parseNode
r.render(fp)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 314, in render
pt_obj.render(el)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 983, in render
fis += r.render(node_story)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 877, in render
return process_story(node_story)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 870, in process_story
flow = self._flowable(node)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 834, in _flowable
return self.render(node)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 877, in render
return process_story(node_story)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 870, in process_story
flow = self._flowable(node)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 793, in _flowable
return self._table(node)
File "/home/download/openerp-6.1-20121008-233119/openerp/report/render/rml2pdf/trml2pdf.py", line 697, in _table
assert length == len(node.get('colWidths').split(','))
AssertionError
2013-04-15 13:09:07,951 1621 ERROR ? openerp.netsvc:
(<type 'exceptions.AssertionError'>, AssertionError(), <traceback object at 0x7ff558e54b00>)
2013-04-15 13:09:07,953 1621 INFO ? werkzeug: 192.168.2.4 - - [15/Apr/2013 13:09:07] "POST /web/report HTTP/1.1" 500 -
我对服务器上使用的trml2pdf.py文件和windows使用的文件进行了比较,它们是相同的。
答案 0 :(得分:0)
这是因为原始列不匹配。