← Back to team overview

openobject-italia-core-devs team mailing list archive

lp:~openobject-italia-core-devs/openobject-italia/adding_l10n_it_tax_journal into lp:openobject-italia

 

Lorenzo Battistini - Agile BG - Domsense has proposed merging lp:~openobject-italia-core-devs/openobject-italia/adding_l10n_it_tax_journal into lp:openobject-italia.

Requested reviews:
  OpenERP Italia core devs (openobject-italia-core-devs)

For more details, see:
https://code.launchpad.net/~openobject-italia-core-devs/openobject-italia/adding_l10n_it_tax_journal/+merge/71277

https://blueprints.launchpad.net/openobject-italia/+spec/tax-journal
-- 
https://code.launchpad.net/~openobject-italia-core-devs/openobject-italia/adding_l10n_it_tax_journal/+merge/71277
Your team OpenERP Italia core devs is requested to review the proposed merge of lp:~openobject-italia-core-devs/openobject-italia/adding_l10n_it_tax_journal into lp:openobject-italia.
=== added directory 'l10n_it_vat_registries'
=== added file 'l10n_it_vat_registries/AUTHORS.txt'
--- l10n_it_vat_registries/AUTHORS.txt	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/AUTHORS.txt	2011-08-11 20:32:35 +0000
@@ -0,0 +1,2 @@
+Lorenzo Battistini <lorenzo.battistini@xxxxxxxxxxxx>
+Ingrid Barcaro

=== added file 'l10n_it_vat_registries/__init__.py'
--- l10n_it_vat_registries/__init__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/__init__.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,25 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import wizard
+import account
+import invoice

=== added file 'l10n_it_vat_registries/__openerp__.py'
--- l10n_it_vat_registries/__openerp__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/__openerp__.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    'name': 'Italian Localisation - VAT Registries',
+    'version': '0.1',
+    'category': 'Localisation/Italy',
+    'description': """Accounting reports for Italian localization - VAT Registries""",
+    'author': 'OpenERP Italian Community',
+    'website': 'http://www.openerp-italia.org',
+    'license': 'AGPL-3',
+    "depends" : ['l10n_it_base', 'report_webkit', 'l10n_it_account', 'l10n_it_corrispettivi'],
+    "init_xml" : [
+        ],
+    "update_xml" : [
+        'reports.xml',
+        'wizard/print_registro_iva.xml',
+        ],
+    "demo_xml" : [],
+    "active": False,
+    "installable": True
+}

=== added file 'l10n_it_vat_registries/account.py'
--- l10n_it_vat_registries/account.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/account.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,42 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields, osv
+
+class account_tax_code(osv.osv):
+
+    _inherit = 'account.tax.code'
+    _columns = {
+        'tax_ids': fields.one2many('account.tax', 'tax_code_id', 'Taxes'),
+        'base_tax_ids': fields.one2many('account.tax', 'base_code_id', 'Base Taxes'),
+        }
+
+account_tax_code()
+
+class account_invoice_tax(osv.osv):
+
+    _inherit = 'account.tax'
+    _sql_constraints = [
+        ('name_uniq', 'UNIQUE(name)', 'The tax name must be unique!'),
+    ]
+
+account_invoice_tax()

=== added directory 'l10n_it_vat_registries/i18n'
=== added file 'l10n_it_vat_registries/i18n/it.po'
--- l10n_it_vat_registries/i18n/it.po	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/i18n/it.po	2011-08-11 20:32:35 +0000
@@ -0,0 +1,180 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* l10n_it_vat_registries
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.2\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2011-07-23 14:20+0000\n"
+"PO-Revision-Date: 2011-07-23 16:24+0100\n"
+"Last-Translator: Lorenzo Battistini <lorenzo.battistini@xxxxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+
+#. module: l10n_it_vat_registries
+#: model:ir.module.module,description:l10n_it_vat_registries.module_meta_information
+msgid "Accounting reports for Italian localization - VAT Registries"
+msgstr "Report contabili per la localizzazione italiana - Registri IVA"
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_account_tax_code
+msgid "Tax Code"
+msgstr "Codice imposta"
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_vendite_report_id
+msgid "Customer Invoices VAT Registry"
+msgstr "Registro IVA Fatture Emesse"
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_wizard_registro_iva
+msgid "wizard.registro.iva"
+msgstr "wizard.registro.iva"
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Print"
+msgstr "Stampa"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva_corrispettivi.py:68
+#, python-format
+msgid "No invoices found in the selected date range"
+msgstr "Nessuna fattura trovata nell'intervallo di date selezionato"
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,type:0
+msgid "Type"
+msgstr "Tipo"
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Supplier Invoices"
+msgstr "Fatture ricevute"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva.py:86
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva_corrispettivi.py:68
+#, python-format
+msgid "Error !"
+msgstr "Errore !"
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.act_window,name:l10n_it_vat_registries.action_registro_iva
+msgid "VAT Registry"
+msgstr "Registro IVA"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:97
+#, python-format
+msgid "The tax %s has no tax codes"
+msgstr "L'imposta %s non ha codici IVA"
+
+#. module: l10n_it_vat_registries
+#: field:account.tax.code,base_tax_ids:0
+msgid "Base Taxes"
+msgstr "Tasse Imponibili"
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Tax Journal"
+msgstr "Registro IVA"
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,date_to:0
+msgid "To date"
+msgstr "Alla data"
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+#: field:wizard.registro.iva,journal_ids:0
+msgid "Journals"
+msgstr "Sezionali"
+
+#. module: l10n_it_vat_registries
+#: sql_constraint:account.tax:0
+msgid "The tax name must be unique!"
+msgstr "Il nome dell'imposta deve essere unico!"
+
+#. module: l10n_it_vat_registries
+#: help:wizard.registro.iva,journal_ids:0
+msgid "Select journals you want retrieve documents from"
+msgstr "Selezionare i sezionali da cui si vuole ottenere i documenti"
+
+#. module: l10n_it_vat_registries
+#: field:account.tax.code,tax_ids:0
+msgid "Taxes"
+msgstr "Tasse"
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Corrispettivi"
+msgstr "Corrispettivi"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva.py:86
+#, python-format
+msgid "No documents found in the current selection"
+msgstr "Nessun documento trovato per la selezione corrente"
+
+#. module: l10n_it_vat_registries
+#: model:ir.module.module,shortdesc:l10n_it_vat_registries.module_meta_information
+msgid "Italian Localisation - VAT Registries"
+msgstr "Localizzazione Italiana - Registri IVA"
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_acquisti_report_id
+msgid "Supplier Invoices VAT Registry"
+msgstr "Registro IVA Fatture Ricevute"
+
+#. module: l10n_it_vat_registries
+#: model:ir.ui.menu,name:l10n_it_vat_registries.menu_registro_iva
+msgid "VAT Registries"
+msgstr "Registri IVA"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:49
+#, python-format
+msgid "Too many taxes with name %s"
+msgstr "Troppe tasse con nome %s"
+
+#. module: l10n_it_vat_registries
+#: constraint:account.tax.code:0
+msgid "Error ! You can not create recursive accounts."
+msgstr "Errore! Non puoi creare conti ricorsivi"
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Customer Invoices"
+msgstr "Fatture emesse"
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_corrispettivi_report_id
+msgid "Corrispettivi VAT Registry"
+msgstr "Registro IVA Corrispettivi"
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,date_from:0
+msgid "From date"
+msgstr "Dalla data"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:47
+#, python-format
+msgid "The tax %s does not exist"
+msgstr "L'imposta %s non esiste"
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Cancel"
+msgstr "Annulla"
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_account_tax
+msgid "account.tax"
+msgstr "account.tax"
+

=== added file 'l10n_it_vat_registries/i18n/l10n_it_vat_registries.pot'
--- l10n_it_vat_registries/i18n/l10n_it_vat_registries.pot	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/i18n/l10n_it_vat_registries.pot	2011-08-11 20:32:35 +0000
@@ -0,0 +1,180 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* l10n_it_vat_registries
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.2\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2011-07-23 14:18+0000\n"
+"PO-Revision-Date: 2011-07-23 14:18+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: l10n_it_vat_registries
+#: model:ir.module.module,description:l10n_it_vat_registries.module_meta_information
+msgid "Accounting reports for Italian localization - VAT Registries"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_account_tax_code
+msgid "Tax Code"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_vendite_report_id
+msgid "Customer Invoices VAT Registry"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_wizard_registro_iva
+msgid "wizard.registro.iva"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Print"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva_corrispettivi.py:68
+#, python-format
+msgid "No invoices found in the selected date range"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,type:0
+msgid "Type"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Supplier Invoices"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva.py:86
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva_corrispettivi.py:68
+#, python-format
+msgid "Error !"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.act_window,name:l10n_it_vat_registries.action_registro_iva
+msgid "VAT Registry"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:97
+#, python-format
+msgid "The tax %s has no tax codes"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: field:account.tax.code,base_tax_ids:0
+msgid "Base Taxes"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Tax Journal"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,date_to:0
+msgid "To date"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+#: field:wizard.registro.iva,journal_ids:0
+msgid "Journals"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: sql_constraint:account.tax:0
+msgid "The tax name must be unique!"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: help:wizard.registro.iva,journal_ids:0
+msgid "Select journals you want retrieve documents from"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: field:account.tax.code,tax_ids:0
+msgid "Taxes"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Corrispettivi"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva.py:86
+#, python-format
+msgid "No documents found in the current selection"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.module.module,shortdesc:l10n_it_vat_registries.module_meta_information
+msgid "Italian Localisation - VAT Registries"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_acquisti_report_id
+msgid "Supplier Invoices VAT Registry"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.ui.menu,name:l10n_it_vat_registries.menu_registro_iva
+msgid "VAT Registries"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:49
+#, python-format
+msgid "Too many taxes with name %s"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: constraint:account.tax.code:0
+msgid "Error ! You can not create recursive accounts."
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Customer Invoices"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_corrispettivi_report_id
+msgid "Corrispettivi VAT Registry"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,date_from:0
+msgid "From date"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:47
+#, python-format
+msgid "The tax %s does not exist"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Cancel"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_account_tax
+msgid "account.tax"
+msgstr ""
+

=== added file 'l10n_it_vat_registries/invoice.py'
--- l10n_it_vat_registries/invoice.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/invoice.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,144 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from report import report_sxw
+from osv import osv
+from tools.translate import _
+from decimal import *
+
+class Parser(report_sxw.rml_parse):
+
+    def _get_main_tax(self, tax):
+        if not tax.parent_id:
+            return tax
+        else:
+            return self._get_main_tax(tax.parent_id)
+
+    def _get_account_tax(self, inv_tax):
+        splitted_name = inv_tax.name.split(' - ')
+        if len(splitted_name) > 1:
+            tax_name = splitted_name[1]
+        else:
+            tax_name = splitted_name[0]
+        tax_obj = self.pool.get('account.tax')
+        # cerco la tassa per nome, dopo averlo ottenuto dalla tassa in fattura
+        tax_ids = tax_obj.search(self.cr, self.uid, [('name', '=', tax_name)])
+        if not tax_ids:
+            raise Exception(_('The tax %s does not exist') % tax_name)
+        if len(tax_ids) > 1:
+            raise Exception(_('Too many taxes with name %s') % tax_name)
+        return tax_obj.browse(self.cr, self.uid, tax_ids[0])
+
+    def _get_tax_lines(self, invoice):
+        res=[]
+        # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA
+        index=0
+        totale_iva = 0.0
+        totale_iva_inded = 0.0
+        precision = self.pool.get('decimal.precision').precision_get(self.cr, self.uid, 'Account')
+        for inv_tax in invoice.tax_line:
+            tax_item = {}
+            if inv_tax.base_code_id and inv_tax.tax_code_id:
+                account_tax_amount = self._get_account_tax(inv_tax).amount
+                tax_item = {
+                    'tax_percentage': account_tax_amount and str(
+                        account_tax_amount * 100).split('.')[0] or inv_tax.tax_code_id.name,
+                    'base': inv_tax.base,
+                    'amount': inv_tax.amount,
+                    'non_deductible': 0.0,
+                    'index': index,
+                    }
+                res.append(tax_item)
+                totale_iva += inv_tax.amount
+                index += 1
+            # Se non c'è il tax code imponibile, cerco la tassa relativa alla parte non deducibile
+            elif inv_tax.tax_code_id:
+                tax = self._get_main_tax(self._get_account_tax(inv_tax))
+                for inv_tax_2 in invoice.tax_line:
+                    if inv_tax_2.base_code_id and not inv_tax_2.tax_code_id:
+                        base_tax = self._get_main_tax(self._get_account_tax(inv_tax_2))
+                        # Se hanno la stessa tassa
+                        if base_tax.id == tax.id:
+                            tax_item = {
+                                'tax_percentage': base_tax.amount and str(
+                                    base_tax.amount * 100).split('.')[0] or inv_tax.tax_code_id.name,
+                                'base': inv_tax.base + inv_tax_2.base,
+                                'amount': inv_tax.amount + inv_tax_2.amount,
+                                'non_deductible': float(Decimal(str(inv_tax_2.base / (inv_tax.base + inv_tax_2.base) * 100)
+                                    ).quantize(Decimal('.1'), rounding=ROUND_HALF_UP)),
+                                'index': index,
+                                }
+                            res.append(tax_item)
+                            totale_iva += inv_tax.amount
+                            totale_iva_inded += inv_tax_2.amount
+                            index += 1
+                            break
+            elif not inv_tax.tax_code_id and not inv_tax.base_code_id:
+                raise Exception(_('The tax %s has no tax codes') % inv_tax.name)
+
+            if tax_item:
+                if tax_item['tax_percentage'] not in self.localcontext['tax_codes']:
+                    self.localcontext['tax_codes'][tax_item['tax_percentage']] = {
+                        'base': tax_item['base'],
+                        'amount': tax_item['amount'],
+                        }
+                else:
+                    self.localcontext['tax_codes'][tax_item['tax_percentage']]['base'] += tax_item['base']
+                    self.localcontext['tax_codes'][tax_item['tax_percentage']]['amount'] += tax_item['amount']
+
+        self.localcontext['totali']['totale_operazioni'] += invoice.amount_total
+        self.localcontext['totali']['totale_imponibili'] += invoice.amount_untaxed
+# da analizzare           self.totale_variazioni += invoice.amount_total
+        self.localcontext['totali']['totale_iva'] += totale_iva
+        self.localcontext['totali']['totale_iva_inded'] += totale_iva_inded
+
+        return res
+
+    def __init__(self, cr, uid, name, context):
+        super(Parser, self).__init__(cr, uid, name, context)
+        self.localcontext.update({
+            'time': time,
+            'tax_lines': self._get_tax_lines,
+            'totali': {                
+                'totale_operazioni': 0.0,
+                'totale_imponibili': 0.0,
+                'totale_variazioni': 0.0,
+                'totale_iva': 0.0,
+                'totale_iva_inded': 0.0,
+                },
+            'tax_codes': {},
+        })
+
+        
+report_sxw.report_sxw('report.registro_iva_vendite',
+                       'registro_iva_vendite', 
+                       'addons/l10n_it_vat_registries/templates/registro_iva_vendite.mako',
+                       parser=Parser)
+report_sxw.report_sxw('report.registro_iva_acquisti',
+                       'registro_iva_acquisti', 
+                       'addons/l10n_it_vat_registries/templates/registro_iva_acquisti.mako',
+                       parser=Parser)
+report_sxw.report_sxw('report.registro_iva_corrispettivi',
+                       'registro_iva_corrispettivi', 
+                       'addons/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako',
+                       parser=Parser)

=== added file 'l10n_it_vat_registries/reports.xml'
--- l10n_it_vat_registries/reports.xml	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/reports.xml	2011-08-11 20:32:35 +0000
@@ -0,0 +1,112 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+        <record id="ir_header_webkit_vat_registries" model="ir.header_webkit">
+            <field name="orientation">Landscape</field>
+            <field name="format">A4</field>
+            <field name="margin_top">60</field>
+            <field name="html"><![CDATA[<html>
+    <head>
+        <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+        <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()">
+    <% setLang(company.partner_id.lang or "en_US") %>
+    <h1>Registro IVA</h1>
+    <h3>${company.partner_id.name or ''|entity}</h3>
+    <table style="border-bottom: 1px solid black; width: 100%">
+    <tr>
+    <td>
+    <div>${company.partner_id.address and company.partner_id.address[0].street or ''|entity}</div>
+    <div>${company.partner_id.address and company.partner_id.address[0].street2 or ''|entity}</div>
+    <div>${company.partner_id.address and company.partner_id.address[0].zip or ''|entity}</div>
+    <div>${company.partner_id.address and company.partner_id.address[0].city or ''|entity}</div>
+    <div>${company.partner_id.address and company.partner_id.address[0].province and company.partner_id.address[0].province.code or ''|entity}</div>
+    </td>
+    <td>
+    <div>P. IVA: ${company.partner_id.vat or ''|entity}</div>
+    <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div>
+    <div>Codice Attività:</div>
+    <div>Registro Imprese:</div>
+    </td>
+    </tr>
+    </table>
+    <br/>
+    </body>
+</html>]]>
+</field>
+            <field name="footer_html"><![CDATA[<html>
+    <head>
+        <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+        <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 name="css" ><![CDATA[
+tr {
+    page-break-inside: avoid;
+}
+thead{
+    display: table-header-group; /* http://code.google.com/p/wkhtmltopdf/issues/detail?id=9#c8 */
+}
+]]> </field>
+            <field  name="name">Registri IVA</field>
+        </record>
+
+        <record id="registro_iva_vendite_report_id" model="ir.actions.report.xml">
+            <field name="name">Customer Invoices VAT Registry</field>
+            <field name="type">ir.actions.report.xml</field>
+            <field name="model">account.invoice</field>
+            <field name="report_name">registro_iva_vendite</field>
+            <field name="report_type">webkit</field>
+            <field name="report_rml">l10n_it_vat_registries/templates/registro_iva_vendite.mako</field>
+            <field name="webkit_header" ref="ir_header_webkit_vat_registries"/>
+        </record>
+        <record id="registro_iva_acquisti_report_id" model="ir.actions.report.xml">
+            <field name="name">Supplier Invoices VAT Registry</field>
+            <field name="type">ir.actions.report.xml</field>
+            <field name="model">account.invoice</field>
+            <field name="report_name">registro_iva_acquisti</field>
+            <field name="report_type">webkit</field>
+            <field name="report_rml">l10n_it_vat_registries/templates/registro_iva_acquisti.mako</field>
+            <field name="webkit_header" ref="ir_header_webkit_vat_registries"/>
+        </record>
+        <record id="registro_iva_corrispettivi_report_id" model="ir.actions.report.xml">
+            <field name="name">Corrispettivi VAT Registry</field>
+            <field name="type">ir.actions.report.xml</field>
+            <field name="model">account.invoice</field>
+            <field name="report_name">registro_iva_corrispettivi</field>
+            <field name="report_type">webkit</field>
+            <field name="report_rml">l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako</field>
+            <field name="webkit_header" ref="ir_header_webkit_vat_registries"/>
+        </record>
+    </data>
+</openerp>
+

=== added directory 'l10n_it_vat_registries/templates'
=== added file 'l10n_it_vat_registries/templates/registro_iva_acquisti.mako'
--- l10n_it_vat_registries/templates/registro_iva_acquisti.mako	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/templates/registro_iva_acquisti.mako	2011-08-11 20:32:35 +0000
@@ -0,0 +1,106 @@
+<html>
+<head>
+    <style type="text/css">
+        ${css}
+    </style>
+</head>
+<body>
+    <h2>Fatture Ricevute</h2>
+    <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>
+    <table style="width:100%;">
+        <thead>
+        <tr>
+            <th style="text-align:left">Data registrazione</th>
+            <th style="text-align:left">Data fattura</th>
+            <th style="text-align:left">Numero fattura</th>
+            <th style="text-align:left">Ragione sociale</th>
+            <th style="text-align:left">Descrizione</th>
+            <th style="text-align:right">Totale fattura</th>
+            <th style="text-align:right">% IVA</th>
+            <th style="text-align:right">Imponibile</th>
+            <th style="text-align:right">Imposta</th>
+            <th style="text-align:right">% inded.</th>
+            <th></th>
+        </tr>
+        </thead>
+        <tbody>
+        %for object in objects :
+            %for line in tax_lines(object) :
+                <tr><td>
+                %if line['index']==0: 
+                    ${ formatLang(object.move_id.date,date=True) or ''| entity}
+                %endif
+                </td><td>
+                %if line['index']==0:
+                    ${ formatLang(object.date_invoice,date=True) or '' | entity}
+                %endif
+                </td><td>
+                %if line['index']==0:
+                    ${object.number or ''| entity}
+                %endif
+                </td><td>
+                %if line['index']==0:
+                    ${object.partner_id.name | entity}
+                %endif
+                </td><td>
+                %if line['index']==0:
+                    %if object.type == 'in_invoice':
+                        Fattura
+                    %elif object.type == 'in_refund':
+                        Nota di debito
+                    %endif
+                %endif
+                </td><td style="text-align:right">
+                %if line['index']==0:
+                    ${ object.amount_total | entity}
+                %endif
+                </td>
+                <td style="text-align:right">${ line['tax_percentage'] or ''| entity}</td>
+                <td style="text-align:right">${ line['base']  or ''| entity}</td>
+                <td style="text-align:right">${ line['amount']  or ''| entity}</td>
+                <td style="text-align:right">
+                %if line['non_deductible']:
+                    ${ line['non_deductible'] | entity} %
+                %endif
+                </td>
+                <td></td>
+                </tr>
+            %endfor
+        %endfor
+        </tbody>
+    </table>
+    <div style="page-break-inside: avoid;">
+        <br/>
+        <table style="width:100%;  " border="1">
+            <tr style="border-style:ridge;border-width:5px">
+                <td colspan="4" style="padding:10; ">Periodo di stampa dal <strong>${formatLang(data['form']['date_from'],date=True)| entity}</strong> al <strong>${formatLang(data['form']['date_to'],date=True)| entity}</strong></td>
+            </tr>
+            <tr>
+                <td rowspan="2" style="vertical-align:text-top;padding:10">
+                    <table style="width:100%;">
+                        <tr>
+                            <th style="text-align:left">Descrizione</th>
+                            <th style="text-align:right">Imponibile</th>
+                            <th style="text-align:right">Imposta</th>
+                        </tr>
+                        %for tax_code in tax_codes :
+                        <tr>
+                            <td>${tax_code|entity}
+                            </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity}
+                            </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['amount']) or ''|entity}
+                            </td>
+                        </tr>
+                        %endfor
+                    </table>
+                </td><td style="padding:10">Totale operazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_operazioni'])|entity}</strong></p><br/></td>
+                <td colspan="2" style="padding:10">Totale imponibili:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_imponibili'])|entity}</strong></p><br/></td>
+            </tr>
+            <tr>
+                <td style="padding:10">Totale variazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_variazioni'])|entity}</strong></p><br/></td>
+                <td style="padding:10">Totale IVA Detraibile:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva'])|entity}</strong></p><br/></td>
+                <td style="padding:10">Totale IVA Indetraibile:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva_inded'])|entity}</strong></p><br/></td>
+            </tr>
+        </table>
+    </div>
+</body>
+</html>

=== added file 'l10n_it_vat_registries/templates/registro_iva_acquisti.odt'
Binary files l10n_it_vat_registries/templates/registro_iva_acquisti.odt	1970-01-01 00:00:00 +0000 and l10n_it_vat_registries/templates/registro_iva_acquisti.odt	2011-08-11 20:32:35 +0000 differ
=== added file 'l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako'
--- l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako	2011-08-11 20:32:35 +0000
@@ -0,0 +1,80 @@
+<html>
+<head>
+    <style type="text/css">
+        ${css}
+    </style>
+</head>
+<body>
+    <h2>Corrispettivi</h2>
+    <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>
+    <table style="width:100%;">
+        <thead>
+        <tr>
+            <th style="text-align:left">Data registrazione</th>
+            <th style="text-align:left">Descrizione</th>
+            <th style="text-align:right">Importo totale</th>
+            <th style="text-align:right">% IVA</th>
+            <th style="text-align:right">Imponibile</th>
+            <th style="text-align:right">Imposta</th>
+            <th></th>
+        </tr>
+        </thead>
+        <tbody>
+        %for object in objects :
+            %for line in tax_lines(object) :
+                <tr><td>
+                %if line['index']==0: 
+                    ${ formatLang(object.move_id.date,date=True) or ''| entity}
+                %endif
+                </td><td>
+                %if line['index']==0:
+                    Corrispettivo
+                %endif
+                </td><td style="text-align:right">
+                %if line['index']==0:
+                    ${ object.amount_total | entity}
+                %endif
+                </td>
+                <td style="text-align:right">${ line['tax_percentage'] or ''| entity}</td>
+                <td style="text-align:right">${ line['base']  or ''| entity}</td>
+                <td style="text-align:right">${ line['amount']  or ''| entity}</td>
+                <td></td>
+                </tr>
+            %endfor
+        %endfor
+        </tbody>
+    </table>
+    <div style="page-break-inside: avoid;">
+        <br/>
+        <table style="width:100%;  " border="1">
+            <tr style="border-style:ridge;border-width:5px">
+                <td colspan="3" style="padding:10; ">Periodo di stampa dal <strong>${formatLang(data['form']['date_from'],date=True)| entity}</strong> al <strong>${formatLang(data['form']['date_to'],date=True)| entity}</strong></td>
+            </tr>
+            <tr>
+                <td rowspan="2" style="vertical-align:text-top;padding:10">
+                    <table style="width:100%;">
+                        <tr>
+                            <th style="text-align:left">Descrizione</th>
+                            <th style="text-align:right">Imponibile</th>
+                            <th style="text-align:right">Imposta</th>
+                        </tr>
+                        %for tax_code in tax_codes :
+                        <tr>
+                            <td>${tax_code|entity}
+                            </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity}
+                            </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['amount']) or ''|entity}
+                            </td>
+                        </tr>
+                        %endfor
+                    </table>
+                </td><td style="padding:10">Totale operazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_operazioni'])|entity}</strong></p><br/></td>
+                <td style="padding:10">Totale imponibili:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_imponibili'])|entity}</strong></p><br/></td>
+            </tr>
+            <tr>
+                <td style="padding:10">Totale variazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_variazioni'])|entity}</strong></p><br/></td>
+                <td style="padding:10">Totale IVA:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva'])|entity}</strong></p><br/></td>
+            </tr>
+        </table>
+    </div>
+</body>
+</html>

=== added file 'l10n_it_vat_registries/templates/registro_iva_corrispettivi.odt'
Binary files l10n_it_vat_registries/templates/registro_iva_corrispettivi.odt	1970-01-01 00:00:00 +0000 and l10n_it_vat_registries/templates/registro_iva_corrispettivi.odt	2011-08-11 20:32:35 +0000 differ
=== added file 'l10n_it_vat_registries/templates/registro_iva_vendite.mako'
--- l10n_it_vat_registries/templates/registro_iva_vendite.mako	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/templates/registro_iva_vendite.mako	2011-08-11 20:32:35 +0000
@@ -0,0 +1,99 @@
+<html>
+<head>
+    <style type="text/css">
+        ${css}
+    </style>
+</head>
+<body>
+    <h2>Fatture Emesse</h2>
+    <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>
+    <table style="width:100%;">
+        <thead>
+        <tr>
+            <th style="text-align:left">Data registrazione</th>
+            <th style="text-align:left">Data fattura</th>
+            <th style="text-align:left">Numero fattura</th>
+            <th style="text-align:left">Ragione sociale</th>
+            <th style="text-align:left">Descrizione</th>
+            <th style="text-align:right">Totale fattura</th>
+            <th style="text-align:right">% IVA</th>
+            <th style="text-align:right">Imponibile</th>
+            <th style="text-align:right">Imposta</th>
+            <th></th>
+        </tr>
+        </thead>
+        <tbody>
+        %for object in objects :
+            %for line in tax_lines(object) :
+                <tr><td>
+                %if line['index']==0: 
+                    ${ formatLang(object.move_id.date,date=True) or ''| entity}
+                %endif
+                </td><td>
+                %if line['index']==0:
+                    ${ formatLang(object.date_invoice,date=True) or '' | entity}
+                %endif
+                </td><td>
+                %if line['index']==0:
+                    ${object.number or ''| entity}
+                %endif
+                </td><td>
+                %if line['index']==0:
+                    ${object.partner_id.name | entity}
+                %endif
+                </td><td>
+                %if line['index']==0:
+                    %if object.type == 'out_invoice':
+                        Fattura
+                    %elif object.type == 'out_refund':
+                        Nota di credito
+                    %endif
+                %endif
+                </td><td style="text-align:right">
+                %if line['index']==0:
+                    ${ object.amount_total | entity}
+                %endif
+                </td>
+                <td style="text-align:right">${ line['tax_percentage'] or ''| entity}</td>
+                <td style="text-align:right">${ line['base']  or ''| entity}</td>
+                <td style="text-align:right">${ line['amount']  or ''| entity}</td>
+                <td></td>
+                </tr>
+            %endfor
+        %endfor
+        </tbody>
+    </table>
+    <div style="page-break-inside: avoid;">
+        <br/>
+        <table style="width:100%;  " border="1">
+            <tr style="border-style:ridge;border-width:5px">
+                <td colspan="3" style="padding:10; ">Periodo di stampa dal <strong>${formatLang(data['form']['date_from'],date=True)| entity}</strong> al <strong>${formatLang(data['form']['date_to'],date=True)| entity}</strong></td>
+            </tr>
+            <tr>
+                <td rowspan="2" style="vertical-align:text-top;padding:10">
+                    <table style="width:100%;">
+                        <tr>
+                            <th style="text-align:left">Descrizione</th>
+                            <th style="text-align:right">Imponibile</th>
+                            <th style="text-align:right">Imposta</th>
+                        </tr>
+                        %for tax_code in tax_codes :
+                        <tr>
+                            <td>${tax_code|entity}
+                            </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity}
+                            </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['amount']) or ''|entity}
+                            </td>
+                        </tr>
+                        %endfor
+                    </table>
+                </td><td style="padding:10">Totale operazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_operazioni'])|entity}</strong></p><br/></td>
+                <td style="padding:10">Totale imponibili:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_imponibili'])|entity}</strong></p><br/></td>
+            </tr>
+            <tr>
+                <td style="padding:10">Totale variazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_variazioni'])|entity}</strong></p><br/></td>
+                <td style="padding:10">Totale IVA:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva'])|entity}</strong></p><br/></td>
+            </tr>
+        </table>
+    </div>
+</body>
+</html>

=== added file 'l10n_it_vat_registries/templates/registro_iva_vendite.odt'
Binary files l10n_it_vat_registries/templates/registro_iva_vendite.odt	1970-01-01 00:00:00 +0000 and l10n_it_vat_registries/templates/registro_iva_vendite.odt	2011-08-11 20:32:35 +0000 differ
=== added directory 'l10n_it_vat_registries/wizard'
=== added file 'l10n_it_vat_registries/wizard/__init__.py'
--- l10n_it_vat_registries/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/wizard/__init__.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import print_registro_iva

=== added file 'l10n_it_vat_registries/wizard/print_registro_iva.py'
--- l10n_it_vat_registries/wizard/print_registro_iva.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/wizard/print_registro_iva.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,114 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields,osv
+from tools.translate import _
+import time
+
+class wizard_registro_iva(osv.osv_memory):
+
+    _name = "wizard.registro.iva"
+    _columns = {
+        'date_from': fields.date('From date', required=True),
+        'date_to': fields.date('To date', required=True),
+        'type': fields.selection([
+            ('customer', 'Customer Invoices'),
+            ('supplier', 'Supplier Invoices'),
+            ('corrispettivi', 'Corrispettivi'),
+            ], 'Type', required=True),
+        'journal_ids': fields.many2many('account.journal', 'registro_iva_journals_rel', 'journal_id', 'registro_id', 'Journals', help='Select journals you want retrieve documents from', required=True),
+        'message': fields.char('Message', size=64, readonly=True),
+        }
+    _defaults = {
+        'type': 'customer',
+        'date_from': lambda * a: time.strftime('%Y-%m-%d'),
+        'date_to': lambda * a: time.strftime('%Y-%m-%d'),
+        'journal_ids': lambda s, cr, uid, c: s.pool.get('account.journal').search(cr, uid, []),
+        }
+
+    def print_registro(self, cr, uid, ids, context=None):
+        inv_ids = []
+        wizard = self.read(cr, uid, ids)[0]
+        inv_obj = self.pool.get('account.invoice')
+        search_list = []
+        if wizard['type'] == 'customer':
+            search_list = [
+                ('journal_id', 'in', wizard['journal_ids']),
+                ('corrispettivo', '=', False),
+                ('move_id.date', '<=', wizard['date_to']),
+                ('move_id.date', '>=', wizard['date_from']),
+                '|',
+                ('type', '=', 'out_invoice'),
+                ('type', '=', 'out_refund'),
+                '|',
+                ('state', '=', 'open'),
+                ('state', '=', 'paid'),
+                ]
+        elif wizard['type'] == 'supplier':
+            search_list = [
+                ('journal_id', 'in', wizard['journal_ids']),
+                ('corrispettivo', '=', False),
+                ('move_id.date', '<=', wizard['date_to']),
+                ('move_id.date', '>=', wizard['date_from']),
+                '|',
+                ('type', '=', 'in_invoice'),
+                ('type', '=', 'in_refund'),
+                '|',
+                ('state', '=', 'open'),
+                ('state', '=', 'paid'),
+                ]
+        elif wizard['type'] == 'corrispettivi':
+            search_list = [
+                ('journal_id', 'in', wizard['journal_ids']),
+                ('corrispettivo', '=', True),
+                ('move_id.date', '<=', wizard['date_to']),
+                ('move_id.date', '>=', wizard['date_from']),
+                '|',
+                ('type', '=', 'out_invoice'),
+                ('type', '=', 'out_refund'),
+                '|',
+                ('state', '=', 'open'),
+                ('state', '=', 'paid'),
+                ]
+        inv_ids = inv_obj.search(cr, uid, search_list)
+        if not inv_ids:
+            self.write(cr, uid,  ids, {'message': _('No documents found in the current selection')})
+            return
+        if context is None:
+            context = {}
+        datas = {'ids': inv_ids}
+        datas['model'] = 'account.invoice'
+        datas['form'] = wizard
+        datas['inv_ids'] = inv_ids
+        res= {
+            'type': 'ir.actions.report.xml',
+            'datas': datas,
+        }
+        if wizard['type'] == 'customer':
+            res['report_name'] = 'registro_iva_vendite'
+        elif wizard['type'] == 'supplier':
+            res['report_name'] = 'registro_iva_acquisti'
+        elif wizard['type'] == 'corrispettivi':
+            res['report_name'] = 'registro_iva_corrispettivi'
+        return res
+
+wizard_registro_iva()

=== added file 'l10n_it_vat_registries/wizard/print_registro_iva.xml'
--- l10n_it_vat_registries/wizard/print_registro_iva.xml	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/wizard/print_registro_iva.xml	2011-08-11 20:32:35 +0000
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="wizard_registro_iva" model="ir.ui.view">
+            <field name="name">VAT Registry</field>
+            <field name="model">wizard.registro.iva</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Tax Journal">
+                    <field name="date_from"/>
+                    <field name="date_to"/>
+                    <field name="type" colspan="4"/>
+                    <separator string="Journals" colspan="4"/>
+                    <field name="journal_ids" colspan="4" nolabel="1" height="250"/>
+                    <button icon="gtk-cancel" special="cancel" string="Cancel"/>
+                    <button icon="gtk-ok" name="print_registro" string="Print" type="object"/>
+                    <newline/>
+                    <field name="message" nolabel="1" colspan="4"/>
+                </form>
+            </field>
+        </record>
+
+        <record id="action_registro_iva" model="ir.actions.act_window">
+            <field name="name">VAT Registry</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">wizard.registro.iva</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="target">new</field>
+        </record>
+
+        <menuitem
+            name="VAT Registries"
+            parent="account.menu_finance_reporting"
+            action="action_registro_iva"
+            id="menu_registro_iva"
+            icon="STOCK_PRINT"/>
+
+    </data>
+</openerp>

=== added directory 'l10n_it_vat_registries_aeroo'
=== added file 'l10n_it_vat_registries_aeroo/AUTHORS.txt'
--- l10n_it_vat_registries_aeroo/AUTHORS.txt	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/AUTHORS.txt	2011-08-11 20:32:35 +0000
@@ -0,0 +1,2 @@
+Lorenzo Battistini <lorenzo.battistini@xxxxxxxxxxxx>
+Ingrid Barcaro

=== added file 'l10n_it_vat_registries_aeroo/__init__.py'
--- l10n_it_vat_registries_aeroo/__init__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/__init__.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import wizard
+import account

=== added file 'l10n_it_vat_registries_aeroo/__openerp__.py'
--- l10n_it_vat_registries_aeroo/__openerp__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/__openerp__.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    'name': 'Italian Localisation - VAT Registries',
+    'version': '0.1',
+    'category': 'Localisation/Italy',
+    'description': """Accounting reports for Italian localization - VAT Registries""",
+    'author': 'OpenERP Italian Community',
+    'website': 'http://www.openerp-italia.org',
+    'license': 'AGPL-3',
+    "depends" : ['l10n_it_base', 'report_aeroo_ooo', 'l10n_it_account', 'l10n_it_corrispettivi'],
+    "init_xml" : [
+        ],
+    "update_xml" : [
+        'reports.xml',
+        'wizard/print_registro_iva.xml',
+        ],
+    "demo_xml" : [],
+    "active": False,
+    "installable": True
+}

=== added file 'l10n_it_vat_registries_aeroo/account.py'
--- l10n_it_vat_registries_aeroo/account.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/account.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,42 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields, osv
+
+class account_tax_code(osv.osv):
+
+    _inherit = 'account.tax.code'
+    _columns = {
+        'tax_ids': fields.one2many('account.tax', 'tax_code_id', 'Taxes'),
+        'base_tax_ids': fields.one2many('account.tax', 'base_code_id', 'Base Taxes'),
+        }
+
+account_tax_code()
+
+class account_invoice_tax(osv.osv):
+
+    _inherit = 'account.tax'
+    _sql_constraints = [
+        ('name_uniq', 'UNIQUE(name)', 'The tax name must be unique!'),
+    ]
+
+account_invoice_tax()

=== added directory 'l10n_it_vat_registries_aeroo/i18n'
=== added file 'l10n_it_vat_registries_aeroo/i18n/it.po'
--- l10n_it_vat_registries_aeroo/i18n/it.po	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/i18n/it.po	2011-08-11 20:32:35 +0000
@@ -0,0 +1,180 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* l10n_it_vat_registries
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.2\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2011-07-23 14:20+0000\n"
+"PO-Revision-Date: 2011-07-23 16:24+0100\n"
+"Last-Translator: Lorenzo Battistini <lorenzo.battistini@xxxxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+
+#. module: l10n_it_vat_registries
+#: model:ir.module.module,description:l10n_it_vat_registries.module_meta_information
+msgid "Accounting reports for Italian localization - VAT Registries"
+msgstr "Report contabili per la localizzazione italiana - Registri IVA"
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_account_tax_code
+msgid "Tax Code"
+msgstr "Codice imposta"
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_vendite_report_id
+msgid "Customer Invoices VAT Registry"
+msgstr "Registro IVA Fatture Emesse"
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_wizard_registro_iva
+msgid "wizard.registro.iva"
+msgstr "wizard.registro.iva"
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Print"
+msgstr "Stampa"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva_corrispettivi.py:68
+#, python-format
+msgid "No invoices found in the selected date range"
+msgstr "Nessuna fattura trovata nell'intervallo di date selezionato"
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,type:0
+msgid "Type"
+msgstr "Tipo"
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Supplier Invoices"
+msgstr "Fatture ricevute"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva.py:86
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva_corrispettivi.py:68
+#, python-format
+msgid "Error !"
+msgstr "Errore !"
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.act_window,name:l10n_it_vat_registries.action_registro_iva
+msgid "VAT Registry"
+msgstr "Registro IVA"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:97
+#, python-format
+msgid "The tax %s has no tax codes"
+msgstr "L'imposta %s non ha codici IVA"
+
+#. module: l10n_it_vat_registries
+#: field:account.tax.code,base_tax_ids:0
+msgid "Base Taxes"
+msgstr "Tasse Imponibili"
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Tax Journal"
+msgstr "Registro IVA"
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,date_to:0
+msgid "To date"
+msgstr "Alla data"
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+#: field:wizard.registro.iva,journal_ids:0
+msgid "Journals"
+msgstr "Sezionali"
+
+#. module: l10n_it_vat_registries
+#: sql_constraint:account.tax:0
+msgid "The tax name must be unique!"
+msgstr "Il nome dell'imposta deve essere unico!"
+
+#. module: l10n_it_vat_registries
+#: help:wizard.registro.iva,journal_ids:0
+msgid "Select journals you want retrieve documents from"
+msgstr "Selezionare i sezionali da cui si vuole ottenere i documenti"
+
+#. module: l10n_it_vat_registries
+#: field:account.tax.code,tax_ids:0
+msgid "Taxes"
+msgstr "Tasse"
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Corrispettivi"
+msgstr "Corrispettivi"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva.py:86
+#, python-format
+msgid "No documents found in the current selection"
+msgstr "Nessun documento trovato per la selezione corrente"
+
+#. module: l10n_it_vat_registries
+#: model:ir.module.module,shortdesc:l10n_it_vat_registries.module_meta_information
+msgid "Italian Localisation - VAT Registries"
+msgstr "Localizzazione Italiana - Registri IVA"
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_acquisti_report_id
+msgid "Supplier Invoices VAT Registry"
+msgstr "Registro IVA Fatture Ricevute"
+
+#. module: l10n_it_vat_registries
+#: model:ir.ui.menu,name:l10n_it_vat_registries.menu_registro_iva
+msgid "VAT Registries"
+msgstr "Registri IVA"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:49
+#, python-format
+msgid "Too many taxes with name %s"
+msgstr "Troppe tasse con nome %s"
+
+#. module: l10n_it_vat_registries
+#: constraint:account.tax.code:0
+msgid "Error ! You can not create recursive accounts."
+msgstr "Errore! Non puoi creare conti ricorsivi"
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Customer Invoices"
+msgstr "Fatture emesse"
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_corrispettivi_report_id
+msgid "Corrispettivi VAT Registry"
+msgstr "Registro IVA Corrispettivi"
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,date_from:0
+msgid "From date"
+msgstr "Dalla data"
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:47
+#, python-format
+msgid "The tax %s does not exist"
+msgstr "L'imposta %s non esiste"
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Cancel"
+msgstr "Annulla"
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_account_tax
+msgid "account.tax"
+msgstr "account.tax"
+

=== added file 'l10n_it_vat_registries_aeroo/i18n/l10n_it_vat_registries.pot'
--- l10n_it_vat_registries_aeroo/i18n/l10n_it_vat_registries.pot	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/i18n/l10n_it_vat_registries.pot	2011-08-11 20:32:35 +0000
@@ -0,0 +1,180 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* l10n_it_vat_registries
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.2\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2011-07-23 14:18+0000\n"
+"PO-Revision-Date: 2011-07-23 14:18+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: l10n_it_vat_registries
+#: model:ir.module.module,description:l10n_it_vat_registries.module_meta_information
+msgid "Accounting reports for Italian localization - VAT Registries"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_account_tax_code
+msgid "Tax Code"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_vendite_report_id
+msgid "Customer Invoices VAT Registry"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_wizard_registro_iva
+msgid "wizard.registro.iva"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Print"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva_corrispettivi.py:68
+#, python-format
+msgid "No invoices found in the selected date range"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,type:0
+msgid "Type"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Supplier Invoices"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva.py:86
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva_corrispettivi.py:68
+#, python-format
+msgid "Error !"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.act_window,name:l10n_it_vat_registries.action_registro_iva
+msgid "VAT Registry"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:97
+#, python-format
+msgid "The tax %s has no tax codes"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: field:account.tax.code,base_tax_ids:0
+msgid "Base Taxes"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Tax Journal"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,date_to:0
+msgid "To date"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+#: field:wizard.registro.iva,journal_ids:0
+msgid "Journals"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: sql_constraint:account.tax:0
+msgid "The tax name must be unique!"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: help:wizard.registro.iva,journal_ids:0
+msgid "Select journals you want retrieve documents from"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: field:account.tax.code,tax_ids:0
+msgid "Taxes"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Corrispettivi"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva.py:86
+#, python-format
+msgid "No documents found in the current selection"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.module.module,shortdesc:l10n_it_vat_registries.module_meta_information
+msgid "Italian Localisation - VAT Registries"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_acquisti_report_id
+msgid "Supplier Invoices VAT Registry"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.ui.menu,name:l10n_it_vat_registries.menu_registro_iva
+msgid "VAT Registries"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:49
+#, python-format
+msgid "Too many taxes with name %s"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: constraint:account.tax.code:0
+msgid "Error ! You can not create recursive accounts."
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: selection:wizard.registro.iva,type:0
+msgid "Customer Invoices"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_corrispettivi_report_id
+msgid "Corrispettivi VAT Registry"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: field:wizard.registro.iva,date_from:0
+msgid "From date"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: code:addons/l10n_it_vat_registries/invoice.py:47
+#, python-format
+msgid "The tax %s does not exist"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: view:wizard.registro.iva:0
+msgid "Cancel"
+msgstr ""
+
+#. module: l10n_it_vat_registries
+#: model:ir.model,name:l10n_it_vat_registries.model_account_tax
+msgid "account.tax"
+msgstr ""
+

=== added file 'l10n_it_vat_registries_aeroo/invoice.py'
--- l10n_it_vat_registries_aeroo/invoice.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/invoice.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,130 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from report import report_sxw
+from osv import osv
+from tools.translate import _
+from decimal import *
+
+class Parser(report_sxw.rml_parse):
+
+    def _get_main_tax(self, tax):
+        if not tax.parent_id:
+            return tax
+        else:
+            return self._get_main_tax(tax.parent_id)
+
+    def _get_account_tax(self, inv_tax):
+        splitted_name = inv_tax.name.split(' - ')
+        if len(splitted_name) > 1:
+            tax_name = splitted_name[1]
+        else:
+            tax_name = splitted_name[0]
+        tax_obj = self.pool.get('account.tax')
+        # cerco la tassa per nome, dopo averlo ottenuto dalla tassa in fattura
+        tax_ids = tax_obj.search(self.cr, self.uid, [('name', '=', tax_name)])
+        if not tax_ids:
+            raise Exception(_('The tax %s does not exist') % tax_name)
+        if len(tax_ids) > 1:
+            raise Exception(_('Too many taxes with name %s') % tax_name)
+        return tax_obj.browse(self.cr, self.uid, tax_ids[0])
+
+    def _get_tax_lines(self, invoice):
+        res=[]
+        # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA
+        index=0
+        totale_iva = 0.0
+        totale_iva_inded = 0.0
+        precision = self.pool.get('decimal.precision').precision_get(self.cr, self.uid, 'Account')
+        for inv_tax in invoice.tax_line:
+            tax_item = {}
+            if inv_tax.base_code_id and inv_tax.tax_code_id:
+                account_tax_amount = self._get_account_tax(inv_tax).amount
+                tax_item = {
+                    'tax_percentage': account_tax_amount and str(
+                        account_tax_amount * 100).split('.')[0] or inv_tax.tax_code_id.name,
+                    'base': inv_tax.base,
+                    'amount': inv_tax.amount,
+                    'non_deductible': 0.0,
+                    'index': index,
+                    }
+                res.append(tax_item)
+                totale_iva += inv_tax.amount
+                index += 1
+            # Se non c'è il tax code imponibile, cerco la tassa relativa alla parte non deducibile
+            elif inv_tax.tax_code_id:
+                tax = self._get_main_tax(self._get_account_tax(inv_tax))
+                for inv_tax_2 in invoice.tax_line:
+                    if inv_tax_2.base_code_id and not inv_tax_2.tax_code_id:
+                        base_tax = self._get_main_tax(self._get_account_tax(inv_tax_2))
+                        # Se hanno la stessa tassa
+                        if base_tax.id == tax.id:
+                            tax_item = {
+                                'tax_percentage': base_tax.amount and str(
+                                    base_tax.amount * 100).split('.')[0] or inv_tax.tax_code_id.name,
+                                'base': inv_tax.base + inv_tax_2.base,
+                                'amount': inv_tax.amount + inv_tax_2.amount,
+                                'non_deductible': float(Decimal(str(inv_tax_2.base / (inv_tax.base + inv_tax_2.base) * 100)
+                                    ).quantize(Decimal('.1'), rounding=ROUND_HALF_UP)),
+                                'index': index,
+                                }
+                            res.append(tax_item)
+                            totale_iva += inv_tax.amount
+                            totale_iva_inded += inv_tax_2.amount
+                            index += 1
+                            break
+            elif not inv_tax.tax_code_id and not inv_tax.base_code_id:
+                raise Exception(_('The tax %s has no tax codes') % inv_tax.name)
+
+            if tax_item:
+                if tax_item['tax_percentage'] not in self.localcontext['tax_codes']:
+                    self.localcontext['tax_codes'][tax_item['tax_percentage']] = {
+                        'base': tax_item['base'],
+                        'amount': tax_item['amount'],
+                        }
+                else:
+                    self.localcontext['tax_codes'][tax_item['tax_percentage']]['base'] += tax_item['base']
+                    self.localcontext['tax_codes'][tax_item['tax_percentage']]['amount'] += tax_item['amount']
+
+        self.localcontext['totali']['totale_operazioni'] += invoice.amount_total
+        self.localcontext['totali']['totale_imponibili'] += invoice.amount_untaxed
+# da analizzare           self.totale_variazioni += invoice.amount_total
+        self.localcontext['totali']['totale_iva'] += totale_iva
+        self.localcontext['totali']['totale_iva_inded'] += totale_iva_inded
+
+        return res
+
+    def __init__(self, cr, uid, name, context):
+        super(Parser, self).__init__(cr, uid, name, context)
+        self.localcontext.update({
+            'time': time,
+            'tax_lines': self._get_tax_lines,
+            'totali': {                
+                'totale_operazioni': 0.0,
+                'totale_imponibili': 0.0,
+                'totale_variazioni': 0.0,
+                'totale_iva': 0.0,
+                'totale_iva_inded': 0.0,
+                },
+            'tax_codes': {},
+        })

=== added file 'l10n_it_vat_registries_aeroo/reports.xml'
--- l10n_it_vat_registries_aeroo/reports.xml	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/reports.xml	2011-08-11 20:32:35 +0000
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+        <record id="registro_iva_vendite_report_id" model="ir.actions.report.xml">
+            <field name="name">Customer Invoices VAT Registry</field>
+            <field name="type">ir.actions.report.xml</field>
+            <field name="model">account.invoice</field>
+            <field name="report_name">registro_iva_vendite</field>
+            <field name="report_type">aeroo</field>
+            <field name="tml_source">file</field>
+            <field name="in_format">oo-odt</field>
+            <field name="out_format" eval="ref('report_aeroo_ooo.report_mimetypes_pdf_odt')"></field>
+            <field name="parser_loc">l10n_it_vat_registries/invoice.py</field>
+            <field name="report_rml">l10n_it_vat_registries/templates/registro_iva_vendite.odt</field>
+            <field name="parser_state">loc</field>
+        </record>
+        <record id="registro_iva_acquisti_report_id" model="ir.actions.report.xml">
+            <field name="name">Supplier Invoices VAT Registry</field>
+            <field name="type">ir.actions.report.xml</field>
+            <field name="model">account.invoice</field>
+            <field name="report_name">registro_iva_acquisti</field>
+            <field name="report_type">aeroo</field>
+            <field name="tml_source">file</field>
+            <field name="in_format">oo-odt</field>
+            <field name="out_format" eval="ref('report_aeroo_ooo.report_mimetypes_pdf_odt')"></field>
+            <field name="parser_loc">l10n_it_vat_registries/invoice.py</field>
+            <field name="report_rml">l10n_it_vat_registries/templates/registro_iva_acquisti.odt</field>
+            <field name="parser_state">loc</field>
+        </record>
+        <record id="registro_iva_corrispettivi_report_id" model="ir.actions.report.xml">
+            <field name="name">Corrispettivi VAT Registry</field>
+            <field name="type">ir.actions.report.xml</field>
+            <field name="model">account.invoice</field>
+            <field name="report_name">registro_iva_corrispettivi</field>
+            <field name="report_type">aeroo</field>
+            <field name="tml_source">file</field>
+            <field name="in_format">oo-odt</field>
+            <field name="out_format" eval="ref('report_aeroo_ooo.report_mimetypes_pdf_odt')"></field>
+            <field name="parser_loc">l10n_it_vat_registries/invoice.py</field>
+            <field name="report_rml">l10n_it_vat_registries/templates/registro_iva_corrispettivi.odt</field>
+            <field name="parser_state">loc</field>
+        </record>
+    </data>
+</openerp>
+

=== added directory 'l10n_it_vat_registries_aeroo/templates'
=== added file 'l10n_it_vat_registries_aeroo/templates/registro_iva_acquisti.odt'
Binary files l10n_it_vat_registries_aeroo/templates/registro_iva_acquisti.odt	1970-01-01 00:00:00 +0000 and l10n_it_vat_registries_aeroo/templates/registro_iva_acquisti.odt	2011-08-11 20:32:35 +0000 differ
=== added file 'l10n_it_vat_registries_aeroo/templates/registro_iva_corrispettivi.odt'
Binary files l10n_it_vat_registries_aeroo/templates/registro_iva_corrispettivi.odt	1970-01-01 00:00:00 +0000 and l10n_it_vat_registries_aeroo/templates/registro_iva_corrispettivi.odt	2011-08-11 20:32:35 +0000 differ
=== added file 'l10n_it_vat_registries_aeroo/templates/registro_iva_vendite.odt'
Binary files l10n_it_vat_registries_aeroo/templates/registro_iva_vendite.odt	1970-01-01 00:00:00 +0000 and l10n_it_vat_registries_aeroo/templates/registro_iva_vendite.odt	2011-08-11 20:32:35 +0000 differ
=== added directory 'l10n_it_vat_registries_aeroo/wizard'
=== added file 'l10n_it_vat_registries_aeroo/wizard/__init__.py'
--- l10n_it_vat_registries_aeroo/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/wizard/__init__.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import print_registro_iva

=== added file 'l10n_it_vat_registries_aeroo/wizard/print_registro_iva.py'
--- l10n_it_vat_registries_aeroo/wizard/print_registro_iva.py	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/wizard/print_registro_iva.py	2011-08-11 20:32:35 +0000
@@ -0,0 +1,105 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 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 Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields,osv
+from tools.translate import _
+
+class wizard_registro_iva(osv.osv_memory):
+
+    _name = "wizard.registro.iva"
+    _columns = {
+        'date_from': fields.date('From date', required=True),
+        'date_to': fields.date('To date', required=True),
+        'type': fields.selection([
+            ('customer', 'Customer Invoices'),
+            ('supplier', 'Supplier Invoices'),
+            ('corrispettivi', 'Corrispettivi'),
+            ], 'Type', required=True),
+        'journal_ids': fields.many2many('account.journal', 'registro_iva_journals_rel', 'journal_id', 'registro_id', 'Journals', help='Select journals you want retrieve documents from', required=True),
+    }
+
+    def print_registro(self, cr, uid, ids, context=None):
+        inv_ids = []
+        wizard = self.read(cr, uid, ids)[0]
+        inv_obj = self.pool.get('account.invoice')
+        search_list = []
+        if wizard['type'] == 'customer':
+            search_list = [
+                ('journal_id', 'in', wizard['journal_ids']),
+                ('corrispettivo', '=', False),
+                ('move_id.date', '<=', wizard['date_to']),
+                ('move_id.date', '>=', wizard['date_from']),
+                '|',
+                ('type', '=', 'out_invoice'),
+                ('type', '=', 'out_refund'),
+                '|',
+                ('state', '=', 'open'),
+                ('state', '=', 'paid'),
+                ]
+        elif wizard['type'] == 'supplier':
+            search_list = [
+                ('journal_id', 'in', wizard['journal_ids']),
+                ('corrispettivo', '=', False),
+                ('move_id.date', '<=', wizard['date_to']),
+                ('move_id.date', '>=', wizard['date_from']),
+                '|',
+                ('type', '=', 'in_invoice'),
+                ('type', '=', 'in_refund'),
+                '|',
+                ('state', '=', 'open'),
+                ('state', '=', 'paid'),
+                ]
+        elif wizard['type'] == 'corrispettivi':
+            search_list = [
+                ('journal_id', 'in', wizard['journal_ids']),
+                ('corrispettivo', '=', True),
+                ('move_id.date', '<=', wizard['date_to']),
+                ('move_id.date', '>=', wizard['date_from']),
+                '|',
+                ('type', '=', 'out_invoice'),
+                ('type', '=', 'out_refund'),
+                '|',
+                ('state', '=', 'open'),
+                ('state', '=', 'paid'),
+                ]
+        inv_ids = inv_obj.search(cr, uid, search_list)
+        if not inv_ids:
+            raise osv.except_osv(_('Error !'), _('No documents found in the current selection'))
+        if context is None:
+            context = {}
+        datas = {'ids': inv_ids}
+        datas['model'] = 'account.invoice'
+        datas['form'] = wizard
+        datas['inv_ids'] = inv_ids
+        res= {
+            'type': 'ir.actions.report.xml',
+            'datas': datas,
+        }
+        if wizard['type'] == 'customer':
+            res['report_name'] = 'registro_iva_vendite'
+        elif wizard['type'] == 'supplier':
+            res['report_name'] = 'registro_iva_acquisti'
+        elif wizard['type'] == 'corrispettivi':
+            res['report_name'] = 'registro_iva_corrispettivi'
+        return res
+
+wizard_registro_iva()

=== added file 'l10n_it_vat_registries_aeroo/wizard/print_registro_iva.xml'
--- l10n_it_vat_registries_aeroo/wizard/print_registro_iva.xml	1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries_aeroo/wizard/print_registro_iva.xml	2011-08-11 20:32:35 +0000
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="wizard_registro_iva" model="ir.ui.view">
+            <field name="name">VAT Registry</field>
+            <field name="model">wizard.registro.iva</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Tax Journal">
+                    <field name="date_from"/>
+                    <field name="date_to"/>
+                    <field name="type" colspan="4"/>
+                    <separator string="Journals" colspan="4"/>
+                    <field name="journal_ids" colspan="4" nolabel="1"/>
+                    <button icon="gtk-cancel" special="cancel" string="Cancel"/>
+                    <button icon="gtk-ok" name="print_registro" string="Print" type="object"/>
+                </form>
+            </field>
+        </record>
+
+        <record id="action_registro_iva" model="ir.actions.act_window">
+            <field name="name">VAT Registry</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">wizard.registro.iva</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="target">new</field>
+        </record>
+
+        <menuitem
+            name="VAT Registries"
+            parent="account.menu_finance_reporting"
+            action="action_registro_iva"
+            id="menu_registro_iva"
+            icon="STOCK_PRINT"/>
+
+    </data>
+</openerp>


Follow ups