Merge lp:~openobject-italia-core-devs/openobject-italia/adding_l10n_it_tax_journal into lp:~openobject-italia-core-devs/openobject-italia/italian-addons

Proposed by Lorenzo Battistini
Status: Merged
Merged at revision: 121
Proposed branch: lp:~openobject-italia-core-devs/openobject-italia/adding_l10n_it_tax_journal
Merge into: lp:~openobject-italia-core-devs/openobject-italia/italian-addons
Diff against target: 1317 lines (+1239/-0)
15 files modified
l10n_it_vat_registries/AUTHORS.txt (+2/-0)
l10n_it_vat_registries/__init__.py (+25/-0)
l10n_it_vat_registries/__openerp__.py (+41/-0)
l10n_it_vat_registries/account.py (+46/-0)
l10n_it_vat_registries/account_view.xml (+17/-0)
l10n_it_vat_registries/i18n/it.po (+185/-0)
l10n_it_vat_registries/i18n/l10n_it_vat_registries.pot (+185/-0)
l10n_it_vat_registries/invoice.py (+163/-0)
l10n_it_vat_registries/reports.xml (+112/-0)
l10n_it_vat_registries/templates/registro_iva_acquisti.mako (+106/-0)
l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako (+80/-0)
l10n_it_vat_registries/templates/registro_iva_vendite.mako (+99/-0)
l10n_it_vat_registries/wizard/__init__.py (+23/-0)
l10n_it_vat_registries/wizard/print_registro_iva.py (+114/-0)
l10n_it_vat_registries/wizard/print_registro_iva.xml (+41/-0)
To merge this branch: bzr merge lp:~openobject-italia-core-devs/openobject-italia/adding_l10n_it_tax_journal
Reviewer Review Type Date Requested Status
Davide Corio (community) Approve
Review via email: mp+71277@code.launchpad.net
To post a comment you must log in.
131. By Lorenzo Battistini

[FIX] coding

132. By Lorenzo Battistini

[IMP] non VAT management

133. By Lorenzo Battistini

[imp] translation

Revision history for this message
Davide Corio (enlightx-deactivatedaccount) wrote :

mi pare funzionare tutto correttamente dal punto di vista tecnico

review: Approve
134. By Lorenzo Battistini

[DEL] old odt templates

135. By Lorenzo Battistini

[DEL] l10n_it_vat_registries_aeroo moved to https://code.launchpad.net/~openobject-italia-core-devs/openobject-italia/l10n_it_vat_registries_aeroo

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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-24 09:56:24 +0000
@@ -0,0 +1,2 @@
1Lorenzo Battistini <lorenzo.battistini@domsense.com>
2Ingrid Barcaro
03
=== 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-24 09:56:24 +0000
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>).
6# All Rights Reserved
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import wizard
24import account
25import invoice
026
=== 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-24 09:56:24 +0000
@@ -0,0 +1,41 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>).
6# All Rights Reserved
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22{
23 'name': 'Italian Localisation - VAT Registries',
24 'version': '0.1',
25 'category': 'Localisation/Italy',
26 'description': """Accounting reports for Italian localization - VAT Registries\nhttp://wiki.openerp-italia.org/doku.php/moduli/l10n_it_tax_journal""",
27 'author': 'OpenERP Italian Community',
28 'website': 'http://www.openerp-italia.org',
29 'license': 'AGPL-3',
30 "depends" : ['l10n_it_base', 'report_webkit', 'l10n_it_account', 'l10n_it_corrispettivi'],
31 "init_xml" : [
32 ],
33 "update_xml" : [
34 'reports.xml',
35 'account_view.xml',
36 'wizard/print_registro_iva.xml',
37 ],
38 "demo_xml" : [],
39 "active": False,
40 "installable": True
41}
042
=== 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-24 09:56:24 +0000
@@ -0,0 +1,46 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>).
6# All Rights Reserved
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from osv import fields, osv
24
25class account_tax_code(osv.osv):
26
27 _inherit = 'account.tax.code'
28 _columns = {
29 'tax_ids': fields.one2many('account.tax', 'tax_code_id', 'Taxes'),
30 'base_tax_ids': fields.one2many('account.tax', 'base_code_id', 'Base Taxes'),
31 }
32
33account_tax_code()
34
35class account_invoice_tax(osv.osv):
36
37 _inherit = 'account.tax'
38 _columns = {
39 'exclude_from_registries': fields.boolean('Exclude from VAT registries'),
40 'base_tax_ids': fields.one2many('account.tax', 'base_code_id', 'Base Taxes'),
41 }
42 _sql_constraints = [
43 ('name_uniq', 'UNIQUE(name)', 'The tax name must be unique!'),
44 ]
45
46account_invoice_tax()
047
=== added file 'l10n_it_vat_registries/account_view.xml'
--- l10n_it_vat_registries/account_view.xml 1970-01-01 00:00:00 +0000
+++ l10n_it_vat_registries/account_view.xml 2011-08-24 09:56:24 +0000
@@ -0,0 +1,17 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_tax_form" model="ir.ui.view">
6 <field name="name">account.tax.form</field>
7 <field name="model">account.tax</field>
8 <field name="type">form</field>
9 <field name="inherit_id" ref="account.view_tax_form"></field>
10 <field name="arch" type="xml">
11 <field name="active" position="after">
12 <field name="exclude_from_registries"/>
13 </field>
14 </field>
15 </record>
16 </data>
17</openerp>
018
=== 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-24 09:56:24 +0000
@@ -0,0 +1,185 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * l10n_it_vat_registries
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.0.2\n"
8"Report-Msgid-Bugs-To: support@openerp.com\n"
9"POT-Creation-Date: 2011-08-19 21:40+0000\n"
10"PO-Revision-Date: 2011-08-19 23:43+0100\n"
11"Last-Translator: eLBati <lorenzo.battistini@domsense.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17
18#. module: l10n_it_vat_registries
19#: model:ir.module.module,description:l10n_it_vat_registries.module_meta_information
20msgid "Accounting reports for Italian localization - VAT Registries"
21msgstr "Report contabili per la localizzazione italiana - Registri IVA"
22
23#. module: l10n_it_vat_registries
24#: model:ir.model,name:l10n_it_vat_registries.model_account_tax_code
25msgid "Tax Code"
26msgstr "Codice imposta"
27
28#. module: l10n_it_vat_registries
29#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_vendite_report_id
30msgid "Customer Invoices VAT Registry"
31msgstr "Registro IVA Fatture Emesse"
32
33#. module: l10n_it_vat_registries
34#: model:ir.model,name:l10n_it_vat_registries.model_wizard_registro_iva
35msgid "wizard.registro.iva"
36msgstr "wizard.registro.iva"
37
38#. module: l10n_it_vat_registries
39#: view:wizard.registro.iva:0
40msgid "Print"
41msgstr "Stampa"
42
43#. module: l10n_it_vat_registries
44#: field:wizard.registro.iva,type:0
45msgid "Type"
46msgstr "Tipo"
47
48#. module: l10n_it_vat_registries
49#: selection:wizard.registro.iva,type:0
50msgid "Supplier Invoices"
51msgstr "Fatture ricevute"
52
53#. module: l10n_it_vat_registries
54#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_acquisti_report_id
55msgid "Supplier Invoices VAT Registry"
56msgstr "Registro IVA Fatture Ricevute"
57
58#. module: l10n_it_vat_registries
59#: model:ir.actions.act_window,name:l10n_it_vat_registries.action_registro_iva
60msgid "VAT Registry"
61msgstr "Registro IVA"
62
63#. module: l10n_it_vat_registries
64#: code:addons/l10n_it_vat_registries/invoice.py:116
65#, python-format
66msgid "The tax %s has no tax codes"
67msgstr "L'imposta %s non ha codici IVA"
68
69#. module: l10n_it_vat_registries
70#: field:account.tax,base_tax_ids:0
71#: field:account.tax.code,base_tax_ids:0
72msgid "Base Taxes"
73msgstr "Imposte dell'imponibile"
74
75#. module: l10n_it_vat_registries
76#: code:addons/l10n_it_vat_registries/invoice.py:70
77#: code:addons/l10n_it_vat_registries/invoice.py:91
78#, python-format
79msgid "The tax %s is excluded from registries"
80msgstr "L'imposta %s è esclusa dai registri"
81
82#. module: l10n_it_vat_registries
83#: view:wizard.registro.iva:0
84msgid "Tax Journal"
85msgstr "Registro IVA"
86
87#. module: l10n_it_vat_registries
88#: field:wizard.registro.iva,date_to:0
89msgid "To date"
90msgstr "Alla data"
91
92#. module: l10n_it_vat_registries
93#: view:wizard.registro.iva:0
94#: field:wizard.registro.iva,journal_ids:0
95msgid "Journals"
96msgstr "Sezionali"
97
98#. module: l10n_it_vat_registries
99#: sql_constraint:account.tax:0
100msgid "The tax name must be unique!"
101msgstr "Il nome dell'imposta deve essere unico"
102
103#. module: l10n_it_vat_registries
104#: help:wizard.registro.iva,journal_ids:0
105msgid "Select journals you want retrieve documents from"
106msgstr "Selezionare i sezionali da cui si vuole ottenere i documenti"
107
108#. module: l10n_it_vat_registries
109#: field:account.tax.code,tax_ids:0
110msgid "Taxes"
111msgstr "Tasse"
112
113#. module: l10n_it_vat_registries
114#: selection:wizard.registro.iva,type:0
115msgid "Corrispettivi"
116msgstr "Corrispettivi"
117
118#. module: l10n_it_vat_registries
119#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva.py:94
120#, python-format
121msgid "No documents found in the current selection"
122msgstr "Nessun documento trovato per la selezione corrente"
123
124#. module: l10n_it_vat_registries
125#: model:ir.module.module,shortdesc:l10n_it_vat_registries.module_meta_information
126msgid "Italian Localisation - VAT Registries"
127msgstr "Localizzazione Italiana - Registri IVA"
128
129#. module: l10n_it_vat_registries
130#: model:ir.ui.menu,name:l10n_it_vat_registries.menu_registro_iva
131msgid "VAT Registries"
132msgstr "Registri IVA"
133
134#. module: l10n_it_vat_registries
135#: code:addons/l10n_it_vat_registries/invoice.py:52
136#, python-format
137msgid "Too many taxes with name %s"
138msgstr "Troppe tasse con nome %s"
139
140#. module: l10n_it_vat_registries
141#: constraint:account.tax.code:0
142msgid "Error ! You can not create recursive accounts."
143msgstr "Errore! Non puoi creare conti ricorsivi"
144
145#. module: l10n_it_vat_registries
146#: field:account.tax,exclude_from_registries:0
147msgid "Exclude from VAT registries"
148msgstr "Escludi dai registri IVA"
149
150#. module: l10n_it_vat_registries
151#: selection:wizard.registro.iva,type:0
152msgid "Customer Invoices"
153msgstr "Fatture emesse"
154
155#. module: l10n_it_vat_registries
156#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_corrispettivi_report_id
157msgid "Corrispettivi VAT Registry"
158msgstr "Registro IVA Corrispettivi"
159
160#. module: l10n_it_vat_registries
161#: field:wizard.registro.iva,date_from:0
162msgid "From date"
163msgstr "Dalla data"
164
165#. module: l10n_it_vat_registries
166#: code:addons/l10n_it_vat_registries/invoice.py:50
167#, python-format
168msgid "The tax %s does not exist"
169msgstr "L'imposta %s non esiste"
170
171#. module: l10n_it_vat_registries
172#: view:wizard.registro.iva:0
173msgid "Cancel"
174msgstr "Annulla"
175
176#. module: l10n_it_vat_registries
177#: field:wizard.registro.iva,message:0
178msgid "Message"
179msgstr "Messaggio"
180
181#. module: l10n_it_vat_registries
182#: model:ir.model,name:l10n_it_vat_registries.model_account_tax
183msgid "account.tax"
184msgstr "account.tax"
185
0186
=== 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-24 09:56:24 +0000
@@ -0,0 +1,185 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * l10n_it_vat_registries
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.0.2\n"
8"Report-Msgid-Bugs-To: support@openerp.com\n"
9"POT-Creation-Date: 2011-08-19 21:40+0000\n"
10"PO-Revision-Date: 2011-08-19 21:40+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: l10n_it_vat_registries
19#: model:ir.module.module,description:l10n_it_vat_registries.module_meta_information
20msgid "Accounting reports for Italian localization - VAT Registries"
21msgstr ""
22
23#. module: l10n_it_vat_registries
24#: model:ir.model,name:l10n_it_vat_registries.model_account_tax_code
25msgid "Tax Code"
26msgstr ""
27
28#. module: l10n_it_vat_registries
29#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_vendite_report_id
30msgid "Customer Invoices VAT Registry"
31msgstr ""
32
33#. module: l10n_it_vat_registries
34#: model:ir.model,name:l10n_it_vat_registries.model_wizard_registro_iva
35msgid "wizard.registro.iva"
36msgstr ""
37
38#. module: l10n_it_vat_registries
39#: view:wizard.registro.iva:0
40msgid "Print"
41msgstr ""
42
43#. module: l10n_it_vat_registries
44#: field:wizard.registro.iva,type:0
45msgid "Type"
46msgstr ""
47
48#. module: l10n_it_vat_registries
49#: selection:wizard.registro.iva,type:0
50msgid "Supplier Invoices"
51msgstr ""
52
53#. module: l10n_it_vat_registries
54#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_acquisti_report_id
55msgid "Supplier Invoices VAT Registry"
56msgstr ""
57
58#. module: l10n_it_vat_registries
59#: model:ir.actions.act_window,name:l10n_it_vat_registries.action_registro_iva
60msgid "VAT Registry"
61msgstr ""
62
63#. module: l10n_it_vat_registries
64#: code:addons/l10n_it_vat_registries/invoice.py:116
65#, python-format
66msgid "The tax %s has no tax codes"
67msgstr ""
68
69#. module: l10n_it_vat_registries
70#: field:account.tax,base_tax_ids:0
71#: field:account.tax.code,base_tax_ids:0
72msgid "Base Taxes"
73msgstr ""
74
75#. module: l10n_it_vat_registries
76#: code:addons/l10n_it_vat_registries/invoice.py:70
77#: code:addons/l10n_it_vat_registries/invoice.py:91
78#, python-format
79msgid "The tax %s is excluded from registries"
80msgstr ""
81
82#. module: l10n_it_vat_registries
83#: view:wizard.registro.iva:0
84msgid "Tax Journal"
85msgstr ""
86
87#. module: l10n_it_vat_registries
88#: field:wizard.registro.iva,date_to:0
89msgid "To date"
90msgstr ""
91
92#. module: l10n_it_vat_registries
93#: view:wizard.registro.iva:0
94#: field:wizard.registro.iva,journal_ids:0
95msgid "Journals"
96msgstr ""
97
98#. module: l10n_it_vat_registries
99#: sql_constraint:account.tax:0
100msgid "The tax name must be unique!"
101msgstr ""
102
103#. module: l10n_it_vat_registries
104#: help:wizard.registro.iva,journal_ids:0
105msgid "Select journals you want retrieve documents from"
106msgstr ""
107
108#. module: l10n_it_vat_registries
109#: field:account.tax.code,tax_ids:0
110msgid "Taxes"
111msgstr ""
112
113#. module: l10n_it_vat_registries
114#: selection:wizard.registro.iva,type:0
115msgid "Corrispettivi"
116msgstr ""
117
118#. module: l10n_it_vat_registries
119#: code:addons/l10n_it_vat_registries/wizard/print_registro_iva.py:94
120#, python-format
121msgid "No documents found in the current selection"
122msgstr ""
123
124#. module: l10n_it_vat_registries
125#: model:ir.module.module,shortdesc:l10n_it_vat_registries.module_meta_information
126msgid "Italian Localisation - VAT Registries"
127msgstr ""
128
129#. module: l10n_it_vat_registries
130#: model:ir.ui.menu,name:l10n_it_vat_registries.menu_registro_iva
131msgid "VAT Registries"
132msgstr ""
133
134#. module: l10n_it_vat_registries
135#: code:addons/l10n_it_vat_registries/invoice.py:52
136#, python-format
137msgid "Too many taxes with name %s"
138msgstr ""
139
140#. module: l10n_it_vat_registries
141#: constraint:account.tax.code:0
142msgid "Error ! You can not create recursive accounts."
143msgstr ""
144
145#. module: l10n_it_vat_registries
146#: field:account.tax,exclude_from_registries:0
147msgid "Exclude from VAT registries"
148msgstr ""
149
150#. module: l10n_it_vat_registries
151#: selection:wizard.registro.iva,type:0
152msgid "Customer Invoices"
153msgstr ""
154
155#. module: l10n_it_vat_registries
156#: model:ir.actions.report.xml,name:l10n_it_vat_registries.registro_iva_corrispettivi_report_id
157msgid "Corrispettivi VAT Registry"
158msgstr ""
159
160#. module: l10n_it_vat_registries
161#: field:wizard.registro.iva,date_from:0
162msgid "From date"
163msgstr ""
164
165#. module: l10n_it_vat_registries
166#: code:addons/l10n_it_vat_registries/invoice.py:50
167#, python-format
168msgid "The tax %s does not exist"
169msgstr ""
170
171#. module: l10n_it_vat_registries
172#: view:wizard.registro.iva:0
173msgid "Cancel"
174msgstr ""
175
176#. module: l10n_it_vat_registries
177#: field:wizard.registro.iva,message:0
178msgid "Message"
179msgstr ""
180
181#. module: l10n_it_vat_registries
182#: model:ir.model,name:l10n_it_vat_registries.model_account_tax
183msgid "account.tax"
184msgstr ""
185
0186
=== 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-24 09:56:24 +0000
@@ -0,0 +1,163 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>).
6# All Rights Reserved
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import time
24from report import report_sxw
25from osv import osv
26from tools.translate import _
27from decimal import *
28import netsvc
29
30class Parser(report_sxw.rml_parse):
31
32 logger = netsvc.Logger()
33
34 def _get_main_tax(self, tax):
35 if not tax.parent_id:
36 return tax
37 else:
38 return self._get_main_tax(tax.parent_id)
39
40 def _get_account_tax(self, inv_tax):
41 splitted_name = inv_tax.name.split(' - ')
42 if len(splitted_name) > 1:
43 tax_name = splitted_name[1]
44 else:
45 tax_name = splitted_name[0]
46 tax_obj = self.pool.get('account.tax')
47 # cerco la tassa per nome, dopo averlo ottenuto dalla tassa in fattura
48 tax_ids = tax_obj.search(self.cr, self.uid, [('name', '=', tax_name)])
49 if not tax_ids:
50 raise Exception(_('The tax %s does not exist') % tax_name)
51 if len(tax_ids) > 1:
52 raise Exception(_('Too many taxes with name %s') % tax_name)
53 return tax_obj.browse(self.cr, self.uid, tax_ids[0])
54
55 def _get_tax_lines(self, invoice):
56 res=[]
57 # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA
58 index=0
59 totale_iva = 0.0
60 totale_iva_inded = 0.0
61 invoice_amount_total = 0.0
62 invoice_amount_untaxed = 0.0
63 precision = self.pool.get('decimal.precision').precision_get(self.cr, self.uid, 'Account')
64 for inv_tax in invoice.tax_line:
65 tax_item = {}
66 if inv_tax.base_code_id and inv_tax.tax_code_id:
67 account_tax = self._get_account_tax(inv_tax)
68 if account_tax.exclude_from_registries:
69 self.logger.notifyChannel("l10n_it_vat_registries", netsvc.LOG_INFO,
70 _('The tax %s is excluded from registries') % account_tax.name)
71 continue
72 account_tax_amount = account_tax.amount
73 tax_item = {
74 'tax_percentage': account_tax_amount and str(
75 account_tax_amount * 100).split('.')[0] or inv_tax.tax_code_id.name,
76 'base': inv_tax.base,
77 'amount': inv_tax.amount,
78 'non_deductible': 0.0,
79 'index': index,
80 }
81 res.append(tax_item)
82 totale_iva += inv_tax.amount
83 invoice_amount_total = invoice.amount_total
84 invoice_amount_untaxed = invoice.amount_untaxed
85 index += 1
86 # Se non c'è il tax code imponibile, cerco la tassa relativa alla parte non deducibile
87 elif inv_tax.tax_code_id:
88 tax = self._get_main_tax(self._get_account_tax(inv_tax))
89 if tax.exclude_from_registries:
90 self.logger.notifyChannel("l10n_it_vat_registries", netsvc.LOG_INFO,
91 _('The tax %s is excluded from registries') % tax.name)
92 continue
93 for inv_tax_2 in invoice.tax_line:
94 if inv_tax_2.base_code_id and not inv_tax_2.tax_code_id:
95 base_tax = self._get_main_tax(self._get_account_tax(inv_tax_2))
96 # Se hanno la stessa tassa
97 if base_tax.id == tax.id:
98 tax_item = {
99 'tax_percentage': base_tax.amount and str(
100 base_tax.amount * 100).split('.')[0] or inv_tax.tax_code_id.name,
101 'base': inv_tax.base + inv_tax_2.base,
102 'amount': inv_tax.amount + inv_tax_2.amount,
103 'non_deductible': float(Decimal(str(inv_tax_2.base / (inv_tax.base + inv_tax_2.base) * 100)
104 ).quantize(Decimal('.1'), rounding=ROUND_HALF_UP)),
105 'index': index,
106 }
107 res.append(tax_item)
108 totale_iva += inv_tax.amount
109 totale_iva_inded += inv_tax_2.amount
110 invoice_amount_total = invoice.amount_total
111 invoice_amount_untaxed = invoice.amount_untaxed
112 index += 1
113 break
114 elif not inv_tax.tax_code_id and not inv_tax.base_code_id:
115 self.logger.notifyChannel("l10n_it_vat_registries", netsvc.LOG_INFO,
116 _('The tax %s has no tax codes') % inv_tax.name)
117 continue
118 if tax_item:
119 if tax_item['tax_percentage'] not in self.localcontext['tax_codes']:
120 self.localcontext['tax_codes'][tax_item['tax_percentage']] = {
121 'base': tax_item['base'],
122 'amount': tax_item['amount'],
123 }
124 else:
125 self.localcontext['tax_codes'][tax_item['tax_percentage']]['base'] += tax_item['base']
126 self.localcontext['tax_codes'][tax_item['tax_percentage']]['amount'] += tax_item['amount']
127
128 self.localcontext['totali']['totale_operazioni'] += invoice_amount_total
129 self.localcontext['totali']['totale_imponibili'] += invoice_amount_untaxed
130# da analizzare self.totale_variazioni += invoice.amount_total
131 self.localcontext['totali']['totale_iva'] += totale_iva
132 self.localcontext['totali']['totale_iva_inded'] += totale_iva_inded
133
134 return res
135
136 def __init__(self, cr, uid, name, context):
137 super(Parser, self).__init__(cr, uid, name, context)
138 self.localcontext.update({
139 'time': time,
140 'tax_lines': self._get_tax_lines,
141 'totali': {
142 'totale_operazioni': 0.0,
143 'totale_imponibili': 0.0,
144 'totale_variazioni': 0.0,
145 'totale_iva': 0.0,
146 'totale_iva_inded': 0.0,
147 },
148 'tax_codes': {},
149 })
150
151
152report_sxw.report_sxw('report.registro_iva_vendite',
153 'registro_iva_vendite',
154 'addons/l10n_it_vat_registries/templates/registro_iva_vendite.mako',
155 parser=Parser)
156report_sxw.report_sxw('report.registro_iva_acquisti',
157 'registro_iva_acquisti',
158 'addons/l10n_it_vat_registries/templates/registro_iva_acquisti.mako',
159 parser=Parser)
160report_sxw.report_sxw('report.registro_iva_corrispettivi',
161 'registro_iva_corrispettivi',
162 'addons/l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako',
163 parser=Parser)
0164
=== 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-24 09:56:24 +0000
@@ -0,0 +1,112 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record id="ir_header_webkit_vat_registries" model="ir.header_webkit">
5 <field name="orientation">Landscape</field>
6 <field name="format">A4</field>
7 <field name="margin_top">60</field>
8 <field name="html"><![CDATA[<html>
9 <head>
10 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
11 <script>
12 function subst() {
13 var vars={};
14 var x=document.location.search.substring(1).split('&');
15 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
16 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
17 for(var i in x) {
18 var y = document.getElementsByClassName(x[i]);
19 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
20 }
21 }
22 </script>
23 </head>
24 <body style="border:0; margin: 0;" onload="subst()">
25 <% setLang(company.partner_id.lang or "en_US") %>
26 <h1>Registro IVA</h1>
27 <h3>${company.partner_id.name or ''|entity}</h3>
28 <table style="border-bottom: 1px solid black; width: 100%">
29 <tr>
30 <td>
31 <div>${company.partner_id.address and company.partner_id.address[0].street or ''|entity}</div>
32 <div>${company.partner_id.address and company.partner_id.address[0].street2 or ''|entity}</div>
33 <div>${company.partner_id.address and company.partner_id.address[0].zip or ''|entity}</div>
34 <div>${company.partner_id.address and company.partner_id.address[0].city or ''|entity}</div>
35 <div>${company.partner_id.address and company.partner_id.address[0].province and company.partner_id.address[0].province.code or ''|entity}</div>
36 </td>
37 <td>
38 <div>P. IVA: ${company.partner_id.vat or ''|entity}</div>
39 <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div>
40 <div>Codice Attività:</div>
41 <div>Registro Imprese:</div>
42 </td>
43 </tr>
44 </table>
45 <br/>
46 </body>
47</html>]]>
48</field>
49 <field name="footer_html"><![CDATA[<html>
50 <head>
51 <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
52 <script>
53 function subst() {
54 var vars={};
55 var x=document.location.search.substring(1).split('&');
56 for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
57 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
58 for(var i in x) {
59 var y = document.getElementsByClassName(x[i]);
60 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
61 }
62 }
63 </script>
64 </head>
65 <body style="border:0; margin: 0;" onload="subst()">
66 <table style="border-top: 1px solid black; width: 100%">
67 <tr >
68 <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>
69 </tr>
70 </table>
71 </body>
72</html>]]></field><field name="css" ><![CDATA[
73tr {
74 page-break-inside: avoid;
75}
76thead{
77 display: table-header-group; /* http://code.google.com/p/wkhtmltopdf/issues/detail?id=9#c8 */
78}
79]]> </field>
80 <field name="name">Registri IVA</field>
81 </record>
82
83 <record id="registro_iva_vendite_report_id" model="ir.actions.report.xml">
84 <field name="name">Customer Invoices VAT Registry</field>
85 <field name="type">ir.actions.report.xml</field>
86 <field name="model">account.invoice</field>
87 <field name="report_name">registro_iva_vendite</field>
88 <field name="report_type">webkit</field>
89 <field name="report_rml">l10n_it_vat_registries/templates/registro_iva_vendite.mako</field>
90 <field name="webkit_header" ref="ir_header_webkit_vat_registries"/>
91 </record>
92 <record id="registro_iva_acquisti_report_id" model="ir.actions.report.xml">
93 <field name="name">Supplier Invoices VAT Registry</field>
94 <field name="type">ir.actions.report.xml</field>
95 <field name="model">account.invoice</field>
96 <field name="report_name">registro_iva_acquisti</field>
97 <field name="report_type">webkit</field>
98 <field name="report_rml">l10n_it_vat_registries/templates/registro_iva_acquisti.mako</field>
99 <field name="webkit_header" ref="ir_header_webkit_vat_registries"/>
100 </record>
101 <record id="registro_iva_corrispettivi_report_id" model="ir.actions.report.xml">
102 <field name="name">Corrispettivi VAT Registry</field>
103 <field name="type">ir.actions.report.xml</field>
104 <field name="model">account.invoice</field>
105 <field name="report_name">registro_iva_corrispettivi</field>
106 <field name="report_type">webkit</field>
107 <field name="report_rml">l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako</field>
108 <field name="webkit_header" ref="ir_header_webkit_vat_registries"/>
109 </record>
110 </data>
111</openerp>
112
0113
=== 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-24 09:56:24 +0000
@@ -0,0 +1,106 @@
1<html>
2<head>
3 <style type="text/css">
4 ${css}
5 </style>
6</head>
7<body>
8 <h2>Fatture Ricevute</h2>
9 <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>
10 <table style="width:100%;">
11 <thead>
12 <tr>
13 <th style="text-align:left">Data registrazione</th>
14 <th style="text-align:left">Data fattura</th>
15 <th style="text-align:left">Numero fattura</th>
16 <th style="text-align:left">Ragione sociale</th>
17 <th style="text-align:left">Descrizione</th>
18 <th style="text-align:right">Totale fattura</th>
19 <th style="text-align:right">% IVA</th>
20 <th style="text-align:right">Imponibile</th>
21 <th style="text-align:right">Imposta</th>
22 <th style="text-align:right">% inded.</th>
23 <th></th>
24 </tr>
25 </thead>
26 <tbody>
27 %for object in objects :
28 %for line in tax_lines(object) :
29 <tr><td>
30 %if line['index']==0:
31 ${ formatLang(object.move_id.date,date=True) or ''| entity}
32 %endif
33 </td><td>
34 %if line['index']==0:
35 ${ formatLang(object.date_invoice,date=True) or '' | entity}
36 %endif
37 </td><td>
38 %if line['index']==0:
39 ${object.number or ''| entity}
40 %endif
41 </td><td>
42 %if line['index']==0:
43 ${object.partner_id.name | entity}
44 %endif
45 </td><td>
46 %if line['index']==0:
47 %if object.type == 'in_invoice':
48 Fattura
49 %elif object.type == 'in_refund':
50 Nota di debito
51 %endif
52 %endif
53 </td><td style="text-align:right">
54 %if line['index']==0:
55 ${ object.amount_total | entity}
56 %endif
57 </td>
58 <td style="text-align:right">${ line['tax_percentage'] or ''| entity}</td>
59 <td style="text-align:right">${ line['base'] or ''| entity}</td>
60 <td style="text-align:right">${ line['amount'] or ''| entity}</td>
61 <td style="text-align:right">
62 %if line['non_deductible']:
63 ${ line['non_deductible'] | entity} %
64 %endif
65 </td>
66 <td></td>
67 </tr>
68 %endfor
69 %endfor
70 </tbody>
71 </table>
72 <div style="page-break-inside: avoid;">
73 <br/>
74 <table style="width:100%; " border="1">
75 <tr style="border-style:ridge;border-width:5px">
76 <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>
77 </tr>
78 <tr>
79 <td rowspan="2" style="vertical-align:text-top;padding:10">
80 <table style="width:100%;">
81 <tr>
82 <th style="text-align:left">Descrizione</th>
83 <th style="text-align:right">Imponibile</th>
84 <th style="text-align:right">Imposta</th>
85 </tr>
86 %for tax_code in tax_codes :
87 <tr>
88 <td>${tax_code|entity}
89 </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity}
90 </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['amount']) or ''|entity}
91 </td>
92 </tr>
93 %endfor
94 </table>
95 </td><td style="padding:10">Totale operazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_operazioni'])|entity}</strong></p><br/></td>
96 <td colspan="2" style="padding:10">Totale imponibili:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_imponibili'])|entity}</strong></p><br/></td>
97 </tr>
98 <tr>
99 <td style="padding:10">Totale variazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_variazioni'])|entity}</strong></p><br/></td>
100 <td style="padding:10">Totale IVA Detraibile:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva'])|entity}</strong></p><br/></td>
101 <td style="padding:10">Totale IVA Indetraibile:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva_inded'])|entity}</strong></p><br/></td>
102 </tr>
103 </table>
104 </div>
105</body>
106</html>
0107
=== 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-24 09:56:24 +0000
@@ -0,0 +1,80 @@
1<html>
2<head>
3 <style type="text/css">
4 ${css}
5 </style>
6</head>
7<body>
8 <h2>Corrispettivi</h2>
9 <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>
10 <table style="width:100%;">
11 <thead>
12 <tr>
13 <th style="text-align:left">Data registrazione</th>
14 <th style="text-align:left">Descrizione</th>
15 <th style="text-align:right">Importo totale</th>
16 <th style="text-align:right">% IVA</th>
17 <th style="text-align:right">Imponibile</th>
18 <th style="text-align:right">Imposta</th>
19 <th></th>
20 </tr>
21 </thead>
22 <tbody>
23 %for object in objects :
24 %for line in tax_lines(object) :
25 <tr><td>
26 %if line['index']==0:
27 ${ formatLang(object.move_id.date,date=True) or ''| entity}
28 %endif
29 </td><td>
30 %if line['index']==0:
31 Corrispettivo
32 %endif
33 </td><td style="text-align:right">
34 %if line['index']==0:
35 ${ object.amount_total | entity}
36 %endif
37 </td>
38 <td style="text-align:right">${ line['tax_percentage'] or ''| entity}</td>
39 <td style="text-align:right">${ line['base'] or ''| entity}</td>
40 <td style="text-align:right">${ line['amount'] or ''| entity}</td>
41 <td></td>
42 </tr>
43 %endfor
44 %endfor
45 </tbody>
46 </table>
47 <div style="page-break-inside: avoid;">
48 <br/>
49 <table style="width:100%; " border="1">
50 <tr style="border-style:ridge;border-width:5px">
51 <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>
52 </tr>
53 <tr>
54 <td rowspan="2" style="vertical-align:text-top;padding:10">
55 <table style="width:100%;">
56 <tr>
57 <th style="text-align:left">Descrizione</th>
58 <th style="text-align:right">Imponibile</th>
59 <th style="text-align:right">Imposta</th>
60 </tr>
61 %for tax_code in tax_codes :
62 <tr>
63 <td>${tax_code|entity}
64 </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity}
65 </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['amount']) or ''|entity}
66 </td>
67 </tr>
68 %endfor
69 </table>
70 </td><td style="padding:10">Totale operazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_operazioni'])|entity}</strong></p><br/></td>
71 <td style="padding:10">Totale imponibili:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_imponibili'])|entity}</strong></p><br/></td>
72 </tr>
73 <tr>
74 <td style="padding:10">Totale variazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_variazioni'])|entity}</strong></p><br/></td>
75 <td style="padding:10">Totale IVA:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva'])|entity}</strong></p><br/></td>
76 </tr>
77 </table>
78 </div>
79</body>
80</html>
081
=== 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-24 09:56:24 +0000
@@ -0,0 +1,99 @@
1<html>
2<head>
3 <style type="text/css">
4 ${css}
5 </style>
6</head>
7<body>
8 <h2>Fatture Emesse</h2>
9 <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>
10 <table style="width:100%;">
11 <thead>
12 <tr>
13 <th style="text-align:left">Data registrazione</th>
14 <th style="text-align:left">Data fattura</th>
15 <th style="text-align:left">Numero fattura</th>
16 <th style="text-align:left">Ragione sociale</th>
17 <th style="text-align:left">Descrizione</th>
18 <th style="text-align:right">Totale fattura</th>
19 <th style="text-align:right">% IVA</th>
20 <th style="text-align:right">Imponibile</th>
21 <th style="text-align:right">Imposta</th>
22 <th></th>
23 </tr>
24 </thead>
25 <tbody>
26 %for object in objects :
27 %for line in tax_lines(object) :
28 <tr><td>
29 %if line['index']==0:
30 ${ formatLang(object.move_id.date,date=True) or ''| entity}
31 %endif
32 </td><td>
33 %if line['index']==0:
34 ${ formatLang(object.date_invoice,date=True) or '' | entity}
35 %endif
36 </td><td>
37 %if line['index']==0:
38 ${object.number or ''| entity}
39 %endif
40 </td><td>
41 %if line['index']==0:
42 ${object.partner_id.name | entity}
43 %endif
44 </td><td>
45 %if line['index']==0:
46 %if object.type == 'out_invoice':
47 Fattura
48 %elif object.type == 'out_refund':
49 Nota di credito
50 %endif
51 %endif
52 </td><td style="text-align:right">
53 %if line['index']==0:
54 ${ object.amount_total | entity}
55 %endif
56 </td>
57 <td style="text-align:right">${ line['tax_percentage'] or ''| entity}</td>
58 <td style="text-align:right">${ line['base'] or ''| entity}</td>
59 <td style="text-align:right">${ line['amount'] or ''| entity}</td>
60 <td></td>
61 </tr>
62 %endfor
63 %endfor
64 </tbody>
65 </table>
66 <div style="page-break-inside: avoid;">
67 <br/>
68 <table style="width:100%; " border="1">
69 <tr style="border-style:ridge;border-width:5px">
70 <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>
71 </tr>
72 <tr>
73 <td rowspan="2" style="vertical-align:text-top;padding:10">
74 <table style="width:100%;">
75 <tr>
76 <th style="text-align:left">Descrizione</th>
77 <th style="text-align:right">Imponibile</th>
78 <th style="text-align:right">Imposta</th>
79 </tr>
80 %for tax_code in tax_codes :
81 <tr>
82 <td>${tax_code|entity}
83 </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity}
84 </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['amount']) or ''|entity}
85 </td>
86 </tr>
87 %endfor
88 </table>
89 </td><td style="padding:10">Totale operazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_operazioni'])|entity}</strong></p><br/></td>
90 <td style="padding:10">Totale imponibili:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_imponibili'])|entity}</strong></p><br/></td>
91 </tr>
92 <tr>
93 <td style="padding:10">Totale variazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_variazioni'])|entity}</strong></p><br/></td>
94 <td style="padding:10">Totale IVA:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva'])|entity}</strong></p><br/></td>
95 </tr>
96 </table>
97 </div>
98</body>
99</html>
0100
=== 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-24 09:56:24 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>).
6# All Rights Reserved
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import print_registro_iva
024
=== 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-24 09:56:24 +0000
@@ -0,0 +1,114 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>).
6# All Rights Reserved
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from osv import fields,osv
24from tools.translate import _
25import time
26
27class wizard_registro_iva(osv.osv_memory):
28
29 _name = "wizard.registro.iva"
30 _columns = {
31 'date_from': fields.date('From date', required=True),
32 'date_to': fields.date('To date', required=True),
33 'type': fields.selection([
34 ('customer', 'Customer Invoices'),
35 ('supplier', 'Supplier Invoices'),
36 ('corrispettivi', 'Corrispettivi'),
37 ], 'Type', required=True),
38 '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),
39 'message': fields.char('Message', size=64, readonly=True),
40 }
41 _defaults = {
42 'type': 'customer',
43 'date_from': lambda * a: time.strftime('%Y-%m-%d'),
44 'date_to': lambda * a: time.strftime('%Y-%m-%d'),
45 'journal_ids': lambda s, cr, uid, c: s.pool.get('account.journal').search(cr, uid, []),
46 }
47
48 def print_registro(self, cr, uid, ids, context=None):
49 inv_ids = []
50 wizard = self.read(cr, uid, ids)[0]
51 inv_obj = self.pool.get('account.invoice')
52 search_list = []
53 if wizard['type'] == 'customer':
54 search_list = [
55 ('journal_id', 'in', wizard['journal_ids']),
56 ('corrispettivo', '=', False),
57 ('move_id.date', '<=', wizard['date_to']),
58 ('move_id.date', '>=', wizard['date_from']),
59 '|',
60 ('type', '=', 'out_invoice'),
61 ('type', '=', 'out_refund'),
62 '|',
63 ('state', '=', 'open'),
64 ('state', '=', 'paid'),
65 ]
66 elif wizard['type'] == 'supplier':
67 search_list = [
68 ('journal_id', 'in', wizard['journal_ids']),
69 ('corrispettivo', '=', False),
70 ('move_id.date', '<=', wizard['date_to']),
71 ('move_id.date', '>=', wizard['date_from']),
72 '|',
73 ('type', '=', 'in_invoice'),
74 ('type', '=', 'in_refund'),
75 '|',
76 ('state', '=', 'open'),
77 ('state', '=', 'paid'),
78 ]
79 elif wizard['type'] == 'corrispettivi':
80 search_list = [
81 ('journal_id', 'in', wizard['journal_ids']),
82 ('corrispettivo', '=', True),
83 ('move_id.date', '<=', wizard['date_to']),
84 ('move_id.date', '>=', wizard['date_from']),
85 '|',
86 ('type', '=', 'out_invoice'),
87 ('type', '=', 'out_refund'),
88 '|',
89 ('state', '=', 'open'),
90 ('state', '=', 'paid'),
91 ]
92 inv_ids = inv_obj.search(cr, uid, search_list)
93 if not inv_ids:
94 self.write(cr, uid, ids, {'message': _('No documents found in the current selection')})
95 return True
96 if context is None:
97 context = {}
98 datas = {'ids': inv_ids}
99 datas['model'] = 'account.invoice'
100 datas['form'] = wizard
101 datas['inv_ids'] = inv_ids
102 res= {
103 'type': 'ir.actions.report.xml',
104 'datas': datas,
105 }
106 if wizard['type'] == 'customer':
107 res['report_name'] = 'registro_iva_vendite'
108 elif wizard['type'] == 'supplier':
109 res['report_name'] = 'registro_iva_acquisti'
110 elif wizard['type'] == 'corrispettivi':
111 res['report_name'] = 'registro_iva_corrispettivi'
112 return res
113
114wizard_registro_iva()
0115
=== 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-24 09:56:24 +0000
@@ -0,0 +1,41 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="wizard_registro_iva" model="ir.ui.view">
6 <field name="name">VAT Registry</field>
7 <field name="model">wizard.registro.iva</field>
8 <field name="type">form</field>
9 <field name="arch" type="xml">
10 <form string="Tax Journal">
11 <field name="date_from"/>
12 <field name="date_to"/>
13 <field name="type" colspan="4"/>
14 <separator string="Journals" colspan="4"/>
15 <field name="journal_ids" colspan="4" nolabel="1" height="250"/>
16 <button icon="gtk-cancel" special="cancel" string="Cancel"/>
17 <button icon="gtk-ok" name="print_registro" string="Print" type="object"/>
18 <newline/>
19 <field name="message" nolabel="1" colspan="4"/>
20 </form>
21 </field>
22 </record>
23
24 <record id="action_registro_iva" model="ir.actions.act_window">
25 <field name="name">VAT Registry</field>
26 <field name="type">ir.actions.act_window</field>
27 <field name="res_model">wizard.registro.iva</field>
28 <field name="view_type">form</field>
29 <field name="view_mode">form</field>
30 <field name="target">new</field>
31 </record>
32
33 <menuitem
34 name="VAT Registries"
35 parent="account.menu_finance_reporting"
36 action="action_registro_iva"
37 id="menu_registro_iva"
38 icon="STOCK_PRINT"/>
39
40 </data>
41</openerp>