Base_report_cn模块支持openerp-5.0.6 和2009基于小企业会计制度-会计科目表
-
我安装了 base_report_cn.zip 后,打印时出现这个错误:
TTFError: Can't open file "c:program filesopenerp allinoneserveraddonsbase_report_cnfontssimsun.ttf"不知道有谁碰到过,怎么解决?
-
这个已经好了,解开 addon的目录就好了,不过还是不能打印
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.zipbase_report_cn__init_.py", line 80, 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' -
请使用网友sagas所提供的版本, www.shine-it.net/viewthread.php?tid=447&page=2#pid2402
#1楼的版本会出现部分替换的情况,比如当原字体是Helvetica-Oblique, 按理说要将其替换为SimHei,但是因为__init__.py中的convert2TrueType函数首先将Helvetica-Oblique中的Helvetica替换为了SimHei,所以就会导致楼上描述的错误出现。网友bhikkhu 在 www.openobject.com/forum/topic12813.html 中对此问题有详细描述,并且给出了他的解决方法。我认为Sagas的方法更直接些,速度也应该更快些。
-
谢谢 digitalsator
搞定了,我的汉化基本搞定了,现在基本具备开发条件了。
-
单据打印还是出错(销售单打印):
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楼的模块试试。