[FIX] report_webkit: review and another series of fixes for certification of webkit report engine - see https://code.launchpad.net/~c2c/openobject-addons/trunk_webkit_addons/+merge/37829

bzr revid: odo@openerp.com-20101008143050-5fpxyt9nud4g5cg3
This commit is contained in:
Olivier Dony 2010-10-08 16:30:50 +02:00
parent c10c1e6ef7
commit f6faef13ff
25 changed files with 213 additions and 335 deletions

View File

@ -1,40 +0,0 @@
<openerp>
<data>
<record id="act_report_xml_view1" model="ir.ui.view">
<field name="name">ir.actions.report.xml.inherit1</field>
<field name="model">ir.actions.report.xml</field>
<field name="priority">16</field>
<field name="inherit_id" ref="base.act_report_xml_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="groups_id" position="replace" >
</field>
</field>
</record>
<record id="act_report_xml_view" model="ir.ui.view">
<field name="name">ir.actions.report.xml.inherit</field>
<field name="model">ir.actions.report.xml</field>
<field name="inherit_id" ref="base.act_report_xml_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="attachment_use" position="after" >
<notebook colspan="4">
<page string="Security">
<field colspan="4" name="groups_id"/>
</page>
<page string="Webkit Setup" >
<field name="webkit_debug" colspan="4"/>
<field name="webkit_header" select="2"/>
<field name="report_webkit" colspan="4"/>
<newline/>
<field name="report_webkit_data" colspan="4"/>
</page>
</notebook>
</field>
</field>
</record>
<!-- <wizard string="Add Print Buttons" model="ir.actions.report.xml" name="ir.report_actions" menu="True" id="wizard_oo_report_actions" />-->
</data>
</openerp>

View File

@ -30,9 +30,9 @@
############################################################################## ##############################################################################
{ {
"name" : "webkit report", "name" : "Webkit Report Engine",
"description" : """Report system base on WebKit engine (wkhtmltopd lib) that allows to do HTML2PDF reporting. "description" : """This module adds a new Report Engine based on WebKit library (wkhtmltopdf) to support reports designed in HTML + CSS.
The module structure and some is inspired of the report_openoffice module The module structure and some code is inspired by the report_openoffice module.
The module allows: The module allows:
-HTML report definition -HTML report definition
-Multi header support -Multi header support
@ -44,20 +44,22 @@ The module allows:
-Book printing capabilities -Book printing capabilities
-Margins definition -Margins definition
-Paper size definition -Paper size definition
and munch more and much more
Many header are defined per company Multiple headers and logos can be defined per company.
Many logo are defined per company CSS style, header and footer body are defined per company
CSS style, header and footer body are defined in the company
The mapper library can be found here The library to install can be found here
http://code.google.com/p/wkhtmltopdf/ http://code.google.com/p/wkhtmltopdf/
The libraries are included for Linux, Mac OS X i386 and Windows 32. The system libraries are available for Linux, Mac OS X i386 and Windows 32.
A sample invoice report is defined in the report. After installing the wkhtmltopdf library on the OpenERP Server machine, you need to set the
You have to create the print button by calling a wizard. For more details : path to the wkthtmltopdf executable file on the Company.
For a sample report see also the webkit_report_sample module, and this video:
http://files.me.com/nbessi/06n92k.mov http://files.me.com/nbessi/06n92k.mov
TODO : TODO :
JavaScript support activation deactivation JavaScript support activation deactivation
Collated and book format support Collated and book format support
@ -67,8 +69,9 @@ Web client WYSIWYG
"version" : "0.9", "version" : "0.9",
"depends" : ["base"], "depends" : ["base"],
"author" : "Camptocamp SA - NBessi", "author" : "Camptocamp SA - NBessi",
"init_xml" : [], "category": "Reports/Webkit",
"update_xml": [ "url": "http://http://www.camptocamp.com/",
"data": [
"company_view.xml", "company_view.xml",
"header_view.xml", "header_view.xml",
"ir_report_view.xml", "ir_report_view.xml",

View File

@ -52,8 +52,8 @@ class ResCompany(osv.osv):
'html_id', 'html_id',
'Available html' 'Available html'
), ),
'lib_path' : fields.char('Lib Path', size=264, help="Complete path for wkhtmltopdf library."), 'lib_path' : fields.char('Webkit Executable Path', size=264, help="Complete path to the wkhtmltopdf executable."),
} }
ResCompany() ResCompany()

View File

@ -7,17 +7,16 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<notebook position="inside"> <notebook position="inside">
<page string="webkit Headers"> <page string="Webkit">
<field name="lib_path" colspan="4"/> <field name="lib_path" colspan="4"/>
<separator string="Images" /> <separator string="Images" colspan="4"/>
<field name="header_image" colspan="4" nolabel="1"/> <field name="header_image" colspan="4" nolabel="1"/>
<separator string="Headers" /> <separator string="Headers" colspan="4"/>
<field name="header_webkit" colspan="4" nolabel="1"/> <field name="header_webkit" colspan="4" nolabel="1"/>
</page> </page>
</notebook> </notebook>
</field> </field>
</record> </record>
</data> </data>
</openerp> </openerp>

View File

@ -98,7 +98,7 @@
<field eval="&quot;&quot;&quot;WebKit invoice&quot;&quot;&quot;" name="name"/> <field eval="&quot;&quot;&quot;WebKit invoice&quot;&quot;&quot;" name="name"/>
</record> </record>
<record id="ir_property_webkitheaderdefault0" model="ir.property"> <record id="ir_property_webkitheaderdefault0" model="ir.property">
<field name="fields_id" ref="c2c_webkit_report.field_ir_act_report_xml_webkit_header"/> <field name="fields_id" ref="field_ir_act_report_xml_webkit_header"/>
<field eval="&quot;&quot;&quot;webkit_header_default&quot;&quot;&quot;" name="name"/> <field eval="&quot;&quot;&quot;webkit_header_default&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;ir.header_webkit,1&quot;&quot;&quot;" name="value"/> <field eval="&quot;&quot;&quot;ir.header_webkit,1&quot;&quot;&quot;" name="value"/>
</record> </record>

View File

@ -38,12 +38,6 @@ import tools
from tools.translate import _ from tools.translate import _
import os import os
def delete_report_service(name):
"Delete the report of the known services"
name = 'report.%s' % name
if netsvc.Service._services.get( name, False ):
del netsvc.Service._services
def register_report(name, model, tmpl_path, parser): def register_report(name, model, tmpl_path, parser):
"Register the report into the services" "Register the report into the services"
name = 'report.%s' % name name = 'report.%s' % name
@ -65,21 +59,7 @@ class ReportXML(osv.osv):
if record['report_type'] == 'webkit': if record['report_type'] == 'webkit':
parser=rml_parse parser=rml_parse
register_report(record['report_name'], record['model'], record['report_rml'], parser) register_report(record['report_name'], record['model'], record['report_rml'], parser)
return value return value
def _report_content(self, cursor, user, ids, name, arg, context=None):
"""Ask OpenERP for Doc String ??"""
res = {}
for report in self.browse(cursor, user, ids, context=context):
data = report[name + '_data']
if not data and report[name[:-8]]:
try:
fp = tools.file_open(report[name[:-8]], mode='rb')
data = fp.read()
except:
data = False
res[report.id] = data
return res
def unlink(self, cursor, user, ids, context=None): def unlink(self, cursor, user, ids, context=None):
"""Delete report and unregister it""" """Delete report and unregister it"""
@ -88,11 +68,14 @@ class ReportXML(osv.osv):
trans_ids = trans_obj.search( trans_ids = trans_obj.search(
cursor, cursor,
user, user,
[('type', '=', 'webkit'), ('res_id', 'in', ids)] [('type', '=', 'report'), ('res_id', 'in', ids)]
) )
trans_obj.unlink(cursor, user, trans_ids) trans_obj.unlink(cursor, user, trans_ids)
for record in records:
delete_report_service(record['report_name']) # Warning: we cannot unregister the services at the moment
# because they are shared across databases. Calling a deleted
# report will fail so it's ok.
records = None records = None
res = super(ReportXML, self).unlink( res = super(ReportXML, self).unlink(
cursor, cursor,
@ -107,23 +90,16 @@ class ReportXML(osv.osv):
"Create report and register it" "Create report and register it"
res = super(ReportXML, self).create(cursor, user, vals, context) res = super(ReportXML, self).create(cursor, user, vals, context)
parser=rml_parse parser=rml_parse
try: register_report(
register_report( vals['report_name'],
vals['report_name'], vals['model'],
vals['model'], vals.get('report_rml', False),
vals.get('report_rml', False), parser
parser )
)
except Exception, e:
print e
raise osv.except_osv(
_('Report registration error !'),
_('Report was not registered in system !')
)
return res return res
def write(self, cursor, user, ids, vals, context=None): def write(self, cursor, user, ids, vals, context=None):
"Edit report and manage it regitration" "Edit report and manage it registration"
parser=rml_parse parser=rml_parse
record = self.read(cursor, user, ids) record = self.read(cursor, user, ids)
if isinstance(record, list) : if isinstance(record, list) :
@ -134,33 +110,20 @@ class ReportXML(osv.osv):
report_name = vals['report_name'] report_name = vals['report_name']
else: else:
report_name = record['report_name'] report_name = record['report_name']
try:
register_report( register_report(
report_name, report_name,
vals.get('model', record['model']), vals.get('model', record['model']),
vals.get('report_rml', record['report_rml']), vals.get('report_rml', record['report_rml']),
parser parser
) )
except Exception, e:
print e
raise osv.except_osv(
_('Report registration error !'),
_('Report was not registered in system !')
)
res = super(ReportXML, self).write(cursor, user, ids, vals, context) res = super(ReportXML, self).write(cursor, user, ids, vals, context)
return res return res
def _report_content_inv(self, cursor, user, inid,
name, value, arg, context=None):
"""Ask OpenERP for Doc String ??"""
self.write(cursor, user, inid, {name+'_data': value}, context=context)
_name = 'ir.actions.report.xml' _name = 'ir.actions.report.xml'
_inherit = 'ir.actions.report.xml' _inherit = 'ir.actions.report.xml'
_columns = { _columns = {
'webkit_header': fields.property( 'webkit_header': fields.property(
'ir.header_webkit', 'ir.header_webkit',
type='many2one', type='many2one',
relation='ir.header_webkit', relation='ir.header_webkit',
@ -170,12 +133,8 @@ class ReportXML(osv.osv):
view_load=True, view_load=True,
required=True required=True
), ),
'report_webkit': fields.char( 'webkit_debug' : fields.boolean('Webkit debug', help="Enable the webkit engine debugger"),
'WebKit HTML path', 'report_webkit_data': fields.text('Webkit Template', help="This template will be used if the main report file is not found"),
size=256,
),
'webkit_debug' : fields.boolean('Webkit debug'),
'report_webkit_data': fields.text('WebKit HTML content'),
} }
ReportXML() ReportXML()

View File

@ -0,0 +1,20 @@
<openerp>
<data>
<record id="act_report_xml_view" model="ir.ui.view">
<field name="name">ir.actions.report.xml.inherit</field>
<field name="model">ir.actions.report.xml</field>
<field name="inherit_id" ref="base.act_report_xml_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page[@string='Security']" position="before" >
<page string="Webkit" attrs="{'invisible':[('report_type','!=','webkit')]}">
<field name="webkit_header"/>
<field name="webkit_debug"/>
<separator string="Webkit Template (used if Report File is not found)" colspan="4"/>
<field name="report_webkit_data" colspan="4" nolabel="1"/>
</page>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -29,25 +29,23 @@
# #
############################################################################## ##############################################################################
import sys import commands
import platform import logging
import os import os
import tempfile import platform
import report import report
from report.report_sxw import * import sys
from osv import osv import tempfile
from tools.translate import _
import time import time
from mako.template import Template from mako.template import Template
import pooler
from report_helper import WebKitHelper
import netsvc import netsvc
import pooler import pooler
from report_helper import WebKitHelper
from report.report_sxw import *
from tools.config import config from tools.config import config
from tools.translate import _
import commands from osv.osv import except_osv
logger = netsvc.Logger()
#from report.report_sxw import report_sxw, report_rml
class WebKitParser(report_sxw): class WebKitParser(report_sxw):
"""Custom class that use webkit to render HTML reports """Custom class that use webkit to render HTML reports
@ -61,7 +59,6 @@ class WebKitParser(report_sxw):
report_sxw.__init__(self, name, table, rml, parser, report_sxw.__init__(self, name, table, rml, parser,
header, store) header, store)
def get_lib(self, cursor, uid, company) : def get_lib(self, cursor, uid, company) :
"""Return the lib wkhtml path""" """Return the lib wkhtml path"""
#TODO Detect lib in system first #TODO Detect lib in system first
@ -74,85 +71,82 @@ class WebKitParser(report_sxw):
if status[0]: if status[0]:
raise raise
except Exception,e: except Exception:
raise osv.except_osv( raise except_osv(
_('Please install wkhtmltopdf'), _('Please install wkhtmltopdf library'),
_('Please install it on you system (sudo apt-get install wkhtmltopdf) or download it from here: http://code.google.com/p/wkhtmltopdf/downloads/list') _('Please install it on you system (sudo apt-get install wkhtmltopdf) or download it from here: http://code.google.com/p/wkhtmltopdf/downloads/list and set the path to the executable on the Company form.')
) )
return False return False
def genreate_pdf(self, comm_path, report_xml, header, footer, html_list): def generate_pdf(self, comm_path, report_xml, header, footer, html_list):
"""Call webkit in order to generate pdf""" """Call webkit in order to generate pdf"""
tmp_dir = tempfile.gettempdir() tmp_dir = tempfile.gettempdir()
out = report_xml.name+str(time.time())+'.pdf' out = report_xml.name+str(time.time())+'.pdf'
out = os.path.join(tmp_dir, out.replace(' ','')) out = os.path.join(tmp_dir, out.replace(' ',''))
files = [] files = []
file_to_del = [] file_to_del = []
try: if comm_path:
if comm_path: command = [comm_path]
command = [comm_path] else:
else: command = 'wkhtmltopdf'
command = 'wkhtmltopdf'
command.append('-q')
if header :
head_file = file( os.path.join(
tmp_dir,
str(time.time()) + '.head.html'
),
'w'
)
head_file.write(header)
head_file.close()
file_to_del.append(head_file.name)
command.append("--header-html '%s'"%(head_file.name))
if footer :
foot_file = file( os.path.join(
tmp_dir,
str(time.time()) + '.foot.html'
),
'w'
)
foot_file.write(footer)
foot_file.close()
file_to_del.append(foot_file.name)
command.append("--footer-html '%s'"%(foot_file.name))
if report_xml.webkit_header.margin_top : command.append('-q')
command.append('--margin-top %s'%(report_xml.webkit_header.margin_top)) if header :
if report_xml.webkit_header.magrin_bottom : head_file = file( os.path.join(
command.append('--margin-bottom %s'%(report_xml.webkit_header.magrin_bottom)) tmp_dir,
if report_xml.webkit_header.magrin_left : str(time.time()) + '.head.html'
command.append('--margin-left %s'%(report_xml.webkit_header.magrin_left)) ),
if report_xml.webkit_header.magrin_right : 'w'
command.append('--margin-right %s'%(report_xml.webkit_header.magrin_right)) )
if report_xml.webkit_header.orientation : head_file.write(header)
command.append("--orientation '%s'"%(report_xml.webkit_header.orientation)) head_file.close()
if report_xml.webkit_header.format : file_to_del.append(head_file.name)
command.append(" --page-size '%s'"%(report_xml.webkit_header.format)) command.append("--header-html '%s'"%(head_file.name))
for html in html_list : if footer :
html_file = file(os.path.join(tmp_dir, str(time.time()) + '.body.html'), 'w') foot_file = file( os.path.join(
html_file.write(html) tmp_dir,
html_file.close() str(time.time()) + '.foot.html'
file_to_del.append(html_file.name) ),
command.append(html_file.name) 'w'
command.append(out) )
generate_command = ' '.join(command) foot_file.write(footer)
foot_file.close()
file_to_del.append(foot_file.name)
command.append("--footer-html '%s'"%(foot_file.name))
if report_xml.webkit_header.margin_top :
command.append('--margin-top %s'%(report_xml.webkit_header.margin_top))
if report_xml.webkit_header.magrin_bottom :
command.append('--margin-bottom %s'%(report_xml.webkit_header.magrin_bottom))
if report_xml.webkit_header.magrin_left :
command.append('--margin-left %s'%(report_xml.webkit_header.magrin_left))
if report_xml.webkit_header.magrin_right :
command.append('--margin-right %s'%(report_xml.webkit_header.magrin_right))
if report_xml.webkit_header.orientation :
command.append("--orientation '%s'"%(report_xml.webkit_header.orientation))
if report_xml.webkit_header.format :
command.append(" --page-size '%s'"%(report_xml.webkit_header.format))
for html in html_list :
html_file = file(os.path.join(tmp_dir, str(time.time()) + '.body.html'), 'w')
html_file.write(html)
html_file.close()
file_to_del.append(html_file.name)
command.append(html_file.name)
command.append(out)
generate_command = ' '.join(command)
try:
status = commands.getstatusoutput(generate_command)
if status[0] :
raise except_osv(
_('Webkit raise an error' ),
status[1]
)
except Exception:
try: try:
status = commands.getstatusoutput(generate_command) for f_to_del in file_to_del :
if status[0] : os.unlink(f_to_del)
raise osv.except_osv( except Exception:
_('Webkit raise an error' ), pass
status[1]
)
except Exception, exc:
try:
for f_to_del in file_to_del :
os.unlink(f_to_del)
except Exception, exc:
pass
except Exception, exc:
raise exc
pdf = file(out).read() pdf = file(out).read()
try: try:
@ -168,11 +162,11 @@ class WebKitParser(report_sxw):
if not lang: if not lang:
lang = 'en_US' lang = 'en_US'
self.localcontext['lang'] = lang self.localcontext['lang'] = lang
def translate_call(self, src): def translate_call(self, src):
"""Translate String.""" """Translate String."""
ir_translation = self.pool.get('ir.translation') ir_translation = self.pool.get('ir.translation')
res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid, self.name, 'webkit', self.localcontext.get('lang', 'en_US'), src) res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid, self.name, 'report', self.localcontext.get('lang', 'en_US'), src)
return res return res
def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False): def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False):
@ -207,10 +201,11 @@ class WebKitParser(report_sxw):
return lang_obj.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary) return lang_obj.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary)
# override needed to keep the attachments' storing procedure # override needed to keep the attachments' storing procedure
def create_single_pdf(self, cursor, uid, ids, data, report_xml, def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None):
context=None):
"""generate the PDF""" """generate the PDF"""
if report_xml.report_type != 'webkit':
return super(WebKitParser,self).create_single_pdf(self, cursor, uid, ids, data, report_xml, context=context)
if not context: if not context:
context={} context={}
self.parser_instance = self.parser( self.parser_instance = self.parser(
@ -219,7 +214,7 @@ class WebKitParser(report_sxw):
self.name2, self.name2,
context=context context=context
) )
self.pool = pooler.get_pool(cursor.dbname) self.pool = pooler.get_pool(cursor.dbname)
objs = self.getObjects(cursor, uid, ids, context) objs = self.getObjects(cursor, uid, ids, context)
self.parser_instance.set_context(objs, data, ids, report_xml.report_type) self.parser_instance.set_context(objs, data, ids, report_xml.report_type)
@ -227,22 +222,22 @@ class WebKitParser(report_sxw):
user = self.pool.get('res.users').browse(cursor, uid, uid) user = self.pool.get('res.users').browse(cursor, uid, uid)
company = user.company_id company = user.company_id
template = False template = False
if report_xml.report_webkit : if report_xml.report_file :
path = os.path.join(config['addons_path'], report_xml.report_webkit) path = os.path.join(config['addons_path'], report_xml.report_file)
if os.path.exists(path) : if os.path.exists(path) :
template = file(path).read() template = file(path).read()
if not template and report_xml.report_webkit_data : if not template and report_xml.report_webkit_data :
template = report_xml.report_webkit_data template = report_xml.report_webkit_data
if not template : if not template :
raise osv.except_osv(_('Report template not found !'), _('')) raise except_osv(_('Webkit Report template not found !'), _(''))
header = report_xml.webkit_header.html header = report_xml.webkit_header.html
footer = report_xml.webkit_header.footer_html footer = report_xml.webkit_header.footer_html
if not header and report_xml.header: if not header and report_xml.header:
raise osv.except_osv( raise except_osv(
_('No header defined for this report header html is empty !'), _('No header defined for this Webkit report!'),
_('look in company settings') _('Please set a header in company settings')
) )
if not report_xml.header : if not report_xml.header :
#I know it could be cleaner ... #I know it could be cleaner ...
@ -323,70 +318,9 @@ class WebKitParser(report_sxw):
) )
return (deb, 'html') return (deb, 'html')
bin = self.get_lib(cursor, uid, company.id) bin = self.get_lib(cursor, uid, company.id)
pdf = self.genreate_pdf(bin, report_xml, head, foot, [html]) pdf = self.generate_pdf(bin, report_xml, head, foot, [html])
return (pdf, 'pdf') return (pdf, 'pdf')
def create_source_webkit(self, cursor, uid, ids, data, report_xml, context=None):
"""We override the create_source_webkit function in order to handle attachement
Code taken from report openoffice. Thanks guys :) """
if not context:
context = {}
pool = pooler.get_pool(cursor.dbname)
attach = report_xml.attachment
if attach:
objs = self.getObjects(cursor, uid, ids, context)
results = []
for obj in objs:
aname = eval(attach, {'object':obj, 'time':time})
result = False
if report_xml.attachment_use and aname and context.get('attachment_use', True):
aids = pool.get('ir.attachment').search(
cursor,
uid,
[
('datas_fname','=',aname+'.pdf'),
('res_model','=',self.table),
('res_id','=',obj.id)
]
)
if aids:
brow_rec = pool.get('ir.attachment').browse(cursor, uid, aids[0])
if not brow_rec.datas:
continue
d = base64.decodestring(brow_rec.datas)
results.append((d,'odt'))
continue
result = self.create_single_pdf(cursor, uid, [obj.id], data, report_xml, context)
try:
if aname:
name = aname+'.'+result[1]
pool.get('ir.attachment').create(cursor, uid, {
'name': aname,
'datas': base64.encodestring(result[0]),
'datas_fname': name,
'res_model': self.table,
'res_id': obj.id,
}, context=context
)
cursor.commit()
except Exception, exp:
import traceback, sys
tb_s = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
netsvc.Logger().notifyChannel(
'report',
netsvc.LOG_ERROR,
str(exp)
)
results.append(result)
return self.create_single_pdf(
cursor,
uid,
ids,
data,
report_xml,
context
)
def create(self, cursor, uid, ids, data, context=None): def create(self, cursor, uid, ids, data, context=None):
"""We override the create function in order to handle generator """We override the create function in order to handle generator
@ -412,7 +346,7 @@ class WebKitParser(report_sxw):
return super(WebKitParser, self).create(cursor, uid, ids, data, context) return super(WebKitParser, self).create(cursor, uid, ids, data, context)
if report_xml.report_type != 'webkit' : if report_xml.report_type != 'webkit' :
return super(WebKitParser, self).create(cursor, uid, ids, data, context) return super(WebKitParser, self).create(cursor, uid, ids, data, context)
fnct_ret = self.create_source_webkit(cursor, uid, ids, data, report_xml, context) result = self.create_source_pdf(cursor, uid, ids, data, report_xml, context)
if not fnct_ret: if not result:
return (False,False) return (False,False)
return fnct_ret return result

View File

@ -30,18 +30,21 @@
############################################################################## ##############################################################################
{ {
"name" : "webkit report", "name" : "Webkit Report Samples",
"description" : """Sample webkit Invoice Report base on WebKit engine (wkhtmltopd lib) that allows to do HTML2PDF reporting. "description" : """Samples for Webkit Report Engine (report_webkit module).
A sample invoice report is defined . A sample invoice report is included in this module, as well as a wizard to
You have to create the print button by calling a wizard. For more details : add Webkit Report entries on any Document in the system.
You have to create the print buttons by calling the wizard. For more details see:
http://files.me.com/nbessi/06n92k.mov http://files.me.com/nbessi/06n92k.mov
""", """,
"version" : "0.9", "version" : "0.9",
"depends" : ["base", "account","c2c_webkit_report"], "depends" : ["base", "account", "report_webkit"],
"category": "Reports/Webkit",
"author" : "Camptocamp SA - NBessi", "author" : "Camptocamp SA - NBessi",
"init_xml" : ['data.xml'], "url": "http://www.camptocamp.com/",
"update_xml": [ "data": [ 'data.xml',
"wizard_report_actions_view.xml", "wizard_report_actions_view.xml",
"report_webkit_html_view.xml", "report_webkit_html_view.xml",
], ],

View File

@ -2,7 +2,7 @@
<openerp> <openerp>
<data noupdate="1"> <data noupdate="1">
<record id="ir_property_webkitheaderdefault0" model="ir.property"> <record id="ir_property_webkitheaderdefault0" model="ir.property">
<field name="fields_id" ref="c2c_webkit_report.field_ir_act_report_xml_webkit_header"/> <field name="fields_id" ref="report_webkit.field_ir_act_report_xml_webkit_header"/>
<field eval="&quot;&quot;&quot;webkit_header_default&quot;&quot;&quot;" name="name"/> <field eval="&quot;&quot;&quot;webkit_header_default&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;ir.header_webkit,1&quot;&quot;&quot;" name="value"/> <field eval="&quot;&quot;&quot;ir.header_webkit,1&quot;&quot;&quot;" name="value"/>
</record> </record>

View File

@ -1,6 +1,6 @@
# Translation of OpenERP Server. # Translation of OpenERP Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * c2c_webkit_invoice # * report_webkit_sample
# #
msgid "" msgid ""
msgstr "" msgstr ""
@ -15,36 +15,36 @@ msgstr ""
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: wizard_view:ir.report_actions,exist:0 #: wizard_view:ir.report_actions,exist:0
msgid "Report Action already exist for this report." msgid "Report Action already exist for this report."
msgstr "Report Action already exist for this report." msgstr "Report Action already exist for this report."
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: wizard_field:ir.report_actions,add,print_button:0 #: wizard_field:ir.report_actions,add,print_button:0
msgid "Add print button" msgid "Add print button"
msgstr "Add print button" msgstr "Add print button"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: model:ir.actions.report.xml,name:c2c_webkit_invoice.report_webkit_html #: model:ir.actions.report.xml,name:report_webkit_sample.report_webkit_html
msgid "WebKit invoice" msgid "WebKit invoice"
msgstr "facture WebKit" msgstr "facture WebKit"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: model:ir.actions.wizard,name:c2c_webkit_invoice.wizard_oo_report_actions #: model:ir.actions.wizard,name:report_webkit_sample.wizard_oo_report_actions
#: wizard_view:ir.report_actions,add:0 #: wizard_view:ir.report_actions,add:0
#: wizard_view:ir.report_actions,exist:0 #: wizard_view:ir.report_actions,exist:0
msgid "Add Print Buttons" msgid "Add Print Buttons"
msgstr "Ajouter des boutons d'impression" msgstr "Ajouter des boutons d'impression"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: code:addons/c2c_webkit_invoice/wizard/report_actions.py:0 #: code:addons/report_webkit_sample/wizard/report_actions.py:0
#, python-format #, python-format
msgid "Client Actions Connections" msgid "Client Actions Connections"
msgstr "Actions Client Connections" msgstr "Actions Client Connections"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: model:ir.module.module,description:c2c_webkit_invoice.module_meta_information #: model:ir.module.module,description:report_webkit_sample.module_meta_information
msgid "Report system base on WebKit engine (wkhtmltopd lib) that allows to do HTML2PDF reporting.\n" msgid "Report system base on WebKit engine (wkhtmltopd lib) that allows to do HTML2PDF reporting.\n"
"The module structure and some is inspired of the report_openoffice module\n" "The module structure and some is inspired of the report_openoffice module\n"
"The module allows:\n" "The module allows:\n"
@ -112,59 +112,59 @@ msgstr "Report system base on WebKit engine (wkhtmltopd lib) that allows to do H
"Web client WYSIWYG\n" "Web client WYSIWYG\n"
" " " "
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: help:ir.report_actions,add,print_button:0 #: help:ir.report_actions,add,print_button:0
msgid "Add action to menu context in print button." msgid "Add action to menu context in print button."
msgstr "Ajouter à l'action du menu contextuel dans le bouton d'impression." msgstr "Ajouter à l'action du menu contextuel dans le bouton d'impression."
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: wizard_button:ir.report_actions,add,end:0 #: wizard_button:ir.report_actions,add,end:0
msgid "_Cancel" msgid "_Cancel"
msgstr "_Cancel" msgstr "_Cancel"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: model:ir.module.module,shortdesc:c2c_webkit_invoice.module_meta_information #: model:ir.module.module,shortdesc:report_webkit_sample.module_meta_information
msgid "webkit report" msgid "webkit report"
msgstr "rapport webkit" msgstr "rapport webkit"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: wizard_field:ir.report_actions,add,open_action:0 #: wizard_field:ir.report_actions,add,open_action:0
msgid "Open added action" msgid "Open added action"
msgstr "Ouvrir ajouté action" msgstr "Ouvrir ajouté action"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: wizard_button:ir.report_actions,add,process:0 #: wizard_button:ir.report_actions,add,process:0
msgid "_Ok" msgid "_Ok"
msgstr "_Ok" msgstr "_Ok"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: wizard_button:ir.report_actions,exist,end:0 #: wizard_button:ir.report_actions,exist,end:0
msgid "_Close" msgid "_Close"
msgstr "_Close" msgstr "_Close"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: webkit:report.webkitaccount.invoice:0 #: webkit:report.webkitaccount.invoice:0
msgid "Invoice Date" msgid "Invoice Date"
msgstr "Date de la facture" msgstr "Date de la facture"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: webkit:report.webkitaccount.invoice:0 #: webkit:report.webkitaccount.invoice:0
msgid "QTY" msgid "QTY"
msgstr "QTÉ" msgstr "QTÉ"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: webkit:report.webkitaccount.invoice:0 #: webkit:report.webkitaccount.invoice:0
msgid "Unit Price" msgid "Unit Price"
msgstr "Prix unitaire" msgstr "Prix unitaire"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: field:report.webkitaccount.invoice:0 #: field:report.webkitaccount.invoice:0
msgid "Unit of Measure" msgid "Unit of Measure"
msgstr "Unité de mesure" msgstr "Unité de mesure"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: view:account.invoice:0 #: view:account.invoice:0
#: field:account.invoice.line,invoice_line_tax_id:0 #: field:account.invoice.line,invoice_line_tax_id:0
#: model:ir.actions.act_window,name:account.action_tax_form #: model:ir.actions.act_window,name:account.action_tax_form
@ -173,69 +173,69 @@ msgstr "Unité de mesure"
msgid "Taxes" msgid "Taxes"
msgstr "Impôts" msgstr "Impôts"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: webkit:report.webkitaccount.invoice:0 #: webkit:report.webkitaccount.invoice:0
msgid "Price" msgid "Price"
msgstr "Prix" msgstr "Prix"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: webkit:report.webkitaccount.invoice:0 #: webkit:report.webkitaccount.invoice:0
msgid "Tax Lines" msgid "Tax Lines"
msgstr "Lignes de taxe" msgstr "Lignes de taxe"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: webkit:report.webkitaccount.invoice:0 #: webkit:report.webkitaccount.invoice:0
msgid "Amount" msgid "Amount"
msgstr "Montant" msgstr "Montant"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: webkit:report.webkitaccount.invoice,:0 #: webkit:report.webkitaccount.invoice,:0
msgid "Partner Ref." msgid "Partner Ref."
msgstr "Réf. partenaire" msgstr "Réf. partenaire"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: webkit:report.webkitaccount.invoice:0 #: webkit:report.webkitaccount.invoice:0
msgid "Invoice Ref" msgid "Invoice Ref"
msgstr "Réf. Facture" msgstr "Réf. Facture"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: field:account.invoice,amount_tax:0 #: field:account.invoice,amount_tax:0
msgid "Total" msgid "Total"
msgstr "Total" msgstr "Total"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: field:account.invoice,name:0 #: field:account.invoice,name:0
#: field:account.invoice.line,name:0 #: field:account.invoice.line,name:0
msgid "Description" msgid "Description"
msgstr "Description" msgstr "Description"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: view:account.invoice.line:0 #: view:account.invoice.line:0
#: webkit:account.invoice.tax,invoice_id:0 #: webkit:account.invoice.tax,invoice_id:0
msgid "Invoice Line" msgid "Invoice Line"
msgstr "Ligne de facture" msgstr "Ligne de facture"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: field:account.analytic.line,product_id:0 #: field:account.analytic.line,product_id:0
#: field:account.invoice.line,product_id:0 #: field:account.invoice.line,product_id:0
#: field:account.move.line,product_id:0 #: field:account.move.line,product_id:0
msgid "Product" msgid "Product"
msgstr "Produit" msgstr "Produit"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: field:account.invoice,name:0 #: field:account.invoice,name:0
msgid "Document" msgid "Document"
msgstr "Ref. document" msgstr "Ref. document"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: webkit:account.invoice.line,discount:0 #: webkit:account.invoice.line,discount:0
msgid "Disc.(%)" msgid "Disc.(%)"
msgstr "Disc.(%)" msgstr "Disc.(%)"
#. module: c2c_webkit_invoice #. module: report_webkit_sample
#: model:account.account.type,name:account.account_type_tax #: model:account.account.type,name:account.account_type_tax
#: field:account.invoice,amount_tax:0 #: field:account.invoice,amount_tax:0
#: field:account.move.line,account_tax_id:0 #: field:account.move.line,account_tax_id:0
msgid "Tax" msgid "Tax"
msgstr "Taxe" msgstr "Taxe"

View File

@ -13,5 +13,5 @@ class report_webkit_html(report_sxw.rml_parse):
report_sxw.report_sxw('report.webkitaccount.invoice', report_sxw.report_sxw('report.webkitaccount.invoice',
'account.invoice', 'account.invoice',
'addons/c2c_webkit_invoice/report/report_webkit_html.mako', 'addons/report_webkit_sample/report/report_webkit_html.mako',
parser=report_webkit_html) parser=report_webkit_html)

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
<report auto="False" id="report_webkit_html" model="account.invoice" name="webkitaccount.invoice" webkit="c2c_webkit_invoice/report/report_webkit_html.mako" string="WebKit invoice" report_type="webkit" /> <report auto="False" id="report_webkit_html" model="account.invoice" name="webkitaccount.invoice" file="report_webkit_sample/report/report_webkit_html.mako" string="WebKit invoice" report_type="webkit" />
</data> </data>
</openerp> </openerp>