Ciao ragazzi,
devo stampare su di una stampante toshiba tec b452 un po datata ma che stampa su dei cartellini piccolissimi.
Tale stampante accetta una serie di comandi del genere che venivano inviati alla stampante tramite questo comando
copy stampa.prn \ipserver\tecb452
dove stampa.prn conteneva i comandi della stampante di questo genere.
{PC01;0025,0050,05,05,A,00,B|}
{PC02;0020,0098,05,05,D,00,B|}
{PC03;0125,0098,05,05,A,00,B|}
Adesso ravanando un po in giro [1] mi pare di capire che il metodo più veloce per mandare direttamente alla stampante un tale report sia aeroo che usa un formato in uscita di tipo genshi-raw.
ho creato l'xml in questa maniera.
<record id="product_label_toshibatec_id" model="ir.actions.report.xml">
<field name="name">product_label_toshibatec_b452</field>
<field name="type">ir.actions.report.xml</field>
<field name="model">product.product</field>
<field name="report_name">product_label</field>
<field name="report_type">aeroo</field>
<field name="in_format">genshi-raw</field>
<!--
<field name="parser_loc">default</field>
-->
<field name="report_rml">product_label_toshibatecb452/report/product_label_template.txt</field>
<field name="parser_state">default</field>
<field name="tml_source">file</field>
</record>
<ir_set>
<field eval="'action'" name="key"/>
<field eval="'client_print_multi'" name="key2"/>
<field eval="['product.product']" name="models"/>
<field name="name">product_label_toshibatec_b452</field>
<field eval="'ir.actions.report.xml,'+str(product_label_toshibatec_id)" name="value"/>
<field eval="True" name="isobject"/>
<field eval="True" name="replace"/>
</ir_set>
</data>
il bottone mi appare correttamente, dentro il report ci sta semplicemente
"${o.name}"
ma mi appare sempre questo errore:
012-06-04 18:16:02,798 7498 ERROR ? openerp.service.web_services: Exception: File is not a zip file
Traceback (most recent call last):
File "/mnt/dati/openerp/openerp6.1/server/openerp/service/web_services.py", line 727, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/mnt/dati/openerp/openerp6.1/openerp-addons/aeroo/report_aeroo/report_aeroo.py", line 679, in create
return fnct(cr, uid, ids, data, report_xml, context)
File "/mnt/dati/openerp/openerp6.1/openerp-addons/aeroo/report_aeroo/report_aeroo.py", line 625, in create_source_odt
return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
File "/mnt/dati/openerp/openerp6.1/openerp-addons/aeroo/report_aeroo/report_aeroo.py", line 472, in create_single_pdf
return self.create_aeroo_report(cr, uid, ids, data, report_xml, context=context, output=output)
File "/mnt/dati/openerp/openerp6.1/openerp-addons/aeroo/report_aeroo/report_aeroo.py", line 387, in create_aeroo_report
serializer = OOSerializer(template_io, oo_styles=style_io)
File "/mnt/dati/openerp/openerp6.1/lib/python2.6/site-packages/aeroolib-1.0.0.RC4-py2.6.egg/aeroolib/plugins/opendocument.py", line 823, in __init__
self.inzip = zipfile.ZipFile(self.template)
File "/usr/lib/python2.6/zipfile.py", line 696, in __init__
self._GetContents()
File "/usr/lib/python2.6/zipfile.py", line 716, in _GetContents
self._RealGetContents()
File "/usr/lib/python2.6/zipfile.py", line 728, in _RealGetContents
raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file
2012-06-04 18:16:03,772 7498 ERROR ? openerp.netsvc: File is not a zip file
(<class 'zipfile.BadZipfile'>, BadZipfile('File is not a zip file',), <traceback object at 0x81a77e8>)
2012-06-04 18:16:03,773 7498 ERROR ? openerp.service.netrpc_server: netrpc: cannot deliver exception message to client
Traceback (most recent call last):
File "/mnt/dati/openerp/openerp6.1/server/openerp/service/netrpc_server.py", line 71, in run
valid_exception = Exception(netrpc_handle_exception_legacy(e))
File "/mnt/dati/openerp/openerp6.1/server/openerp/service/netrpc_server.py", line 93, in netrpc_handle_exception_legacy
return 'warning -- ' + e.name + '\n\n' + e.value
TypeError: coercing to Unicode: need string or buffer, tuple found
Mi chiedevo dove sto sbagliando o se questa è la strada giusta per un report del genere.
Grazie per ogni info
[1]
www.alistek.com/forum/viewtopic.php?f=11...92&hilit=zebra#p1092