Base_report_cn模块支持openerp-5.0.6 和2009基于小企业会计制度-会计科目表
-
单据打印还是出错(销售单打印):
Environment Information :
System : Windows-XP-5.1.2600-SP3
OS Name : nt
Operating System Release : XP
Operating System Version : 5.1.2600
Operating System Architecture : 32bit
Operating System Locale : zh_CN.cp936
Python Version : 2.5.2
OpenERP-Client Version : 5.0.6
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File "serviceweb_services.pyo", line 687, in go
File "reportreport_sxw.pyo", line 364, in create
File "reportreport_sxw.pyo", line 421, in create_source_pdf
File "reportreport_sxw.pyo", line 439, in create_single_pdf
File "reportinterface.pyo", line 199, in create_pdf
File "reportrenderrender.pyo", line 50, in render
File "reportrenderrml.pyo", line 41, in render
File "C:Program FilesOpenERP AllInOneServeraddonsbase_report_cn.zipbase_report_cn__init_.py", line 88, in convert2TrueType
File "reportrenderrml2pdftrml2pdf.pyo", line 780, in parseNode
File "reportrenderrml2pdftrml2pdf.pyo", line 195, in render
File "reportrenderrml2pdftrml2pdf.pyo", line 774, in render
File "reportlabplatypusdoctemplate.pyo", line 782, in build
File "reportlabplatypusdoctemplate.pyo", line 724, in _endBuild
File "reportlabpdfgencanvas.pyo", line 881, in save
File "reportlabpdfbasepdfdoc.pyo", line 219, in SaveToFile
File "reportlabpdfbasepdfdoc.pyo", line 231, in GetPDFData
File "reportlabpdfbasettfonts.pyo", line 1104, in addObjects
File "reportlabpdfbasepdfdoc.pyo", line 484, in Reference
ValueError: redefining named object: 'toUnicodeCMap:AAAAAA+WenQuanYiZenHei' -
按这里换了个 init.py [url=redirect.php?tid=614&]http];goto=lastpost
单据可以打印出来汉字,但是 打印产品标签 出错:
Environment Information :
System : Windows-XP-5.1.2600-SP3
OS Name : nt
Operating System Release : XP
Operating System Version : 5.1.2600
Operating System Architecture : 32bit
Operating System Locale : zh_CN.cp936
Python Version : 2.5.2
OpenERP-Client Version : 5.0.6
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File "serviceweb_services.pyo", line 687, in go
File "reportinterface.pyo", line 100, in create
File "reportinterface.pyo", line 199, in create_pdf
File "reportrenderrender.pyo", line 50, in render
File "reportrenderrml.pyo", line 41, in render
File "C:Program FilesOpenERP AllInOneServeraddonsbase_report_cn__init_.py", line 86, in convert2TrueType
File "reportrenderrml2pdftrml2pdf.pyo", line 780, in parseNode
File "reportrenderrml2pdftrml2pdf.pyo", line 195, in render
File "reportrenderrml2pdftrml2pdf.pyo", line 774, in render
File "reportlabplatypusdoctemplate.pyo", line 756, in build
File "reportlabplatypusdoctemplate.pyo", line 649, in handle_flowable
File "reportlabplatypusframes.pyo", line 174, in _add
File "reportlabplatypusflowables.pyo", line 102, in drawOn
File "reportlabplatypusflowables.pyo", line 86, in _drawOn
File "reportlabplatypustables.pyo", line 1282, in draw
File "reportlabplatypustables.pyo", line 1361, in _drawCell
File "reportlabpdfgencanvas.pyo", line 1306, in setFont
File "reportlabpdfbasepdfmetrics.pyo", line 659, in findFontAndRegister
File "reportlabpdfbasepdfmetrics.pyo", line 618, in getTypeFace
KeyError: 'SimHeiOblique' -
openERP的PDF报表用的是ReportLab的库,这个库2.0以前不支持任何亚洲字体,2.0以后支持唯一一种中文字体"STSong-Light"。如果只在报表中使用一种字体"STSong-Light",则可按下述方法解决中文报表问题,如果想使用更多字体,则复杂一些,可以参考本帖前面部分试试看(我没试过)。
1)在报表渲染代码中注册字体"STSong-Light"。代码修改如下:
openerp-server/report/render/rml2pdf/init.py 中加上下述3行代码:
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.cidfonts import UnicodeCIDFont
pdfmetrics.registerFont(UnicodeCIDFont('STSong-Light'))2) 修改所有.xsl、.rml文件中的字体成"STSong-Light"
待改字体列表:
Times-Roman
Times-BoldItalic
Times-Bold
Times-Italic
Helvetica-BoldOblique
Helvetica-Bold
Helvetica
Courier-Bold
Courier3)如果是win版的AllinOne的安装版,则代码openerp-server/report/render/rml2pdf/init.py在安装目录下的library.zip中,必须解开该包,手工替换该文件对应的.pyo。为了方便大家,我下面贴上替换好了的library.zip,在winXP AllInOne 5.06版验证没问题。
4) openERP的多数报表是基于RML文件渲染成PDF的,如果想修改报表格式,要找到对应的RML文件,修改它即可。RML类似于HTML,格式不难理解。为了便于大家工作,上传收集到的一份RML格式参考文档。
5)openERP还有部分报表是.xsl 格式的,这就是为什么前面还要改.xsl 文件的字体。关于.xsl的格式问题,网上资料很多。
-
[quote author=NewZN link=topic=713.msg3261#msg3261 date=1260344275]
报表头和尾的公司名等内容,其格式在代码中,必须修改代码:
“addonsbaseresres_company.py” 的 “_get_header”和 “_get_header2 ”。将其中的字体改成“STSong-Light”,升级base模块即生效。
[/quote]
你好,我想问下现在在V6里面如何让报表头和尾的内容中文化,现在其他都搞定了,但是头和尾还是黑方块, 谢谢 -
OK, 知道了~在其他的地方找到答案了:)
表头,表尾的字体在系统管理->公司->公司中定义 -
请下载使用 [检测到链接无效,已移除] #7楼的模块试试。