diff options
| author | Olivier Dony <odo@openerp.com> | 2010-10-08 16:30:50 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2010-10-08 16:30:50 +0200 |
| commit | f6faef13ff9de3d9d20105d30d4da1d5924a7556 (patch) | |
| tree | f5cbaf70c9dae9a89c08f44f734c0e2400b8b304 /addons/report_webkit_sample | |
| parent | c10c1e6ef794714b816b079cd8233268947b350a (diff) | |
[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
Diffstat (limited to 'addons/report_webkit_sample')
| -rw-r--r-- | addons/report_webkit_sample/__init__.py | 32 | ||||
| -rw-r--r-- | addons/report_webkit_sample/__openerp__.py | 53 | ||||
| -rw-r--r-- | addons/report_webkit_sample/data.xml | 225 | ||||
| -rw-r--r-- | addons/report_webkit_sample/i18n/fr_FR.po | 241 | ||||
| -rw-r--r-- | addons/report_webkit_sample/report/__init__.py | 32 | ||||
| -rw-r--r-- | addons/report_webkit_sample/report/report_webkit_html.mako | 83 | ||||
| -rw-r--r-- | addons/report_webkit_sample/report/report_webkit_html.py | 17 | ||||
| -rw-r--r-- | addons/report_webkit_sample/report_webkit_html_view.xml | 6 | ||||
| -rw-r--r-- | addons/report_webkit_sample/wizard/__init__.py | 32 | ||||
| -rw-r--r-- | addons/report_webkit_sample/wizard/report_actions.py | 177 | ||||
| -rw-r--r-- | addons/report_webkit_sample/wizard_report_actions_view.xml | 9 |
11 files changed, 907 insertions, 0 deletions
diff --git a/addons/report_webkit_sample/__init__.py b/addons/report_webkit_sample/__init__.py new file mode 100644 index 00000000000..9b406f754d8 --- /dev/null +++ b/addons/report_webkit_sample/__init__.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com) +# All Right Reserved +# +# Author : Nicolas Bessi (Camptocamp) +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## +import wizard +import report
\ No newline at end of file diff --git a/addons/report_webkit_sample/__openerp__.py b/addons/report_webkit_sample/__openerp__.py new file mode 100644 index 00000000000..3a62e061bf4 --- /dev/null +++ b/addons/report_webkit_sample/__openerp__.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com) +# All Right Reserved +# +# Author : Nicolas Bessi (Camptocamp) +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +{ + "name" : "Webkit Report Samples", + "description" : """Samples for Webkit Report Engine (report_webkit module). + + 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", "report_webkit"], + "category": "Reports/Webkit", + "author" : "Camptocamp SA - NBessi", + "url": "http://www.camptocamp.com/", + "data": [ 'data.xml', + "wizard_report_actions_view.xml", + "report_webkit_html_view.xml", + ], + "installable" : True, + "active" : False, +}
\ No newline at end of file diff --git a/addons/report_webkit_sample/data.xml b/addons/report_webkit_sample/data.xml new file mode 100644 index 00000000000..83b58601397 --- /dev/null +++ b/addons/report_webkit_sample/data.xml @@ -0,0 +1,225 @@ +<?xml version="1.0" ?> +<openerp> + <data noupdate="1"> + <record id="ir_property_webkitheaderdefault0" model="ir.property"> + <field name="fields_id" ref="report_webkit.field_ir_act_report_xml_webkit_header"/> + <field eval=""""webkit_header_default"""" name="name"/> + <field eval=""""ir.header_webkit,1"""" name="value"/> + </record> + <record id="ir_header_webkit_basesample0" model="ir.header_webkit"> + <field name="footer_html"><![CDATA[<html> + <head> + <script> + function subst() { + var vars={}; + var x=document.location.search.substring(1).split('&'); + for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} + var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; + for(var i in x) { + var y = document.getElementsByClassName(x[i]); + for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; + } + } + </script> + </head> + <body style="border:0; margin: 0;" onload="subst()"> + <table style="border-top: 1px solid black; width: 100%"> + <tr > + <td style="text-align:right;font-size:12;" width="95%">Page <span class="page"/></td><td style="text-align:left;font-size:12;"> of <span class="topage"/></td> + </tr> + </table> + </body> +</html>]]></field> + <field eval=""""Portrait"""" name="orientation"/> + <field eval=""""A4"""" name="format"/> + <field name="html"><![CDATA[<html> + <head> + <script> + function subst() { + var vars={}; + var x=document.location.search.substring(1).split('&'); + for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} + var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; + for(var i in x) { + var y = document.getElementsByClassName(x[i]); + for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; + } + } + </script> + <style type="text/css"> + ${css} + </style> + </head> + <body style="border:0; margin: 0;" onload="subst()"> + <table class="header" style="border-bottom: 0px solid black; width: 100%"> + <tr> + <td>${helper.embeed_logo_by_name('camptocamp_logo')}</td> + <td style="text-align:right"> </td> + </tr> + <tr> + <td><br/></td> + <td style="text-align:right"> </td> + </tr> + <tr> + <td>${company.partner_id.name |entity}</td> + <td/> + </tr> + <tr> + <td >${company.partner_id.address and company.partner_id.address[0].street or ''|entity}</td> + <td/> + </tr> + <tr> + <td>Phone: ${company.partner_id.address and company.partner_id.address[0].phone or ''|entity} </td> + <td/> + </tr> + <tr> + <td>Mail: ${company.partner_id.address and company.partner_id.address[0].email or ''|entity}<br/></td> + </tr> + </table> ${_debug or ''} </body> +</html>]]> +</field> + <field eval="55.0" name="margin_top"/> + <field name="css" ><![CDATA[ +body { +font-family:helvetica; +font-size:12; +} + + +.dest_address { +margin-left:60%; +font-size:12; +} +.header { +margin-left:0; +text-align:left; +width:300px; +font-size:12; +} + +.title { +font-size:16; +font-weight: bold; + +} + + +.basic_table{ +text-align:center; +border:1px solid lightGrey; +border-collapse: collapse; +} +.basic_table td { +border:1px solid lightGrey; +font-size:12; + + +} + +.list_table { +border-color:black; +text-align:center; +border-collapse: collapse; + +} +.list_table td { +border-color:gray; +border-top:1px solid gray; +text-align:left; +font-size:12; +padding-right:3px +padding-left:3px +padding-top:3px +padding-bottom:3px +} + +.list_table th { +border-bottom:2px solid black; +text-align:left; +font-size:12; +font-weight:bold; +padding-right:3px +padding-left:3px +} + +.list_tabe thead { + display:table-header-group; +} + + +.total { +width:100%; +} +.lib { +width:10.3%; +} +.tot { +text-align:right; +width:15%; +} +.lefttot { +width:74%; +} +.tax { +width:50%; +}]]> </field> + <field eval=""""Base Sample"""" name="name"/> + </record> + <record id="ir_header_img_camptocamplogo0" model="ir.header_img"> + <field eval=""""png"""" name="extention"/> + <field eval=""""iVBORw0KGgoAAAANSUhEUgAAAH4AAABaCAYAAAB+HuKoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz +AAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAArWSURB +VHic7Z17cFTVHcc/dzebTciTkDcBDElAhAJahCKoRUWrqOgoiNrxUUcRX1Ar0lLLKKPio6PVGUd0 +tCoj8rA+ihW0an0BNVSRFizyEBUIgRA2CUnIZrPZ2z9+G+9u9m7IwqZJPOczk8m5J+ee+7u/73n8 +ztm7N4ZpmmjiyKwUe4c+3Wj8ny3pEEd3G6DpHrTwiqKFVxQtvKJo4RUlobsN6LVEj96bYyzfLdG+ +Fj7+uLvbgM6gh3pF0cIrihZeUbTwitL7g7uujpZjjd5jDe66Kdrv/cJ3H70ieo+GHuoVRQuvKFp4 +RdHCK0rvCe562F53vFiw+Iht/kK69n51j1cULbyiaOEVRQuvKFp4RTF63HP10aP3aOXt82ONfmO9 +bvR6YisfKzqq1xwPWnhF0cIrihZeUbTwitJ79uqjET3aj225Eq/oPdbVR6zE6TML3eMVRQuvKFp4 +RdHCK4oWXlHiF9XHGm3G63n1O/od1bTjItb6u9qeONETl3OxPa/e4u0iM46x/q62J07ooV5RtPCK +ooVXlNjn+FkpSVH+Eu0VILGV73nfSesddkbz89ONtkHHsQR3TVEuEM2g2MpHo6ufbIm+924vcFfb +Ezv2fgbbVZUe6hVFC68oWnhF0cIrihZeUeyjelkaxCUa7+DboPYnxBrtx4uufnKmh6F7vKJo4RVF +C68oWnhF0cIrimHe3MfuSZjmHrdHrVjU3dXoHq8oWnhF0cIrihZeUbTwihItqtf8yNE9XlG08Iqi +hVcULbyiaOEVRQuvKFp4RdHCK4oWXlG08IqihVcUJYSv8gS624Qex49aeE+dybJ3m1n+d193m9Lj +6IkvP4obL/3NS029SXbmj7p9HxMde8SV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TWDyKKh/d4 +05Sg5LrnwJ0K89fBd5/L3J+eJ2U+eBK8DVD5tXXezGUyzBePlXVuG0fb+DkeLlskjdMMWL2s6bC1 +qkCCN0+dSW29yZPLveRmGcw4180541x8szdAc4vJ22t9bPjKj9sFFVUBTMDtMrhgQohAbyyAm5bK +UD73Q/FJTrG10fThYjhSC/tDfHLTMvh8pax8Rl1k5UfZbIoLlyyEk6fKdFoSDNK99fDRMxFFIyON +8mWyeeBtkIi0dIKIbgYkIl8dXG6se8mKvguGwYX3SNmVd1nRZNsaP97sKpcNi+Kxluh1lbD4Cvkd +5OShCT+MOdW1AQ7VSc/PznRwwyVuCrLl9g/WBNgbFD0708F1F7nJzQpxzZfBjZCmOllmlZ4mopsB +WPsCvLlAypUvtzac8oeIT06aDK/Pl0YJMPTMrvHJzvViy6Cfig6GIRH+s1fJqNWO6N+k6ZMpEXtq +P1kqfLtBgpX2DB4HuSVSZvsn0Fgj609XMvi9srGQlArZg6X8oe/FgSBl8sokXbsPGqoj8w8fkB+w +NnB2fAqP/QIGngyFw8Sp2z6SxtqOKk+AyuoADodB/xwHWRnh088BT4Aqj0lrwKRfhoOiXIdt0AzI +0m7wOEjLkV61q9x2/uSEMWK/rwl2roP6gzJqJvax90nNXmsZHHrvdZVyLkiDyw/ui9RXyZINrA2c +Np8UjYSiEUGffBy+cgqhd32Fqr3wmkjhO4n+2EpRtPCK8j8CgILN0JP4oAAAAABJRU5ErkJggg== +"""" name="img"/> + <field eval=""""camptocamp_logo"""" name="name"/> + </record> + </data> +</openerp> diff --git a/addons/report_webkit_sample/i18n/fr_FR.po b/addons/report_webkit_sample/i18n/fr_FR.po new file mode 100644 index 00000000000..5b46f9e56fc --- /dev/null +++ b/addons/report_webkit_sample/i18n/fr_FR.po @@ -0,0 +1,241 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * report_webkit_sample +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0dev\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2010-10-05 06:33:26+0000\n" +"PO-Revision-Date: 2010-10-05 06:33:26+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. 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: report_webkit_sample +#: wizard_field:ir.report_actions,add,print_button:0 +msgid "Add print button" +msgstr "Add print button" + +#. module: report_webkit_sample +#: model:ir.actions.report.xml,name:report_webkit_sample.report_webkit_html +msgid "WebKit invoice" +msgstr "facture WebKit" + +#. 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: report_webkit_sample +#: code:addons/report_webkit_sample/wizard/report_actions.py:0 +#, python-format +msgid "Client Actions Connections" +msgstr "Actions Client Connections" + +#. 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" +" -HTML report definition\n" +" -Multi header support \n" +" -Multi logo\n" +" -Multi company support\n" +" -HTML and CSS-3 support (In the limit of the actual WebKIT version)\n" +" -JavaScript support \n" +" -Raw HTML debugger\n" +" -Book printing capabilities\n" +" -Margins definition \n" +" -Paper size definition\n" +"and munch more\n" +"\n" +"Many header are defined per company\n" +"Many logo are defined per company\n" +"CSS style, header and footer body are defined in the company\n" +"\n" +"The mapper library can be found here\n" +"http://code.google.com/p/wkhtmltopdf/\n" +"The libraries are included for Linux, Mac OS X i386 and Windows 32.\n" +"\n" +"A sample invoice report is defined in the report. \n" +"You have to create the print button by calling a wizard. For more details :\n" +" http://files.me.com/nbessi/06n92k.mov \n" +"\n" +"TODO :\n" +"JavaScript support activation deactivation\n" +"Collated and book format support\n" +"Zip return for separated PDF\n" +"Web client WYSIWYG\n" +" " +msgstr "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" +" -HTML report definition\n" +" -Multi header support \n" +" -Multi logo\n" +" -Multi company support\n" +" -HTML and CSS-3 support (In the limit of the actual WebKIT version)\n" +" -JavaScript support \n" +" -Raw HTML debugger\n" +" -Book printing capabilities\n" +" -Margins definition \n" +" -Paper size definition\n" +"and munch more\n" +"\n" +"Many header are defined per company\n" +"Many logo are defined per company\n" +"CSS style, header and footer body are defined in the company\n" +"\n" +"The mapper library can be found here\n" +"http://code.google.com/p/wkhtmltopdf/\n" +"The libraries are included for Linux, Mac OS X i386 and Windows 32.\n" +"\n" +"A sample invoice report is defined in the report. \n" +"You have to create the print button by calling a wizard. For more details :\n" +" http://files.me.com/nbessi/06n92k.mov \n" +"\n" +"TODO :\n" +"JavaScript support activation deactivation\n" +"Collated and book format support\n" +"Zip return for separated PDF\n" +"Web client WYSIWYG\n" +" " + +#. 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: report_webkit_sample +#: wizard_button:ir.report_actions,add,end:0 +msgid "_Cancel" +msgstr "_Cancel" + +#. module: report_webkit_sample +#: model:ir.module.module,shortdesc:report_webkit_sample.module_meta_information +msgid "webkit report" +msgstr "rapport webkit" + +#. module: report_webkit_sample +#: wizard_field:ir.report_actions,add,open_action:0 +msgid "Open added action" +msgstr "Ouvrir ajouté action" + +#. module: report_webkit_sample +#: wizard_button:ir.report_actions,add,process:0 +msgid "_Ok" +msgstr "_Ok" + +#. module: report_webkit_sample +#: wizard_button:ir.report_actions,exist,end:0 +msgid "_Close" +msgstr "_Close" + + + +#. module: report_webkit_sample +#: webkit:report.webkitaccount.invoice:0 +msgid "Invoice Date" +msgstr "Date de la facture" + +#. module: report_webkit_sample +#: webkit:report.webkitaccount.invoice:0 +msgid "QTY" +msgstr "QTÉ" + +#. module: report_webkit_sample +#: webkit:report.webkitaccount.invoice:0 +msgid "Unit Price" +msgstr "Prix unitaire" + +#. module: report_webkit_sample +#: field:report.webkitaccount.invoice:0 +msgid "Unit of Measure" +msgstr "Unité de mesure" + +#. 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 +#: model:ir.ui.menu,name:account.menu_action_tax_form +#: model:ir.ui.menu,name:account.next_id_27 +msgid "Taxes" +msgstr "Impôts" + +#. module: report_webkit_sample +#: webkit:report.webkitaccount.invoice:0 +msgid "Price" +msgstr "Prix" + +#. module: report_webkit_sample +#: webkit:report.webkitaccount.invoice:0 +msgid "Tax Lines" +msgstr "Lignes de taxe" + +#. module: report_webkit_sample +#: webkit:report.webkitaccount.invoice:0 +msgid "Amount" +msgstr "Montant" + +#. module: report_webkit_sample +#: webkit:report.webkitaccount.invoice,:0 +msgid "Partner Ref." +msgstr "Réf. partenaire" + +#. module: report_webkit_sample +#: webkit:report.webkitaccount.invoice:0 +msgid "Invoice Ref" +msgstr "Réf. Facture" + +#. module: report_webkit_sample +#: field:account.invoice,amount_tax:0 +msgid "Total" +msgstr "Total" + + +#. module: report_webkit_sample +#: field:account.invoice,name:0 +#: field:account.invoice.line,name:0 +msgid "Description" +msgstr "Description" + +#. module: report_webkit_sample +#: view:account.invoice.line:0 +#: webkit:account.invoice.tax,invoice_id:0 +msgid "Invoice Line" +msgstr "Ligne de facture" + +#. 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: report_webkit_sample +#: field:account.invoice,name:0 +msgid "Document" +msgstr "Ref. document" + +#. module: report_webkit_sample +#: webkit:account.invoice.line,discount:0 +msgid "Disc.(%)" +msgstr "Disc.(%)" + +#. 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" diff --git a/addons/report_webkit_sample/report/__init__.py b/addons/report_webkit_sample/report/__init__.py new file mode 100644 index 00000000000..04cc14f1d80 --- /dev/null +++ b/addons/report_webkit_sample/report/__init__.py @@ -0,0 +1,32 @@ + #-*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com) +# All Right Reserved +# +# Author : Nicolas Bessi (Camptocamp) +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import report_webkit_html
\ No newline at end of file diff --git a/addons/report_webkit_sample/report/report_webkit_html.mako b/addons/report_webkit_sample/report/report_webkit_html.mako new file mode 100644 index 00000000000..909e254fa40 --- /dev/null +++ b/addons/report_webkit_sample/report/report_webkit_html.mako @@ -0,0 +1,83 @@ +<html> +<head> + <style type="text/css"> + ${css} + </style> +</head> +<body> + %for inv in objects : + <% setLang(inv.partner_id.lang) %> + <table class="dest_address"> + <tr><td ><b>${inv.partner_id.title or ''|entity} ${inv.partner_id.name |entity}</b></td></tr> + <tr><td>${inv.address_invoice_id.street or ''|entity}</td></tr> + <tr><td>${inv.address_invoice_id.street2 or ''|entity}</td></tr> + <tr><td>${inv.address_invoice_id.zip or ''|entity} ${inv.address_invoice_id.city or ''|entity}</td></tr> + %if inv.address_invoice_id.country_id : + <tr><td>${inv.address_invoice_id.country_id.name or ''|entity} </td></tr> + %endif + %if inv.address_invoice_id.phone : + <tr><td>${_("Tel")}: ${inv.address_invoice_id.phone|entity}</td></tr> + %endif + %if inv.address_invoice_id.fax : + <tr><td>${_("Fax")}: ${inv.address_invoice_id.fax|entity}</td></tr> + %endif + %if inv.address_invoice_id.email : + <tr><td>${_("E-mail")}: ${inv.address_invoice_id.email|entity}</td></tr> + %endif + %if inv.partner_id.vat : + <tr><td>${_("VAT")}: ${inv.partner_id.vat|entity}</td></tr> + %endif + </table> + <br /> + %if inv.type == 'out_invoice' : + <span class="title">${_("Invoice")} ${inv.number or ''|entity}</span> + %elif inv.type == 'in_invoice' : + <span class="title">${_("Supplier Invoice")} ${inv.number or ''|entity}</span> + %elif inv.type == 'out_refund' : + <span class="title">${_("Refund")} ${inv.number or ''|entity}</span> + %elif inv.type == 'in_refund' : + <span class="title">${_("Supplier Refund")} ${inv.number or ''|entity}</span> + %endif + <br/> + <br/> + <table class="basic_table" width="90%"> + <tr><td>${_("Document")}</td><td>${_("Invoice Date")}</td><td>${_("Partner Ref.")}</td></tr> + <tr><td>${inv.name}</td><td>${formatLang(inv.date_invoice, date=True)|entity}</td><td> </td></tr> + </table> + <h1><br /></h1> + <table class="list_table" width="90%"> + <thead><tr><th>${_("Description")}</th><th class>${_("Taxes")}</th><th class>${_("QTY")}</th><th>${_("Unit Price")}</th><th >${_("Disc.(%)")}</th><th>${_("Price")}</th></tr></thead> + %for line in inv.invoice_line : + <tbody> + <tr><td>${line.name|entity}</td><td>${ ', '.join([ tax.name or '' for tax in line.invoice_line_tax_id ])|entity}</td><td>${line.quantity}</td><td style="text-align:right;">${formatLang(line.price_unit)}</td><td style="text-align:center;">${line.discount or 0.00}</td><td style="text-align:right;">${formatLang(line.price_subtotal)}</td></tr> + %if line.note : + <tr><td colspan="6" style="border-style:none"><pre style="font-family:Helvetica;padding-left:20px">${line.note |entity}</pre></td></tr> + %endif + %endfor + <tr><td style="border-style:none"/><td style="border-style:none"/><td style="border-style:none"/><td style="border-style:none"/><td style="border-top:2px solid"><b>Net Total:</b></td><td style="border-top:2px solid;text-align:right">${formatLang(inv.amount_untaxed)}</td></tr> + <tr><td style="border-style:none"/><td style="border-style:none"/><td style="border-style:none"/><td style="border-style:none"/><td style="border-style:none"><b>Taxes:</b></td><td style="text-align:right">${formatLang(inv.amount_tax)}</td></tr> + <tr><td style="border-style:none"/><td style="border-style:none"/><td style="border-style:none"/><td style="border-style:none"/><td style="border-top:2px solid"><b>Total:</b></td><td style="border-top:2px solid;text-align:right">${formatLang(inv.amount_total)}</td></tr> + </tbody> + </table> + + <table class="list_table" width="40%"> + <tr><th>Tax</th><th>${_("Base")}</th><th>${_("Amount")}</th></tr> + %if inv.tax_line : + %for t in inv.tax_line : + <tr> + <td>${ t.name|entity } </td> + <td>${ t.base|entity}</td> + <td>${ formatLang(t.amount) }</td> + </tr> + %endfor + %endif + <tr> + <td style="border-style:none"/> + <td style="border-top:2px solid"><b>${_("Total")}</b></td> + <td style="border-top:2px solid">${ formatLang(inv.amount_tax) }</td> + </tr> + </table> + <p style="page-break-after:always"></p> + %endfor +</body> +</html>
\ No newline at end of file diff --git a/addons/report_webkit_sample/report/report_webkit_html.py b/addons/report_webkit_sample/report/report_webkit_html.py new file mode 100644 index 00000000000..3e7f70c4154 --- /dev/null +++ b/addons/report_webkit_sample/report/report_webkit_html.py @@ -0,0 +1,17 @@ +import time +from report import report_sxw +from osv import osv + +class report_webkit_html(report_sxw.rml_parse): + def __init__(self, cr, uid, name, context): + super(report_webkit_html, self).__init__(cr, uid, name, context=context) + self.localcontext.update({ + 'time': time, + 'cr':cr, + 'uid': uid, + }) + +report_sxw.report_sxw('report.webkitaccount.invoice', + 'account.invoice', + 'addons/report_webkit_sample/report/report_webkit_html.mako', + parser=report_webkit_html) diff --git a/addons/report_webkit_sample/report_webkit_html_view.xml b/addons/report_webkit_sample/report_webkit_html_view.xml new file mode 100644 index 00000000000..b4839496de2 --- /dev/null +++ b/addons/report_webkit_sample/report_webkit_html_view.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + <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> +</openerp> diff --git a/addons/report_webkit_sample/wizard/__init__.py b/addons/report_webkit_sample/wizard/__init__.py new file mode 100644 index 00000000000..3136f0ca685 --- /dev/null +++ b/addons/report_webkit_sample/wizard/__init__.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com) +# All Right Reserved +# +# Author : Vincent Renaville +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import report_actions
\ No newline at end of file diff --git a/addons/report_webkit_sample/wizard/report_actions.py b/addons/report_webkit_sample/wizard/report_actions.py new file mode 100644 index 00000000000..4eef447f4c2 --- /dev/null +++ b/addons/report_webkit_sample/wizard/report_actions.py @@ -0,0 +1,177 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com) +# All Right Reserved +# +# Author : Vincent Renaville +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import wizard +import pooler +import ir +from tools.translate import _ + +class report_actions_wizard(wizard.interface): + ''' + Add Print Buttons + ''' + form = '''<?xml version="1.0"?> + <form string="Add Print Buttons"> + <field name="print_button"/> + <field name="open_action"/> + </form>''' + + ex_form = '''<?xml version="1.0"?> + <form string="Add Print Buttons"> + <label string="Report Action already exist for this report."/> + </form>''' + + fields = { + 'print_button': + { + 'string': 'Add print button', + 'type': 'boolean', + 'default': True, + 'help':'Add action to menu context in print button.' + }, + 'open_action': + { + 'string': 'Open added action', + 'type': 'boolean', + 'default': False + }, + } + + def _do_action(self, cursor, uid, data, context): + """Called in wizard init""" + pool = pooler.get_pool(cursor.dbname) + report = pool.get(data['model']).browse( + cursor, + uid, + data['id'], + context=context + ) + if data['form']['print_button']: + res = ir.ir_set( + cursor, + uid, + 'action', + 'client_print_multi', + report.report_name, + [report.model], + 'ir.actions.report.xml,%d' % data['id'], + isobject=True + ) + else: + res = ir.ir_set( + cursor, + uid, + 'action', + 'client_print_multi', + report.report_name, + [report.model,0], + 'ir.actions.report.xml,%d' % data['id'], + isobject=True + ) + return {'value_id':res[0]} + + def _check(self, cursor, uid, data, context): + """Check if button exist""" + pool = pooler.get_pool(cursor.dbname) + report = pool.get(data['model']).browse( + cursor, + uid, + data['id'], + context=context + ) + ids = pool.get('ir.values').search( + cursor, + uid, + [('value','=',report.type+','+str(data['id']))] + ) + if not ids: + return 'add' + else: + return 'exist' + + def _action_open_window(self, cursor, uid, data, context): + """Open a windows in client""" + form=data['form'] + if not form['open_action']: + return {} + return { + 'domain':"[('id','=',%d)]" % (form['value_id']), + 'name': _('Client Actions Connections'), + 'view_type': 'form', + 'view_mode': 'tree,form', + 'res_model': 'ir.values', + 'view_id': False, + 'type': 'ir.actions.act_window', + } + + states = { + 'init': { + 'actions': [], + 'result': { + 'type':'choice', + 'next_state':_check + } + }, + 'add': { + 'actions': [], + 'result': { + 'type': 'form', + 'arch': form, + 'fields': fields, + 'state': (('end', '_Cancel'), ('process', '_Ok')) + }, + }, + 'exist': { + 'actions': [], + 'result': { + 'type': 'form', + 'arch': ex_form, + 'fields': {}, + 'state': (('end', '_Close'),) + }, + }, + 'process': { + 'actions': [_do_action], + 'result': { + 'type': 'state', + 'state': 'exit' + }, + }, + 'exit': { + 'actions': [], + 'result': { + 'type': 'action', + 'action': _action_open_window, + 'state': 'end' + }, + }, + } +report_actions_wizard('ir.report_actions')
\ No newline at end of file diff --git a/addons/report_webkit_sample/wizard_report_actions_view.xml b/addons/report_webkit_sample/wizard_report_actions_view.xml new file mode 100644 index 00000000000..02e77b23b56 --- /dev/null +++ b/addons/report_webkit_sample/wizard_report_actions_view.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <wizard string="Add Print Buttons" model="ir.actions.report.xml" name="ir.report_actions" menu="True" id="wizard_oo_report_actions" /> + + </data> +</openerp> +
\ No newline at end of file |
