From f6faef13ff9de3d9d20105d30d4da1d5924a7556 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 8 Oct 2010 16:30:50 +0200 Subject: [PATCH] [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 --- addons/c2c_webkit_report/ir_report_view.xml | 40 --- .../__init__.py | 0 .../__openerp__.py} | 29 +- .../company.py | 4 +- .../company_view.xml | 13 +- .../data.xml | 2 +- .../header.py | 0 .../header_view.xml | 0 .../ir_report.py | 91 ++----- addons/report_webkit/ir_report_view.xml | 20 ++ .../report_helper.py | 0 .../webkit_report.py | 254 +++++++----------- .../wizard/__init__.py | 0 .../wizard/report_actions.py | 0 .../__init__.py | 0 .../__openerp__.py | 17 +- .../data.xml | 2 +- .../i18n/fr_FR.po | 72 ++--- .../report/__init__.py | 0 .../report/report_webkit_html.mako | 0 .../report/report_webkit_html.py | 2 +- .../report_webkit_html_view.xml | 2 +- .../wizard/__init__.py | 0 .../wizard/report_actions.py | 0 .../wizard_report_actions_view.xml | 0 25 files changed, 213 insertions(+), 335 deletions(-) delete mode 100644 addons/c2c_webkit_report/ir_report_view.xml rename addons/{c2c_webkit_report => report_webkit}/__init__.py (100%) rename addons/{c2c_webkit_report/__terp__.py => report_webkit/__openerp__.py} (73%) rename addons/{c2c_webkit_report => report_webkit}/company.py (93%) rename addons/{c2c_webkit_report => report_webkit}/company_view.xml (58%) rename addons/{c2c_webkit_report => report_webkit}/data.xml (99%) rename addons/{c2c_webkit_report => report_webkit}/header.py (100%) rename addons/{c2c_webkit_report => report_webkit}/header_view.xml (100%) rename addons/{c2c_webkit_report => report_webkit}/ir_report.py (62%) create mode 100644 addons/report_webkit/ir_report_view.xml rename addons/{c2c_webkit_report => report_webkit}/report_helper.py (100%) rename addons/{c2c_webkit_report => report_webkit}/webkit_report.py (60%) rename addons/{c2c_webkit_invoice => report_webkit}/wizard/__init__.py (100%) rename addons/{c2c_webkit_invoice => report_webkit}/wizard/report_actions.py (100%) rename addons/{c2c_webkit_invoice => report_webkit_sample}/__init__.py (100%) rename addons/{c2c_webkit_invoice => report_webkit_sample}/__openerp__.py (76%) rename addons/{c2c_webkit_invoice => report_webkit_sample}/data.xml (98%) rename addons/{c2c_webkit_invoice => report_webkit_sample}/i18n/fr_FR.po (81%) rename addons/{c2c_webkit_invoice => report_webkit_sample}/report/__init__.py (100%) rename addons/{c2c_webkit_invoice => report_webkit_sample}/report/report_webkit_html.mako (100%) rename addons/{c2c_webkit_invoice => report_webkit_sample}/report/report_webkit_html.py (85%) rename addons/{c2c_webkit_invoice => report_webkit_sample}/report_webkit_html_view.xml (56%) rename addons/{c2c_webkit_report => report_webkit_sample}/wizard/__init__.py (100%) rename addons/{c2c_webkit_report => report_webkit_sample}/wizard/report_actions.py (100%) rename addons/{c2c_webkit_invoice => report_webkit_sample}/wizard_report_actions_view.xml (100%) diff --git a/addons/c2c_webkit_report/ir_report_view.xml b/addons/c2c_webkit_report/ir_report_view.xml deleted file mode 100644 index 48ba69efef1..00000000000 --- a/addons/c2c_webkit_report/ir_report_view.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - ir.actions.report.xml.inherit1 - ir.actions.report.xml - 16 - - form - - - - - - - - ir.actions.report.xml.inherit - ir.actions.report.xml - - form - - - - - - - - - - - - - - - - - - - - - diff --git a/addons/c2c_webkit_report/__init__.py b/addons/report_webkit/__init__.py similarity index 100% rename from addons/c2c_webkit_report/__init__.py rename to addons/report_webkit/__init__.py diff --git a/addons/c2c_webkit_report/__terp__.py b/addons/report_webkit/__openerp__.py similarity index 73% rename from addons/c2c_webkit_report/__terp__.py rename to addons/report_webkit/__openerp__.py index d998914f455..c0523c1844f 100644 --- a/addons/c2c_webkit_report/__terp__.py +++ b/addons/report_webkit/__openerp__.py @@ -30,9 +30,9 @@ ############################################################################## { - "name" : "webkit report", - "description" : """Report system base on WebKit engine (wkhtmltopd lib) that allows to do HTML2PDF reporting. -The module structure and some is inspired of the report_openoffice module + "name" : "Webkit Report Engine", + "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 code is inspired by the report_openoffice module. The module allows: -HTML report definition -Multi header support @@ -44,20 +44,22 @@ The module allows: -Book printing capabilities -Margins definition -Paper size definition -and munch more +and much more -Many header are defined per company -Many logo are defined per company -CSS style, header and footer body are defined in the company +Multiple headers and logos can be defined per company. +CSS style, header and footer body are defined per company -The mapper library can be found here +The library to install can be found here 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. -You have to create the print button by calling a wizard. For more details : +After installing the wkhtmltopdf library on the OpenERP Server machine, you need to set the +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 + TODO : JavaScript support activation deactivation Collated and book format support @@ -67,8 +69,9 @@ Web client WYSIWYG "version" : "0.9", "depends" : ["base"], "author" : "Camptocamp SA - NBessi", - "init_xml" : [], - "update_xml": [ + "category": "Reports/Webkit", + "url": "http://http://www.camptocamp.com/", + "data": [ "company_view.xml", "header_view.xml", "ir_report_view.xml", diff --git a/addons/c2c_webkit_report/company.py b/addons/report_webkit/company.py similarity index 93% rename from addons/c2c_webkit_report/company.py rename to addons/report_webkit/company.py index b6b0efb0446..722cc169737 100644 --- a/addons/c2c_webkit_report/company.py +++ b/addons/report_webkit/company.py @@ -52,8 +52,8 @@ class ResCompany(osv.osv): 'html_id', '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() \ No newline at end of file diff --git a/addons/c2c_webkit_report/company_view.xml b/addons/report_webkit/company_view.xml similarity index 58% rename from addons/c2c_webkit_report/company_view.xml rename to addons/report_webkit/company_view.xml index eb937f606c2..04c21037e8e 100644 --- a/addons/c2c_webkit_report/company_view.xml +++ b/addons/report_webkit/company_view.xml @@ -7,17 +7,16 @@ form - - - - - - + + + + + + - diff --git a/addons/c2c_webkit_report/data.xml b/addons/report_webkit/data.xml similarity index 99% rename from addons/c2c_webkit_report/data.xml rename to addons/report_webkit/data.xml index 00806d3e758..68f98b3c8c9 100644 --- a/addons/c2c_webkit_report/data.xml +++ b/addons/report_webkit/data.xml @@ -98,7 +98,7 @@ - + diff --git a/addons/c2c_webkit_report/header.py b/addons/report_webkit/header.py similarity index 100% rename from addons/c2c_webkit_report/header.py rename to addons/report_webkit/header.py diff --git a/addons/c2c_webkit_report/header_view.xml b/addons/report_webkit/header_view.xml similarity index 100% rename from addons/c2c_webkit_report/header_view.xml rename to addons/report_webkit/header_view.xml diff --git a/addons/c2c_webkit_report/ir_report.py b/addons/report_webkit/ir_report.py similarity index 62% rename from addons/c2c_webkit_report/ir_report.py rename to addons/report_webkit/ir_report.py index 9a2b81c32b3..21422fdda8f 100644 --- a/addons/c2c_webkit_report/ir_report.py +++ b/addons/report_webkit/ir_report.py @@ -38,12 +38,6 @@ import tools from tools.translate import _ 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): "Register the report into the services" name = 'report.%s' % name @@ -65,21 +59,7 @@ class ReportXML(osv.osv): if record['report_type'] == 'webkit': parser=rml_parse register_report(record['report_name'], record['model'], record['report_rml'], parser) - 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 + return value def unlink(self, cursor, user, ids, context=None): """Delete report and unregister it""" @@ -88,11 +68,14 @@ class ReportXML(osv.osv): trans_ids = trans_obj.search( cursor, user, - [('type', '=', 'webkit'), ('res_id', 'in', ids)] + [('type', '=', 'report'), ('res_id', 'in', 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 res = super(ReportXML, self).unlink( cursor, @@ -107,23 +90,16 @@ class ReportXML(osv.osv): "Create report and register it" res = super(ReportXML, self).create(cursor, user, vals, context) parser=rml_parse - try: - register_report( - vals['report_name'], - vals['model'], - vals.get('report_rml', False), - parser - ) - except Exception, e: - print e - raise osv.except_osv( - _('Report registration error !'), - _('Report was not registered in system !') - ) + register_report( + vals['report_name'], + vals['model'], + vals.get('report_rml', False), + parser + ) return res def write(self, cursor, user, ids, vals, context=None): - "Edit report and manage it regitration" + "Edit report and manage it registration" parser=rml_parse record = self.read(cursor, user, ids) if isinstance(record, list) : @@ -134,33 +110,20 @@ class ReportXML(osv.osv): report_name = vals['report_name'] else: report_name = record['report_name'] - try: - register_report( - report_name, - vals.get('model', record['model']), - vals.get('report_rml', record['report_rml']), - parser - ) - except Exception, e: - print e - raise osv.except_osv( - _('Report registration error !'), - _('Report was not registered in system !') - ) + + register_report( + report_name, + vals.get('model', record['model']), + vals.get('report_rml', record['report_rml']), + parser + ) res = super(ReportXML, self).write(cursor, user, ids, vals, context) 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' _inherit = 'ir.actions.report.xml' _columns = { - 'webkit_header': fields.property( + 'webkit_header': fields.property( 'ir.header_webkit', type='many2one', relation='ir.header_webkit', @@ -170,12 +133,8 @@ class ReportXML(osv.osv): view_load=True, required=True ), - 'report_webkit': fields.char( - 'WebKit HTML path', - size=256, - ), - 'webkit_debug' : fields.boolean('Webkit debug'), - 'report_webkit_data': fields.text('WebKit HTML content'), + 'webkit_debug' : fields.boolean('Webkit debug', help="Enable the webkit engine debugger"), + 'report_webkit_data': fields.text('Webkit Template', help="This template will be used if the main report file is not found"), } -ReportXML() +ReportXML() \ No newline at end of file diff --git a/addons/report_webkit/ir_report_view.xml b/addons/report_webkit/ir_report_view.xml new file mode 100644 index 00000000000..e92c5a5345b --- /dev/null +++ b/addons/report_webkit/ir_report_view.xml @@ -0,0 +1,20 @@ + + + + ir.actions.report.xml.inherit + ir.actions.report.xml + + form + + + + + + + + + + + + + diff --git a/addons/c2c_webkit_report/report_helper.py b/addons/report_webkit/report_helper.py similarity index 100% rename from addons/c2c_webkit_report/report_helper.py rename to addons/report_webkit/report_helper.py diff --git a/addons/c2c_webkit_report/webkit_report.py b/addons/report_webkit/webkit_report.py similarity index 60% rename from addons/c2c_webkit_report/webkit_report.py rename to addons/report_webkit/webkit_report.py index f8e2045487e..d02251c1e3a 100644 --- a/addons/c2c_webkit_report/webkit_report.py +++ b/addons/report_webkit/webkit_report.py @@ -29,25 +29,23 @@ # ############################################################################## -import sys -import platform +import commands +import logging import os -import tempfile +import platform import report -from report.report_sxw import * -from osv import osv -from tools.translate import _ +import sys +import tempfile import time from mako.template import Template -import pooler -from report_helper import WebKitHelper + import netsvc import pooler +from report_helper import WebKitHelper +from report.report_sxw import * from tools.config import config - -import commands -logger = netsvc.Logger() -#from report.report_sxw import report_sxw, report_rml +from tools.translate import _ +from osv.osv import except_osv class WebKitParser(report_sxw): """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, header, store) - def get_lib(self, cursor, uid, company) : """Return the lib wkhtml path""" #TODO Detect lib in system first @@ -74,85 +71,82 @@ class WebKitParser(report_sxw): if status[0]: raise - except Exception,e: - raise osv.except_osv( - _('Please install wkhtmltopdf'), - _('Please install it on you system (sudo apt-get install wkhtmltopdf) or download it from here: http://code.google.com/p/wkhtmltopdf/downloads/list') + except Exception: + raise except_osv( + _('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 and set the path to the executable on the Company form.') ) 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""" tmp_dir = tempfile.gettempdir() out = report_xml.name+str(time.time())+'.pdf' out = os.path.join(tmp_dir, out.replace(' ','')) files = [] file_to_del = [] - try: - if comm_path: - command = [comm_path] - else: - 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 comm_path: + command = [comm_path] + else: + command = 'wkhtmltopdf' - 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) + 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('--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: - status = commands.getstatusoutput(generate_command) - if status[0] : - raise osv.except_osv( - _('Webkit raise an error' ), - 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 + for f_to_del in file_to_del : + os.unlink(f_to_del) + except Exception: + pass pdf = file(out).read() try: @@ -168,11 +162,11 @@ class WebKitParser(report_sxw): if not lang: lang = 'en_US' self.localcontext['lang'] = lang - + def translate_call(self, src): """Translate String.""" 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 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) # override needed to keep the attachments' storing procedure - def create_single_pdf(self, cursor, uid, ids, data, report_xml, - context=None): + def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """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: context={} self.parser_instance = self.parser( @@ -219,7 +214,7 @@ class WebKitParser(report_sxw): self.name2, context=context ) - + self.pool = pooler.get_pool(cursor.dbname) objs = self.getObjects(cursor, uid, ids, context) 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) company = user.company_id - + template = False - if report_xml.report_webkit : - path = os.path.join(config['addons_path'], report_xml.report_webkit) + if report_xml.report_file : + path = os.path.join(config['addons_path'], report_xml.report_file) if os.path.exists(path) : template = file(path).read() if not template and report_xml.report_webkit_data : template = report_xml.report_webkit_data 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 footer = report_xml.webkit_header.footer_html if not header and report_xml.header: - raise osv.except_osv( - _('No header defined for this report header html is empty !'), - _('look in company settings') + raise except_osv( + _('No header defined for this Webkit report!'), + _('Please set a header in company settings') ) if not report_xml.header : #I know it could be cleaner ... @@ -323,70 +318,9 @@ class WebKitParser(report_sxw): ) return (deb, 'html') 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') - 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): """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) if report_xml.report_type != 'webkit' : return super(WebKitParser, self).create(cursor, uid, ids, data, context) - fnct_ret = self.create_source_webkit(cursor, uid, ids, data, report_xml, context) - if not fnct_ret: + result = self.create_source_pdf(cursor, uid, ids, data, report_xml, context) + if not result: return (False,False) - return fnct_ret + return result diff --git a/addons/c2c_webkit_invoice/wizard/__init__.py b/addons/report_webkit/wizard/__init__.py similarity index 100% rename from addons/c2c_webkit_invoice/wizard/__init__.py rename to addons/report_webkit/wizard/__init__.py diff --git a/addons/c2c_webkit_invoice/wizard/report_actions.py b/addons/report_webkit/wizard/report_actions.py similarity index 100% rename from addons/c2c_webkit_invoice/wizard/report_actions.py rename to addons/report_webkit/wizard/report_actions.py diff --git a/addons/c2c_webkit_invoice/__init__.py b/addons/report_webkit_sample/__init__.py similarity index 100% rename from addons/c2c_webkit_invoice/__init__.py rename to addons/report_webkit_sample/__init__.py diff --git a/addons/c2c_webkit_invoice/__openerp__.py b/addons/report_webkit_sample/__openerp__.py similarity index 76% rename from addons/c2c_webkit_invoice/__openerp__.py rename to addons/report_webkit_sample/__openerp__.py index 4b58f14253d..3a62e061bf4 100644 --- a/addons/c2c_webkit_invoice/__openerp__.py +++ b/addons/report_webkit_sample/__openerp__.py @@ -30,18 +30,21 @@ ############################################################################## { - "name" : "webkit report", - "description" : """Sample webkit Invoice Report base on WebKit engine (wkhtmltopd lib) that allows to do HTML2PDF reporting. + "name" : "Webkit Report Samples", + "description" : """Samples for Webkit Report Engine (report_webkit module). - A sample invoice report is defined . - You have to create the print button by calling a wizard. For more details : + A sample invoice report is included in this module, as well as a wizard to + 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 """, "version" : "0.9", - "depends" : ["base", "account","c2c_webkit_report"], + "depends" : ["base", "account", "report_webkit"], + "category": "Reports/Webkit", "author" : "Camptocamp SA - NBessi", - "init_xml" : ['data.xml'], - "update_xml": [ + "url": "http://www.camptocamp.com/", + "data": [ 'data.xml', "wizard_report_actions_view.xml", "report_webkit_html_view.xml", ], diff --git a/addons/c2c_webkit_invoice/data.xml b/addons/report_webkit_sample/data.xml similarity index 98% rename from addons/c2c_webkit_invoice/data.xml rename to addons/report_webkit_sample/data.xml index 77ab472b6f1..83b58601397 100644 --- a/addons/c2c_webkit_invoice/data.xml +++ b/addons/report_webkit_sample/data.xml @@ -2,7 +2,7 @@ - + diff --git a/addons/c2c_webkit_invoice/i18n/fr_FR.po b/addons/report_webkit_sample/i18n/fr_FR.po similarity index 81% rename from addons/c2c_webkit_invoice/i18n/fr_FR.po rename to addons/report_webkit_sample/i18n/fr_FR.po index aa0d151c374..5b46f9e56fc 100644 --- a/addons/c2c_webkit_invoice/i18n/fr_FR.po +++ b/addons/report_webkit_sample/i18n/fr_FR.po @@ -1,6 +1,6 @@ # Translation of OpenERP Server. # This file contains the translation of the following modules: -# * c2c_webkit_invoice +# * report_webkit_sample # msgid "" msgstr "" @@ -15,36 +15,36 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: wizard_view:ir.report_actions,exist:0 msgid "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 msgid "Add print button" msgstr "Add print button" -#. module: c2c_webkit_invoice -#: model:ir.actions.report.xml,name:c2c_webkit_invoice.report_webkit_html +#. module: report_webkit_sample +#: model:ir.actions.report.xml,name:report_webkit_sample.report_webkit_html msgid "WebKit invoice" msgstr "facture WebKit" -#. module: c2c_webkit_invoice -#: model:ir.actions.wizard,name:c2c_webkit_invoice.wizard_oo_report_actions +#. module: report_webkit_sample +#: model:ir.actions.wizard,name:report_webkit_sample.wizard_oo_report_actions #: wizard_view:ir.report_actions,add:0 #: wizard_view:ir.report_actions,exist:0 msgid "Add Print Buttons" msgstr "Ajouter des boutons d'impression" -#. module: c2c_webkit_invoice -#: code:addons/c2c_webkit_invoice/wizard/report_actions.py:0 +#. module: report_webkit_sample +#: code:addons/report_webkit_sample/wizard/report_actions.py:0 #, python-format msgid "Client Actions Connections" msgstr "Actions Client Connections" -#. module: c2c_webkit_invoice -#: model:ir.module.module,description:c2c_webkit_invoice.module_meta_information +#. module: report_webkit_sample +#: 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" "The module structure and some is inspired of the report_openoffice module\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" " " -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: help:ir.report_actions,add,print_button:0 msgid "Add action to menu context in print button." 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 msgid "_Cancel" msgstr "_Cancel" -#. module: c2c_webkit_invoice -#: model:ir.module.module,shortdesc:c2c_webkit_invoice.module_meta_information +#. module: report_webkit_sample +#: model:ir.module.module,shortdesc:report_webkit_sample.module_meta_information msgid "webkit report" msgstr "rapport webkit" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: wizard_field:ir.report_actions,add,open_action:0 msgid "Open added action" msgstr "Ouvrir ajouté action" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: wizard_button:ir.report_actions,add,process:0 msgid "_Ok" msgstr "_Ok" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: wizard_button:ir.report_actions,exist,end:0 msgid "_Close" msgstr "_Close" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: webkit:report.webkitaccount.invoice:0 msgid "Invoice Date" msgstr "Date de la facture" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: webkit:report.webkitaccount.invoice:0 msgid "QTY" msgstr "QTÉ" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: webkit:report.webkitaccount.invoice:0 msgid "Unit Price" msgstr "Prix unitaire" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: field:report.webkitaccount.invoice:0 msgid "Unit of Measure" msgstr "Unité de mesure" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: view:account.invoice:0 #: field:account.invoice.line,invoice_line_tax_id:0 #: model:ir.actions.act_window,name:account.action_tax_form @@ -173,69 +173,69 @@ msgstr "Unité de mesure" msgid "Taxes" msgstr "Impôts" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: webkit:report.webkitaccount.invoice:0 msgid "Price" msgstr "Prix" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: webkit:report.webkitaccount.invoice:0 msgid "Tax Lines" msgstr "Lignes de taxe" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: webkit:report.webkitaccount.invoice:0 msgid "Amount" msgstr "Montant" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: webkit:report.webkitaccount.invoice,:0 msgid "Partner Ref." msgstr "Réf. partenaire" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: webkit:report.webkitaccount.invoice:0 msgid "Invoice Ref" msgstr "Réf. Facture" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: field:account.invoice,amount_tax:0 msgid "Total" msgstr "Total" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: field:account.invoice,name:0 #: field:account.invoice.line,name:0 msgid "Description" msgstr "Description" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: view:account.invoice.line:0 #: webkit:account.invoice.tax,invoice_id:0 msgid "Invoice Line" msgstr "Ligne de facture" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: field:account.analytic.line,product_id:0 #: field:account.invoice.line,product_id:0 #: field:account.move.line,product_id:0 msgid "Product" msgstr "Produit" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: field:account.invoice,name:0 msgid "Document" msgstr "Ref. document" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: webkit:account.invoice.line,discount:0 msgid "Disc.(%)" msgstr "Disc.(%)" -#. module: c2c_webkit_invoice +#. module: report_webkit_sample #: model:account.account.type,name:account.account_type_tax #: field:account.invoice,amount_tax:0 #: field:account.move.line,account_tax_id:0 msgid "Tax" -msgstr "Taxe" \ No newline at end of file +msgstr "Taxe" diff --git a/addons/c2c_webkit_invoice/report/__init__.py b/addons/report_webkit_sample/report/__init__.py similarity index 100% rename from addons/c2c_webkit_invoice/report/__init__.py rename to addons/report_webkit_sample/report/__init__.py diff --git a/addons/c2c_webkit_invoice/report/report_webkit_html.mako b/addons/report_webkit_sample/report/report_webkit_html.mako similarity index 100% rename from addons/c2c_webkit_invoice/report/report_webkit_html.mako rename to addons/report_webkit_sample/report/report_webkit_html.mako diff --git a/addons/c2c_webkit_invoice/report/report_webkit_html.py b/addons/report_webkit_sample/report/report_webkit_html.py similarity index 85% rename from addons/c2c_webkit_invoice/report/report_webkit_html.py rename to addons/report_webkit_sample/report/report_webkit_html.py index 4dbce2bd125..3e7f70c4154 100644 --- a/addons/c2c_webkit_invoice/report/report_webkit_html.py +++ b/addons/report_webkit_sample/report/report_webkit_html.py @@ -13,5 +13,5 @@ class report_webkit_html(report_sxw.rml_parse): report_sxw.report_sxw('report.webkitaccount.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) diff --git a/addons/c2c_webkit_invoice/report_webkit_html_view.xml b/addons/report_webkit_sample/report_webkit_html_view.xml similarity index 56% rename from addons/c2c_webkit_invoice/report_webkit_html_view.xml rename to addons/report_webkit_sample/report_webkit_html_view.xml index 07c8a4c1258..b4839496de2 100644 --- a/addons/c2c_webkit_invoice/report_webkit_html_view.xml +++ b/addons/report_webkit_sample/report_webkit_html_view.xml @@ -1,6 +1,6 @@ - + diff --git a/addons/c2c_webkit_report/wizard/__init__.py b/addons/report_webkit_sample/wizard/__init__.py similarity index 100% rename from addons/c2c_webkit_report/wizard/__init__.py rename to addons/report_webkit_sample/wizard/__init__.py diff --git a/addons/c2c_webkit_report/wizard/report_actions.py b/addons/report_webkit_sample/wizard/report_actions.py similarity index 100% rename from addons/c2c_webkit_report/wizard/report_actions.py rename to addons/report_webkit_sample/wizard/report_actions.py diff --git a/addons/c2c_webkit_invoice/wizard_report_actions_view.xml b/addons/report_webkit_sample/wizard_report_actions_view.xml similarity index 100% rename from addons/c2c_webkit_invoice/wizard_report_actions_view.xml rename to addons/report_webkit_sample/wizard_report_actions_view.xml