Merge lp:~elbati/openobject-italia/7-l10n_it_vat_registries_simplified into lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0
- 7-l10n_it_vat_registries_simplified
- Merge into italian-addons-7.0
Status: | Merged |
---|---|
Merged at revision: | 214 |
Proposed branch: | lp:~elbati/openobject-italia/7-l10n_it_vat_registries_simplified |
Merge into: | lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0 |
Diff against target: |
1529 lines (+494/-625) 13 files modified
l10n_it_vat_registries/AUTHORS.txt (+1/-1) l10n_it_vat_registries/__init__.py (+3/-3) l10n_it_vat_registries/__openerp__.py (+3/-3) l10n_it_vat_registries/account.py (+0/-48) l10n_it_vat_registries/account_view.xml (+0/-17) l10n_it_vat_registries/invoice.py (+104/-309) l10n_it_vat_registries/reports.xml (+18/-9) l10n_it_vat_registries/templates/registro_iva_acquisti.mako (+114/-73) l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako (+93/-46) l10n_it_vat_registries/templates/registro_iva_vendite.mako (+94/-51) l10n_it_vat_registries/wizard/__init__.py (+2/-2) l10n_it_vat_registries/wizard/print_registro_iva.py (+45/-53) l10n_it_vat_registries/wizard/print_registro_iva.xml (+17/-10) |
To merge this branch: | bzr merge lp:~elbati/openobject-italia/7-l10n_it_vat_registries_simplified |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Italia core devs | Pending | ||
Review via email: mp+162188@code.launchpad.net |
Commit message
Description of the change
- 218. By Lorenzo Battistini
-
[imp] tax codes
- 219. By Lorenzo Battistini
-
[imp] totals and layout
- 220. By Lorenzo Battistini
-
[imp] wizard
- 221. By Lorenzo Battistini
-
[IMP] allow using multiple periods
- 222. By Lorenzo Battistini
-
[add] tax amount sign
- 223. By Lorenzo Battistini
-
[add] distinguo gli imponibili
- 224. By Lorenzo Battistini
-
[add] missing files
- 225. By Lorenzo Battistini
-
[fix] riepilogo imponibili
- 226. By Lorenzo Battistini
-
[imp] font size
Sergio Corato (icsergio) wrote : | # |
Sergio Corato (icsergio) wrote : | # |
ah, dimenticavo:
- codice attività e registro imprese direi che in questo caso non servono
- nel wizard di scelta dei sezionali limitare la scelta a domain="[('type', 'in', ('sale'
- l'indicazione del periodo temporale lo farei in mesi (anche perchè effettivamente si basa sui periodi e non sulle date) sia nell'ottica di evitare di calcoli possibilmente errati, sia perchè è usuale indicare i periodi
Sergio Corato (icsergio) wrote : | # |
stasera vado a colpi :)
Non si potrebbe impostare l'inversione del segno degli importi per il registro acquisti (e resi su acquisti) evitando scelte "difficili" per un utente base?
Non credo sia possibile avere casi in cui si scelga di stampare in maniera diversa gli importi, neanche di stampare fatture acquisti e vendite insieme (smentitemi se sbaglio), caso in cui sarebbe pensabile dire "non confondo i valori dell'iva a credito e a debito"
Lorenzo Battistini (elbati) wrote : | # |
On 05/05/2013 11:03 PM, Sergio Corato wrote:
> Puoi mettere anche l'opzione di impostare manualmente il numero di pagina di partenza? Serve in quanto la numerazione dev'essere progressiva e unica per tutto l'anno.
Nel momento in cui stampi tutto l'anno, avrai la numerazione corretta a
partire dall'inizio dell'anno.
- 227. By Lorenzo Battistini
-
[del] codice attività, registro imprese
- 228. By Lorenzo Battistini
-
[imp] journal domain
- 229. By Lorenzo Battistini
-
[add] on_type_changed
Lorenzo Battistini (elbati) wrote : | # |
On 05/05/2013 11:26 PM, Sergio Corato wrote:
> - codice attività e registro imprese direi che in questo caso non servono
fatto
> - nel wizard di scelta dei sezionali limitare la scelta a domain="[('type', 'in', ('sale'
fatto
> - l'indicazione del periodo temporale lo farei in mesi (anche perchè effettivamente si basa sui periodi e non sulle date) sia nell'ottica di evitare di calcoli possibilmente errati, sia perchè è usuale indicare i periodi
Cioè stamperesti il nome del periodo? "Dal 01/2013 al 12/2013" ?
Lorenzo Battistini (elbati) wrote : | # |
On 05/05/2013 11:45 PM, Sergio Corato wrote:
> Non si potrebbe impostare l'inversione del segno degli importi per il registro acquisti (e resi su acquisti) evitando scelte "difficili" per un utente base?
Ho aggiunto l'onchange sul campo type
Sergio Corato (icsergio) wrote : | # |
ehmm, la liquidazione IVA si stampa mese per mese
poi basta che riprendi quello che avevo già messo nel mio branch, l'avevo
già fatto
2013/5/6 Lorenzo Battistini - Agile BG <email address hidden>
> On 05/05/2013 11:03 PM, Sergio Corato wrote:
>
> > Puoi mettere anche l'opzione di impostare manualmente il numero di
> pagina di partenza? Serve in quanto la numerazione dev'essere progressiva e
> unica per tutto l'anno.
>
> Nel momento in cui stampi tutto l'anno, avrai la numerazione corretta a
> partire dall'inizio dell'anno.
>
> --
>
> https:/
> Your team OpenERP Italia core devs is requested to review the proposed
> merge of lp:~elbati/openobject-italia/7-l10n_it_vat_registries_simplified
> into lp:openobject-italia/7.0.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Sergio Corato (icsergio) wrote : | # |
stamperei "Marzo 2013" oppure "Marzo 2013 - Aprile 2013"
2013/5/6 Lorenzo Battistini - Agile BG <email address hidden>
> On 05/05/2013 11:26 PM, Sergio Corato wrote:
> > - codice attività e registro imprese direi che in questo caso non servono
>
> fatto
>
> > - nel wizard di scelta dei sezionali limitare la scelta a
> domain="[('type', 'in',
> ('sale'
>
> fatto
>
> > - l'indicazione del periodo temporale lo farei in mesi (anche perchè
> effettivamente si basa sui periodi e non sulle date) sia nell'ottica di
> evitare di calcoli possibilmente errati, sia perchè è usuale indicare i
> periodi
>
> Cioè stamperesti il nome del periodo? "Dal 01/2013 al 12/2013" ?
>
> --
>
> https:/
> Your team OpenERP Italia core devs is requested to review the proposed
> merge of lp:~elbati/openobject-italia/7-l10n_it_vat_registries_simplified
> into lp:openobject-italia/7.0.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Sergio Corato (icsergio) wrote : | # |
Ho visto che la progressione è per data invece che per numero di registrazione (protocollo) della fattura, bisognerebbe correggerla
Per quanto riguarda la progressività, è necessario invece che sia corretta a priori, con una correzione al modulo account_
Manca infine il numero fattura dato dal fornitore
Lorenzo Battistini (elbati) wrote : | # |
On 05/06/2013 01:56 PM, Sergio Corato wrote:
> ehmm, la liquidazione IVA si stampa mese per mese
Ok però a quanto ne so i registri IVA vanno stampati in definitivo
quando si fa la dichiarazione IVA, quindi una volta l'anno.
Comunque, per dare maggiore libertà, possiamo aggiungere la possibilità
di scegliere la pagina di partenza.
Sergio Corato (icsergio) wrote : | # |
Il 07/05/2013 09:25, Lorenzo Battistini - Agile BG ha scritto:
> On 05/06/2013 01:56 PM, Sergio Corato wrote:
>> ehmm, la liquidazione IVA si stampa mese per mese
>
> Ok però a quanto ne so i registri IVA vanno stampati in definitivo
> quando si fa la dichiarazione IVA, quindi una volta l'anno.
> Comunque, per dare maggiore libertà, possiamo aggiungere la possibilità
> di scegliere la pagina di partenza.
>
ok
per chi fa la liquidazione trimestrale, avendo i periodi trimestrali
dovrebbe essere già a posto (resta solo fuori il calcolo dell'interesse,
ma è un dettaglio)
invece bisognerebbe aggiungere la funzionalità del registro "Annotazioni
CEE" con:
- il mako (uguale alle vendite)
- il sezionale (tipo sale_CEE)
- la duplicazione della registrazione del movimento della fattura di
acquisto CEE sul sezionale di cui sopra
- dovrebbe anche essere necessario mettere una casella nella fattura di
acquisto per evidenziare che è intraCEE
(non mi sembra ci sia già qualcosa a riguardo, o mi sono perso?)
--
Sergio Corato
IcsTools.it
web : www.icstools.it
skype : sergiocorato
mail : <email address hidden>
- 230. By Lorenzo Battistini
-
[add] possibilità
di scegliere la pagina di partenza
Lorenzo Battistini (elbati) wrote : | # |
On 05/07/2013 02:12 PM, Sergio Corato wrote:
> Il 07/05/2013 09:25, Lorenzo Battistini - Agile BG ha scritto:
>> Comunque, per dare maggiore libertà, possiamo aggiungere la possibilità
>> di scegliere la pagina di partenza.
Fatto.
Lorenzo Battistini (elbati) wrote : | # |
On 05/07/2013 02:16 PM, Sergio Corato wrote:
> invece bisognerebbe aggiungere la funzionalità del registro
> "Annotazioni CEE" con: - il mako (uguale alle vendite) - il sezionale
> (tipo sale_CEE) - la duplicazione della registrazione del movimento
> della fattura di acquisto CEE sul sezionale di cui sopra - dovrebbe
> anche essere necessario mettere una casella nella fattura di acquisto
> per evidenziare che è intraCEE (non mi sembra ci sia già qualcosa a
> riguardo, o mi sono perso?)
Per le nuove funzionalità farei delle MP a parte, altrimenti rischiamo
di perderci.
In questa punterei principalmente al refactoring dei registri esistenti.
- 231. By Lorenzo Battistini
-
[add] supplier_
invoice_ number
Lorenzo Battistini (elbati) wrote : | # |
On 05/07/2013 01:04 AM, Sergio Corato wrote:
> Manca infine il numero fattura dato dal fornitore
Aggiunto.
Sergio Corato (icsergio) wrote : | # |
Direi che adesso è funzionale e usabile, per me va bene. Per il back-port sulla 6.1, basta aggiungere il campo mancante vedo, mi sembra sia l'unica differenza tra le due.
Per promemoria indico quello che è rimasto fuori:
- IVA esigibile / non esigibile
- IVA e registro annotazioni CEE
Davide Corio (enlightx-deactivatedaccount) wrote : | # |
Questo MP è da considerare obsoleto?
Lorenzo Battistini (elbati) wrote : | # |
Lo stato è 'merged' quindi le modifiche sono già finite nel target branch.
Preview Diff
1 | === modified file 'l10n_it_vat_registries/AUTHORS.txt' | |||
2 | --- l10n_it_vat_registries/AUTHORS.txt 2013-01-08 23:01:16 +0000 | |||
3 | +++ l10n_it_vat_registries/AUTHORS.txt 2013-05-09 15:50:30 +0000 | |||
4 | @@ -1,2 +1,2 @@ | |||
6 | 1 | Lorenzo Battistini <lorenzo.battistini@domsense.com> | 1 | Lorenzo Battistini <lorenzo.battistini@agilebg.com> |
7 | 2 | Ingrid Barcaro | 2 | Ingrid Barcaro |
8 | 3 | 3 | ||
9 | === modified file 'l10n_it_vat_registries/__init__.py' | |||
10 | --- l10n_it_vat_registries/__init__.py 2013-01-29 22:08:50 +0000 | |||
11 | +++ l10n_it_vat_registries/__init__.py 2013-05-09 15:50:30 +0000 | |||
12 | @@ -1,7 +1,7 @@ | |||
13 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
14 | 2 | ############################################################################## | 2 | ############################################################################## |
15 | 3 | # | 3 | # |
17 | 4 | # Copyright (C) 2011 Associazione OpenERP Italia | 4 | # Copyright (C) 2011-2013 Associazione OpenERP Italia |
18 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
19 | 6 | # | 6 | # |
20 | 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
21 | @@ -12,7 +12,7 @@ | |||
22 | 12 | # This program is distributed in the hope that it will be useful, | 12 | # This program is distributed in the hope that it will be useful, |
23 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
24 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
26 | 15 | # GNU General Public License for more details. | 15 | # GNU Affero General Public License for more details. |
27 | 16 | # | 16 | # |
28 | 17 | # You should have received a copy of the GNU Affero General Public License | 17 | # You should have received a copy of the GNU Affero General Public License |
29 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
30 | @@ -20,5 +20,5 @@ | |||
31 | 20 | ############################################################################## | 20 | ############################################################################## |
32 | 21 | 21 | ||
33 | 22 | import wizard | 22 | import wizard |
34 | 23 | import invoice | ||
35 | 23 | import account | 24 | import account |
36 | 24 | import invoice | ||
37 | 25 | 25 | ||
38 | === modified file 'l10n_it_vat_registries/__openerp__.py' | |||
39 | --- l10n_it_vat_registries/__openerp__.py 2013-02-18 19:37:15 +0000 | |||
40 | +++ l10n_it_vat_registries/__openerp__.py 2013-05-09 15:50:30 +0000 | |||
41 | @@ -1,7 +1,7 @@ | |||
42 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
43 | 2 | ############################################################################## | 2 | ############################################################################## |
44 | 3 | # | 3 | # |
46 | 4 | # Copyright (C) 2011-2012 Associazione OpenERP Italia | 4 | # Copyright (C) 2011-2013 Associazione OpenERP Italia |
47 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
48 | 6 | # Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) | 6 | # Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) |
49 | 7 | # Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) | 7 | # Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) |
50 | @@ -14,7 +14,7 @@ | |||
51 | 14 | # This program is distributed in the hope that it will be useful, | 14 | # This program is distributed in the hope that it will be useful, |
52 | 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
53 | 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
55 | 17 | # GNU General Public License for more details. | 17 | # GNU Affero General Public License for more details. |
56 | 18 | # | 18 | # |
57 | 19 | # You should have received a copy of the GNU Affero General Public License | 19 | # You should have received a copy of the GNU Affero General Public License |
58 | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
59 | @@ -33,8 +33,8 @@ | |||
60 | 33 | ], | 33 | ], |
61 | 34 | "update_xml" : [ | 34 | "update_xml" : [ |
62 | 35 | 'reports.xml', | 35 | 'reports.xml', |
63 | 36 | 'wizard/print_registro_iva.xml', | ||
64 | 36 | 'account_view.xml', | 37 | 'account_view.xml', |
65 | 37 | 'wizard/print_registro_iva.xml', | ||
66 | 38 | ], | 38 | ], |
67 | 39 | "demo_xml" : [], | 39 | "demo_xml" : [], |
68 | 40 | "active": False, | 40 | "active": False, |
69 | 41 | 41 | ||
70 | === added file 'l10n_it_vat_registries/account.py' | |||
71 | --- l10n_it_vat_registries/account.py 1970-01-01 00:00:00 +0000 | |||
72 | +++ l10n_it_vat_registries/account.py 2013-05-09 15:50:30 +0000 | |||
73 | @@ -0,0 +1,30 @@ | |||
74 | 1 | # -*- coding: utf-8 -*- | ||
75 | 2 | ############################################################################## | ||
76 | 3 | # | ||
77 | 4 | # Copyright (C) 2013 Associazione OpenERP Italia | ||
78 | 5 | # (<http://www.openerp-italia.org>). | ||
79 | 6 | # | ||
80 | 7 | # This program is free software: you can redistribute it and/or modify | ||
81 | 8 | # it under the terms of the GNU Affero General Public License as published | ||
82 | 9 | # by the Free Software Foundation, either version 3 of the License, or | ||
83 | 10 | # (at your option) any later version. | ||
84 | 11 | # | ||
85 | 12 | # This program is distributed in the hope that it will be useful, | ||
86 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
87 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
88 | 15 | # GNU Affero General Public License for more details. | ||
89 | 16 | # | ||
90 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
91 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
92 | 19 | # | ||
93 | 20 | ############################################################################## | ||
94 | 21 | |||
95 | 22 | from openerp.osv import fields, osv | ||
96 | 23 | from openerp.tools.translate import _ | ||
97 | 24 | |||
98 | 25 | class account_tax_code(osv.osv): | ||
99 | 26 | _inherit = "account.tax.code" | ||
100 | 27 | |||
101 | 28 | _columns = { | ||
102 | 29 | 'is_base': fields.boolean('Is base', help="This tax code is used for base amounts (field used by VAT registries)"), | ||
103 | 30 | } | ||
104 | 0 | 31 | ||
105 | === removed file 'l10n_it_vat_registries/account.py' | |||
106 | --- l10n_it_vat_registries/account.py 2013-01-29 22:08:50 +0000 | |||
107 | +++ l10n_it_vat_registries/account.py 1970-01-01 00:00:00 +0000 | |||
108 | @@ -1,48 +0,0 @@ | |||
109 | 1 | # -*- coding: utf-8 -*- | ||
110 | 2 | ############################################################################## | ||
111 | 3 | # | ||
112 | 4 | # Copyright (C) 2011-2012 Associazione OpenERP Italia | ||
113 | 5 | # (<http://www.openerp-italia.org>). | ||
114 | 6 | # Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) | ||
115 | 7 | # Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) | ||
116 | 8 | # | ||
117 | 9 | # This program is free software: you can redistribute it and/or modify | ||
118 | 10 | # it under the terms of the GNU Affero General Public License as published | ||
119 | 11 | # by the Free Software Foundation, either version 3 of the License, or | ||
120 | 12 | # (at your option) any later version. | ||
121 | 13 | # | ||
122 | 14 | # This program is distributed in the hope that it will be useful, | ||
123 | 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
124 | 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
125 | 17 | # GNU Affero General Public License for more details. | ||
126 | 18 | # | ||
127 | 19 | # You should have received a copy of the GNU Affero General Public License | ||
128 | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
129 | 21 | # | ||
130 | 22 | ############################################################################## | ||
131 | 23 | |||
132 | 24 | from osv import fields, osv | ||
133 | 25 | from tools.translate import _ | ||
134 | 26 | |||
135 | 27 | |||
136 | 28 | class account_tax(osv.osv): | ||
137 | 29 | |||
138 | 30 | _inherit = 'account.tax' | ||
139 | 31 | _columns = { | ||
140 | 32 | 'exclude_from_registries': fields.boolean( | ||
141 | 33 | 'Exclude from VAT registries'), | ||
142 | 34 | 'base_tax_ids': fields.one2many( | ||
143 | 35 | 'account.tax', 'base_code_id', 'Base Taxes'), # serve ancora? | ||
144 | 36 | } | ||
145 | 37 | _sql_constraints = [ | ||
146 | 38 | ('name_uniq', 'UNIQUE(name)', 'The tax name must be unique!'), | ||
147 | 39 | ] | ||
148 | 40 | |||
149 | 41 | def get_account_tax(self, inv_tax): | ||
150 | 42 | if inv_tax.tax_code_id: | ||
151 | 43 | return self.get_account_tax_by_tax_code(inv_tax.tax_code_id) | ||
152 | 44 | if inv_tax.base_code_id: | ||
153 | 45 | return self.get_account_tax_by_base_code(inv_tax.base_code_id) | ||
154 | 46 | raise osv.except_osv(_('Error'), | ||
155 | 47 | _('No tax codes for invoice tax %s') % str(inv_tax.name)) | ||
156 | 48 | |||
157 | 49 | 0 | ||
158 | === added file 'l10n_it_vat_registries/account_view.xml' | |||
159 | --- l10n_it_vat_registries/account_view.xml 1970-01-01 00:00:00 +0000 | |||
160 | +++ l10n_it_vat_registries/account_view.xml 2013-05-09 15:50:30 +0000 | |||
161 | @@ -0,0 +1,16 @@ | |||
162 | 1 | <?xml version="1.0"?> | ||
163 | 2 | <openerp> | ||
164 | 3 | <data> | ||
165 | 4 | <record id="view_tax_code_form" model="ir.ui.view"> | ||
166 | 5 | <field name="name">account.tax.code.form</field> | ||
167 | 6 | <field name="model">account.tax.code</field> | ||
168 | 7 | <field name="inherit_id" ref="account.view_tax_code_form"></field> | ||
169 | 8 | <field name="arch" type="xml"> | ||
170 | 9 | <field name="sign" position="after"> | ||
171 | 10 | <field name="is_base"/> | ||
172 | 11 | </field> | ||
173 | 12 | </field> | ||
174 | 13 | </record> | ||
175 | 14 | </data> | ||
176 | 15 | </openerp> | ||
177 | 16 | |||
178 | 0 | 17 | ||
179 | === removed file 'l10n_it_vat_registries/account_view.xml' | |||
180 | --- l10n_it_vat_registries/account_view.xml 2013-01-08 23:01:16 +0000 | |||
181 | +++ l10n_it_vat_registries/account_view.xml 1970-01-01 00:00:00 +0000 | |||
182 | @@ -1,17 +0,0 @@ | |||
183 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
184 | 2 | <openerp> | ||
185 | 3 | <data> | ||
186 | 4 | |||
187 | 5 | <record id="view_tax_form" model="ir.ui.view"> | ||
188 | 6 | <field name="name">account.tax.form</field> | ||
189 | 7 | <field name="model">account.tax</field> | ||
190 | 8 | <field name="type">form</field> | ||
191 | 9 | <field name="inherit_id" ref="account.view_tax_form"></field> | ||
192 | 10 | <field name="arch" type="xml"> | ||
193 | 11 | <field name="active" position="after"> | ||
194 | 12 | <field name="exclude_from_registries"/> | ||
195 | 13 | </field> | ||
196 | 14 | </field> | ||
197 | 15 | </record> | ||
198 | 16 | </data> | ||
199 | 17 | </openerp> | ||
200 | 18 | 0 | ||
201 | === modified file 'l10n_it_vat_registries/invoice.py' | |||
202 | --- l10n_it_vat_registries/invoice.py 2013-04-24 10:14:49 +0000 | |||
203 | +++ l10n_it_vat_registries/invoice.py 2013-05-09 15:50:30 +0000 | |||
204 | @@ -1,8 +1,8 @@ | |||
205 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
206 | 2 | ############################################################################## | 2 | ############################################################################## |
210 | 3 | # | 3 | # |
211 | 4 | # Copyright (C) 2011 Associazione OpenERP Italia | 4 | # Copyright (C) 2011-2013 Associazione OpenERP Italia |
212 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
213 | 6 | # | 6 | # |
214 | 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
215 | 8 | # it under the terms of the GNU Affero General Public License as published | 8 | # it under the terms of the GNU Affero General Public License as published |
216 | @@ -22,328 +22,123 @@ | |||
217 | 22 | import time | 22 | import time |
218 | 23 | from report import report_sxw | 23 | from report import report_sxw |
219 | 24 | from tools.translate import _ | 24 | from tools.translate import _ |
222 | 25 | from decimal import * | 25 | import logging |
223 | 26 | import netsvc | 26 | from datetime import datetime |
224 | 27 | |||
225 | 28 | _logger = logging.getLogger(__name__) | ||
226 | 27 | 29 | ||
227 | 28 | class Parser(report_sxw.rml_parse): | 30 | class Parser(report_sxw.rml_parse): |
282 | 29 | 31 | ||
283 | 30 | logger = netsvc.Logger() | 32 | def _tax_amounts_by_code(self, move): |
284 | 31 | 33 | res={} | |
285 | 32 | def _get_partner_type(self, move_line): | 34 | for move_line in move.line_id: |
286 | 33 | partner_type = '' | 35 | if move_line.tax_code_id and move_line.tax_amount: |
287 | 34 | for line in move_line.move_id.line_id: | 36 | if not res.get(move_line.tax_code_id.id): |
288 | 35 | if line.account_id.type == 'payable' or line.account_id.type == 'receivable': | 37 | res[move_line.tax_code_id.id] = 0.0 |
289 | 36 | if not partner_type: | 38 | self.localcontext['used_tax_codes'][move_line.tax_code_id.id] = True |
290 | 37 | partner_type = line.account_id.type | 39 | res[move_line.tax_code_id.id] += (move_line.tax_amount |
291 | 38 | elif partner_type != line.account_id.type: | 40 | * self.localcontext['data']['tax_sign']) |
292 | 39 | raise Exception( | 41 | return res |
239 | 40 | _('The move %s has different partner account type') % move_line.move_id.name) | ||
240 | 41 | return partner_type | ||
241 | 42 | |||
242 | 43 | def _move_total(self, move_line): | ||
243 | 44 | partner_type = self._get_partner_type(move_line) | ||
244 | 45 | total = 0.0 | ||
245 | 46 | for line in move_line.move_id.line_id: | ||
246 | 47 | if line.account_id.type == partner_type: | ||
247 | 48 | total += (line.debit or line.credit) | ||
248 | 49 | return total | ||
249 | 50 | |||
250 | 51 | # Metto al tax code il segno dell'importo dell'imposta. | ||
251 | 52 | # Il tax code ha l'importo in valuta base, ma ha segno negativo per l'IVA a credito (da stampare positiva) | ||
252 | 53 | # e per le note di credito (da stampare negative) | ||
253 | 54 | def _get_amount_with_sign(self, tax_code_amount, amount): | ||
254 | 55 | return abs(tax_code_amount) * cmp(amount, 0) | ||
255 | 56 | |||
256 | 57 | def _is_refund(self, move_line): | ||
257 | 58 | if self._get_partner_type(move_line) == 'receivable' and move_line.debit > move_line.credit: | ||
258 | 59 | return True | ||
259 | 60 | if self._get_partner_type(move_line) == 'payable' and move_line.debit < move_line.credit: | ||
260 | 61 | return True | ||
261 | 62 | |||
262 | 63 | def _get_line_amount_with_sign(self, move_line): | ||
263 | 64 | if self._get_partner_type(move_line) == 'receivable': | ||
264 | 65 | return self._get_amount_with_sign(move_line.tax_amount, move_line.credit - move_line.debit) | ||
265 | 66 | if self._get_partner_type(move_line) == 'payable': | ||
266 | 67 | return self._get_amount_with_sign(move_line.tax_amount, move_line.debit - move_line.credit) | ||
267 | 68 | |||
268 | 69 | # in valuta base | ||
269 | 70 | def _get_invoice_amount_total(self, invoice): | ||
270 | 71 | total = 0.0 | ||
271 | 72 | for inv_tax in invoice.tax_line: | ||
272 | 73 | total += self._get_amount_with_sign(inv_tax.base_amount, inv_tax.base) \ | ||
273 | 74 | + self._get_amount_with_sign(inv_tax.tax_amount, inv_tax.amount) | ||
274 | 75 | return total | ||
275 | 76 | |||
276 | 77 | # in valuta base | ||
277 | 78 | def _get_invoice_amount_untaxed(self, invoice): | ||
278 | 79 | total = 0.0 | ||
279 | 80 | for inv_tax in invoice.tax_line: | ||
280 | 81 | total += self._get_amount_with_sign(inv_tax.base_amount, inv_tax.base) | ||
281 | 82 | return total | ||
293 | 83 | 42 | ||
294 | 84 | def _get_tax_lines(self, move): | 43 | def _get_tax_lines(self, move): |
295 | 85 | res=[] | 44 | res=[] |
299 | 86 | tax_obj = self.pool.get('account.tax') | 45 | tax_code_obj=self.pool.get('account.tax.code') |
297 | 87 | cur_pool = self.pool.get('res.currency') | ||
298 | 88 | inv_pool = self.pool.get('account.invoice') | ||
300 | 89 | # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA | 46 | # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA |
301 | 90 | index=0 | 47 | index=0 |
412 | 91 | totale_iva = 0.0 | 48 | invoice = False |
413 | 92 | totale_iva_inded = 0.0 | 49 | for move_line in move.line_id: |
414 | 93 | invoice_amount_total = 0.0 | 50 | if move_line.invoice: |
415 | 94 | invoice_amount_untaxed = 0.0 | 51 | if invoice and invoice.id != move_line.invoice.id: |
416 | 95 | related_invoices = [] | 52 | raise Exception(_("Move %s contains different invoices") % move.name) |
417 | 96 | 53 | invoice = move_line.invoice | |
418 | 97 | ''' riusciamo a essere sempre indipendenti dalle fatture? | 54 | amounts_by_code = self._tax_amounts_by_code(move) |
419 | 98 | # se c'è l'oggetto fattura, utilizzo il calcolo su fattura | 55 | for tax_code_id in amounts_by_code: |
420 | 99 | for move_line in move.line_id: | 56 | tax_code = tax_code_obj.browse(self.cr, self.uid, tax_code_id) |
421 | 100 | if move_line.invoice and move_line.invoice.id not in related_invoices: | 57 | tax_item = { |
422 | 101 | related_invoices.append(move_line.invoice.id) | 58 | 'tax_code_name': tax_code.name, |
423 | 102 | ''' | 59 | 'amount': amounts_by_code[tax_code_id], |
424 | 103 | 60 | 'index': index, | |
425 | 104 | if related_invoices: | 61 | 'invoice_date': (invoice and invoice.date_invoice |
426 | 105 | for invoice_id in related_invoices: | 62 | or move.date or ''), |
427 | 106 | return self._get_tax_lines_by_invoice(inv_pool.browse(self.cr, self.uid, invoice_id)) | 63 | 'supplier_invoice_number': (invoice and invoice.supplier_invoice_number or '') |
428 | 107 | 64 | } | |
429 | 108 | for move_line in move.line_id: | 65 | res.append(tax_item) |
430 | 109 | tax_item = {} | 66 | index += 1 |
431 | 110 | if move_line.tax_code_id and move_line.tax_code_id.tax_ids: | 67 | return res |
432 | 111 | # Nel wizard ho già controllato che le eventuali diverse | 68 | |
433 | 112 | # imposte abbiamo la stessa aliquota. | 69 | def build_parent_tax_codes(self, tax_code): |
434 | 113 | # Le diverse imposte devono comunque usare gli stessi tax code | 70 | res={} |
435 | 114 | main_tax = tax_obj.get_main_tax(move_line.tax_code_id.tax_ids[0]) | 71 | if tax_code.parent_id and tax_code.parent_id.parent_id: |
436 | 115 | if main_tax.exclude_from_registries: | 72 | res[tax_code.parent_id.id]=True |
437 | 116 | self.logger.notifyChannel("l10n_it_vat_registries", netsvc.LOG_INFO, | 73 | res.update(self.build_parent_tax_codes(tax_code.parent_id)) |
438 | 117 | _('The tax %s is excluded from registries') % main_tax.name) | 74 | return res |
439 | 118 | continue | 75 | |
440 | 119 | # sommo gli imponibili relativi all'imposta corrente | 76 | def _compute_totals(self, tax_code_ids): |
331 | 120 | base_amount = 0.0 | ||
332 | 121 | for line in move_line.move_id.line_id: | ||
333 | 122 | if line.tax_code_id.id == main_tax.base_code_id.id: | ||
334 | 123 | base_amount += self._get_line_amount_with_sign(line) | ||
335 | 124 | if base_amount and main_tax.amount: | ||
336 | 125 | actual_tax_amount = base_amount * main_tax.amount | ||
337 | 126 | else: | ||
338 | 127 | actual_tax_amount = move_line.tax_amount | ||
339 | 128 | actual_tax_amount = cur_pool.round( | ||
340 | 129 | self.cr, self.uid, move.company_id.currency_id, | ||
341 | 130 | actual_tax_amount) | ||
342 | 131 | # calcolo % indetraibile | ||
343 | 132 | non_deductible = 0.0 | ||
344 | 133 | if abs(actual_tax_amount) != abs(move_line.tax_amount): | ||
345 | 134 | non_deductible = 100 | ||
346 | 135 | if move_line.tax_amount: | ||
347 | 136 | non_deductible = 100 - abs(( | ||
348 | 137 | move_line.tax_amount * 100.0) / actual_tax_amount) | ||
349 | 138 | non_deductible = cur_pool.round( | ||
350 | 139 | self.cr, self.uid, move.company_id.currency_id, | ||
351 | 140 | non_deductible) | ||
352 | 141 | # calcolo il totale dell'operazione | ||
353 | 142 | invoice_amount_total = self._move_total(move_line) | ||
354 | 143 | if self._is_refund(move_line): | ||
355 | 144 | invoice_amount_total = - invoice_amount_total | ||
356 | 145 | str_non_deductible = str(non_deductible).split('.')[0] | ||
357 | 146 | tax_item = { | ||
358 | 147 | 'tax_percentage': main_tax.amount and str( | ||
359 | 148 | main_tax.amount * 100).split('.')[0] or | ||
360 | 149 | move_line.tax_code_id.name, | ||
361 | 150 | 'tax_code_name': move_line.tax_code_id.name, | ||
362 | 151 | 'base': base_amount, | ||
363 | 152 | 'amount': actual_tax_amount, | ||
364 | 153 | 'non_deductible': str_non_deductible != '0' and | ||
365 | 154 | str_non_deductible or '', | ||
366 | 155 | 'index': index, | ||
367 | 156 | 'amount_total': invoice_amount_total, | ||
368 | 157 | } | ||
369 | 158 | res.append(tax_item) | ||
370 | 159 | iva = cur_pool.round( | ||
371 | 160 | self.cr, self.uid, move.company_id.currency_id, | ||
372 | 161 | (actual_tax_amount * (100 - non_deductible) * 0.01)) | ||
373 | 162 | iva_inded = cur_pool.round( | ||
374 | 163 | self.cr, self.uid, move.company_id.currency_id, | ||
375 | 164 | (actual_tax_amount * non_deductible * 0.01)) | ||
376 | 165 | tax_difference= (iva + iva_inded) - actual_tax_amount | ||
377 | 166 | # se risulta un'eccedenza, la tolgo dalla parte detraibile | ||
378 | 167 | if tax_difference > 0: | ||
379 | 168 | iva = iva - tax_difference | ||
380 | 169 | # se risulta una mancanza, la aggiungo alla parte indetraibile | ||
381 | 170 | elif tax_difference < 0: | ||
382 | 171 | iva_inded = iva_inded + tax_difference | ||
383 | 172 | totale_iva += iva | ||
384 | 173 | invoice_amount_untaxed += base_amount | ||
385 | 174 | totale_iva_inded += iva_inded | ||
386 | 175 | index += 1 | ||
387 | 176 | |||
388 | 177 | if tax_item: | ||
389 | 178 | if tax_item['tax_code_name'] not in self.localcontext[ | ||
390 | 179 | 'tax_codes']: | ||
391 | 180 | self.localcontext['tax_codes'][tax_item[ | ||
392 | 181 | 'tax_code_name']] = { | ||
393 | 182 | 'base': tax_item['base'], | ||
394 | 183 | 'amount': tax_item['amount'], | ||
395 | 184 | } | ||
396 | 185 | else: | ||
397 | 186 | self.localcontext['tax_codes'][tax_item[ | ||
398 | 187 | 'tax_code_name']]['base'] += tax_item['base'] | ||
399 | 188 | self.localcontext['tax_codes'][tax_item[ | ||
400 | 189 | 'tax_code_name']]['amount'] += tax_item['amount'] | ||
401 | 190 | |||
402 | 191 | self.localcontext['totali'][ | ||
403 | 192 | 'totale_operazioni'] += invoice_amount_total | ||
404 | 193 | self.localcontext['totali'][ | ||
405 | 194 | 'totale_imponibili'] += invoice_amount_untaxed | ||
406 | 195 | self.localcontext['totali']['totale_iva'] += totale_iva | ||
407 | 196 | self.localcontext['totali']['totale_iva_inded'] += totale_iva_inded | ||
408 | 197 | |||
409 | 198 | return res | ||
410 | 199 | |||
411 | 200 | def _get_tax_lines_by_invoice(self, invoice): | ||
441 | 201 | res=[] | 77 | res=[] |
570 | 202 | tax_obj = self.pool.get('account.tax') | 78 | res_dict={} |
571 | 203 | # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA | 79 | tax_code_obj = self.pool.get('account.tax.code') |
572 | 204 | index = 0 | 80 | for period_id in self.localcontext['data']['period_ids']: |
573 | 205 | totale_iva = 0.0 | 81 | for tax_code in tax_code_obj.browse(self.cr, self.uid, |
574 | 206 | totale_iva_inded = 0.0 | 82 | tax_code_ids, context={ |
575 | 207 | invoice_amount_total = 0.0 | 83 | 'period_id': period_id, |
576 | 208 | invoice_amount_untaxed = 0.0 | 84 | }): |
577 | 209 | for inv_tax in invoice.tax_line: | 85 | if not res_dict.get(tax_code.id): |
578 | 210 | tax_item = {} | 86 | res_dict[tax_code.id] = 0.0 |
579 | 211 | if inv_tax.base_code_id and inv_tax.tax_code_id: | 87 | res_dict[tax_code.id] += (tax_code.sum_period |
580 | 212 | account_tax = tax_obj.get_account_tax(inv_tax) | 88 | * self.localcontext['data']['tax_sign']) |
581 | 213 | if account_tax.exclude_from_registries: | 89 | for tax_code_id in res_dict: |
582 | 214 | self.logger.notifyChannel("l10n_it_vat_registries", | 90 | tax_code = tax_code_obj.browse(self.cr, self.uid, tax_code_id) |
583 | 215 | netsvc.LOG_INFO, _( | 91 | if res_dict[tax_code_id]: |
584 | 216 | 'The tax %s is excluded from registries') | 92 | res.append((tax_code.name,res_dict[tax_code_id],tax_code.is_base)) |
457 | 217 | % account_tax.name) | ||
458 | 218 | continue | ||
459 | 219 | account_tax_amount = account_tax.amount | ||
460 | 220 | invoice_amount_total = self._get_invoice_amount_total(invoice) | ||
461 | 221 | invoice_amount_untaxed = self._get_invoice_amount_untaxed( | ||
462 | 222 | invoice) | ||
463 | 223 | amount = self._get_amount_with_sign(inv_tax.tax_amount, | ||
464 | 224 | inv_tax.amount) | ||
465 | 225 | base = self._get_amount_with_sign(inv_tax.base_amount, | ||
466 | 226 | inv_tax.base) | ||
467 | 227 | # calcolo le note di credito con segno invertito | ||
468 | 228 | if invoice.type in ('in_refund', 'out_refund'): | ||
469 | 229 | amount = -amount | ||
470 | 230 | base = -base | ||
471 | 231 | invoice_amount_untaxed = -invoice_amount_untaxed | ||
472 | 232 | invoice_amount_total = -invoice_amount_total | ||
473 | 233 | tax_item = { | ||
474 | 234 | 'tax_percentage': account_tax_amount and str( | ||
475 | 235 | account_tax_amount * 100).split('.')[0] or | ||
476 | 236 | inv_tax.tax_code_id.name, | ||
477 | 237 | 'base': base, | ||
478 | 238 | 'amount': amount, # in valuta base | ||
479 | 239 | 'non_deductible': 0.0, | ||
480 | 240 | 'index': index, | ||
481 | 241 | 'amount_total': invoice_amount_total, | ||
482 | 242 | } | ||
483 | 243 | res.append(tax_item) | ||
484 | 244 | totale_iva += amount | ||
485 | 245 | index += 1 | ||
486 | 246 | # Se non c'è il tax code imponibile, cerco la tassa relativa alla parte non deducibile | ||
487 | 247 | elif inv_tax.tax_code_id: | ||
488 | 248 | tax = tax_obj.get_main_tax(tax_obj.get_account_tax(inv_tax)) | ||
489 | 249 | if tax.exclude_from_registries: | ||
490 | 250 | self.logger.notifyChannel("l10n_it_vat_registries", | ||
491 | 251 | netsvc.LOG_INFO, | ||
492 | 252 | _('The tax %s is excluded from registries') % tax.name) | ||
493 | 253 | continue | ||
494 | 254 | for inv_tax_2 in invoice.tax_line: | ||
495 | 255 | if inv_tax_2.base_code_id and not inv_tax_2.tax_code_id: | ||
496 | 256 | base_tax = tax_obj.get_main_tax( | ||
497 | 257 | tax_obj.get_account_tax(inv_tax_2)) | ||
498 | 258 | # Se hanno la stessa tassa | ||
499 | 259 | if base_tax.id == tax.id: | ||
500 | 260 | # Uso il valore assoluto perchè riferendosi | ||
501 | 261 | # alla stessa imposta non ci possono essere | ||
502 | 262 | # segni differenti | ||
503 | 263 | non_deductible = (abs(inv_tax_2.base_amount) / | ||
504 | 264 | (abs(inv_tax.base_amount) + abs( | ||
505 | 265 | inv_tax_2.base_amount)) * 100) | ||
506 | 266 | invoice_amount_total = \ | ||
507 | 267 | self._get_invoice_amount_total(invoice) | ||
508 | 268 | invoice_amount_untaxed = \ | ||
509 | 269 | self._get_invoice_amount_untaxed(invoice) | ||
510 | 270 | amount = self._get_amount_with_sign( | ||
511 | 271 | inv_tax.tax_amount, inv_tax.amount) | ||
512 | 272 | base = self._get_amount_with_sign( | ||
513 | 273 | inv_tax.base_amount, inv_tax.base) | ||
514 | 274 | amount2 = self._get_amount_with_sign( | ||
515 | 275 | inv_tax_2.tax_amount, inv_tax_2.amount) | ||
516 | 276 | base2 = self._get_amount_with_sign( | ||
517 | 277 | inv_tax_2.base_amount, inv_tax_2.base) | ||
518 | 278 | # calcolo le note di credito con segno invertito | ||
519 | 279 | if invoice.type in ('in_refund', 'out_refund'): | ||
520 | 280 | amount = -amount | ||
521 | 281 | base = -base | ||
522 | 282 | amount2 = -amount2 | ||
523 | 283 | base2 = -base2 | ||
524 | 284 | invoice_amount_untaxed = \ | ||
525 | 285 | -invoice_amount_untaxed | ||
526 | 286 | invoice_amount_total = -invoice_amount_total | ||
527 | 287 | tax_item = { | ||
528 | 288 | 'tax_percentage': base_tax.amount and str( | ||
529 | 289 | base_tax.amount * 100).split('.')[0] or | ||
530 | 290 | inv_tax.tax_code_id.name, | ||
531 | 291 | 'base': base + base2, | ||
532 | 292 | 'amount': amount + amount2, | ||
533 | 293 | 'non_deductible': non_deductible and str( | ||
534 | 294 | non_deductible).split('.')[0] or '', | ||
535 | 295 | 'index': index, | ||
536 | 296 | 'amount_total': invoice_amount_total, | ||
537 | 297 | } | ||
538 | 298 | res.append(tax_item) | ||
539 | 299 | totale_iva += amount | ||
540 | 300 | totale_iva_inded += amount2 | ||
541 | 301 | index += 1 | ||
542 | 302 | break | ||
543 | 303 | elif not inv_tax.tax_code_id and not inv_tax.base_code_id: | ||
544 | 304 | self.logger.notifyChannel("l10n_it_vat_registries", | ||
545 | 305 | netsvc.LOG_INFO, | ||
546 | 306 | _('The tax %s has no tax codes') % inv_tax.name) | ||
547 | 307 | continue | ||
548 | 308 | if tax_item: | ||
549 | 309 | if tax_item['tax_percentage'] not in self.localcontext[ | ||
550 | 310 | 'tax_codes']: | ||
551 | 311 | self.localcontext['tax_codes'][tax_item[ | ||
552 | 312 | 'tax_percentage']] = { | ||
553 | 313 | 'base': tax_item['base'], | ||
554 | 314 | 'amount': tax_item['amount'], | ||
555 | 315 | } | ||
556 | 316 | else: | ||
557 | 317 | self.localcontext['tax_codes'][tax_item[ | ||
558 | 318 | 'tax_percentage']]['base'] += tax_item['base'] | ||
559 | 319 | self.localcontext['tax_codes'][tax_item[ | ||
560 | 320 | 'tax_percentage']]['amount'] += tax_item['amount'] | ||
561 | 321 | |||
562 | 322 | self.localcontext['totali'][ | ||
563 | 323 | 'totale_operazioni'] += invoice_amount_total | ||
564 | 324 | self.localcontext['totali'][ | ||
565 | 325 | 'totale_imponibili'] += invoice_amount_untaxed | ||
566 | 326 | # da analizzare self.totale_variazioni += invoice.amount_total | ||
567 | 327 | self.localcontext['totali']['totale_iva'] += totale_iva | ||
568 | 328 | self.localcontext['totali']['totale_iva_inded'] += totale_iva_inded | ||
569 | 329 | |||
585 | 330 | return res | 93 | return res |
586 | 94 | |||
587 | 95 | def _get_tax_codes(self): | ||
588 | 96 | return self._compute_totals(self.localcontext['used_tax_codes'].keys()) | ||
589 | 97 | |||
590 | 98 | def _get_tax_codes_totals(self): | ||
591 | 99 | parent_codes = {} | ||
592 | 100 | tax_code_obj = self.pool.get('account.tax.code') | ||
593 | 101 | for tax_code in tax_code_obj.browse(self.cr, self.uid, | ||
594 | 102 | self.localcontext['used_tax_codes'].keys()): | ||
595 | 103 | parent_codes.update(self.build_parent_tax_codes(tax_code)) | ||
596 | 104 | return self._compute_totals(parent_codes.keys()) | ||
597 | 105 | |||
598 | 106 | def _get_start_date(self): | ||
599 | 107 | period_obj = self.pool.get('account.period') | ||
600 | 108 | start_date = False | ||
601 | 109 | for period in period_obj.browse(self.cr,self.uid, | ||
602 | 110 | self.localcontext['data']['period_ids']): | ||
603 | 111 | period_start = datetime.strptime(period.date_start, '%Y-%m-%d') | ||
604 | 112 | if not start_date or start_date > period_start: | ||
605 | 113 | start_date = period_start | ||
606 | 114 | return start_date.strftime('%Y-%m-%d') | ||
607 | 115 | |||
608 | 116 | def _get_end_date(self): | ||
609 | 117 | period_obj = self.pool.get('account.period') | ||
610 | 118 | end_date = False | ||
611 | 119 | for period in period_obj.browse(self.cr,self.uid, | ||
612 | 120 | self.localcontext['data']['period_ids']): | ||
613 | 121 | period_end = datetime.strptime(period.date_stop, '%Y-%m-%d') | ||
614 | 122 | if not end_date or end_date < period_end: | ||
615 | 123 | end_date = period_end | ||
616 | 124 | return end_date.strftime('%Y-%m-%d') | ||
617 | 331 | 125 | ||
618 | 332 | def __init__(self, cr, uid, name, context): | 126 | def __init__(self, cr, uid, name, context): |
619 | 333 | super(Parser, self).__init__(cr, uid, name, context) | 127 | super(Parser, self).__init__(cr, uid, name, context) |
620 | 334 | self.localcontext.update({ | 128 | self.localcontext.update({ |
621 | 335 | 'time': time, | ||
622 | 336 | 'tax_lines': self._get_tax_lines, | 129 | 'tax_lines': self._get_tax_lines, |
631 | 337 | 'totali': { | 130 | 'tax_codes': self._get_tax_codes, |
632 | 338 | 'totale_operazioni': 0.0, | 131 | 'tax_codes_totals': self._get_tax_codes_totals, |
633 | 339 | 'totale_imponibili': 0.0, | 132 | 'used_tax_codes': {}, |
634 | 340 | 'totale_variazioni': 0.0, | 133 | 'start_date': self._get_start_date, |
635 | 341 | 'totale_iva': 0.0, | 134 | 'end_date': self._get_end_date, |
628 | 342 | 'totale_iva_inded': 0.0, | ||
629 | 343 | }, | ||
630 | 344 | 'tax_codes': {}, | ||
636 | 345 | }) | 135 | }) |
637 | 346 | 136 | ||
638 | 137 | def set_context(self, objects, data, ids, report_type=None): | ||
639 | 138 | self.localcontext.update({ | ||
640 | 139 | 'fiscal_page_base': data.get('fiscal_page_base'), | ||
641 | 140 | }) | ||
642 | 141 | return super(Parser, self).set_context(objects, data, ids, report_type=report_type) | ||
643 | 347 | 142 | ||
644 | 348 | report_sxw.report_sxw('report.registro_iva_vendite', | 143 | report_sxw.report_sxw('report.registro_iva_vendite', |
645 | 349 | 'registro_iva_vendite', | 144 | 'registro_iva_vendite', |
646 | 350 | 145 | ||
647 | === modified file 'l10n_it_vat_registries/reports.xml' | |||
648 | --- l10n_it_vat_registries/reports.xml 2013-01-08 23:01:16 +0000 | |||
649 | +++ l10n_it_vat_registries/reports.xml 2013-05-09 15:50:30 +0000 | |||
650 | @@ -37,8 +37,7 @@ | |||
651 | 37 | <td> | 37 | <td> |
652 | 38 | <div>P. IVA: ${company.partner_id.vat or ''|entity}</div> | 38 | <div>P. IVA: ${company.partner_id.vat or ''|entity}</div> |
653 | 39 | <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div> | 39 | <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div> |
656 | 40 | <div>Codice Attività:</div> | 40 | |
655 | 41 | <div>Registro Imprese:</div> | ||
657 | 42 | </td> | 41 | </td> |
658 | 43 | </tr> | 42 | </tr> |
659 | 44 | </table> | 43 | </table> |
660 | @@ -57,7 +56,11 @@ | |||
661 | 57 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; | 56 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; |
662 | 58 | for(var i in x) { | 57 | for(var i in x) { |
663 | 59 | var y = document.getElementsByClassName(x[i]); | 58 | var y = document.getElementsByClassName(x[i]); |
665 | 60 | for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; | 59 | for(var j=0; j<y.length; ++j) { |
666 | 60 | if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};} | ||
667 | 61 | else{y[j].textContent = vars[x[i]];} | ||
668 | 62 | } | ||
669 | 63 | |||
670 | 61 | } | 64 | } |
671 | 62 | } | 65 | } |
672 | 63 | </script> | 66 | </script> |
673 | @@ -115,8 +118,7 @@ | |||
674 | 115 | <td> | 118 | <td> |
675 | 116 | <div>P. IVA: ${company.partner_id.vat or ''|entity}</div> | 119 | <div>P. IVA: ${company.partner_id.vat or ''|entity}</div> |
676 | 117 | <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div> | 120 | <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div> |
679 | 118 | <div>Codice Attività:</div> | 121 | |
678 | 119 | <div>Registro Imprese:</div> | ||
680 | 120 | </td> | 122 | </td> |
681 | 121 | </tr> | 123 | </tr> |
682 | 122 | </table> | 124 | </table> |
683 | @@ -135,7 +137,11 @@ | |||
684 | 135 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; | 137 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; |
685 | 136 | for(var i in x) { | 138 | for(var i in x) { |
686 | 137 | var y = document.getElementsByClassName(x[i]); | 139 | var y = document.getElementsByClassName(x[i]); |
688 | 138 | for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; | 140 | for(var j=0; j<y.length; ++j) { |
689 | 141 | if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};} | ||
690 | 142 | else{y[j].textContent = vars[x[i]];} | ||
691 | 143 | } | ||
692 | 144 | |||
693 | 139 | } | 145 | } |
694 | 140 | } | 146 | } |
695 | 141 | </script> | 147 | </script> |
696 | @@ -193,8 +199,7 @@ | |||
697 | 193 | <td> | 199 | <td> |
698 | 194 | <div>P. IVA: ${company.partner_id.vat or ''|entity}</div> | 200 | <div>P. IVA: ${company.partner_id.vat or ''|entity}</div> |
699 | 195 | <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div> | 201 | <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div> |
702 | 196 | <div>Codice Attività:</div> | 202 | |
701 | 197 | <div>Registro Imprese:</div> | ||
703 | 198 | </td> | 203 | </td> |
704 | 199 | </tr> | 204 | </tr> |
705 | 200 | </table> | 205 | </table> |
706 | @@ -213,7 +218,11 @@ | |||
707 | 213 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; | 218 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; |
708 | 214 | for(var i in x) { | 219 | for(var i in x) { |
709 | 215 | var y = document.getElementsByClassName(x[i]); | 220 | var y = document.getElementsByClassName(x[i]); |
711 | 216 | for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; | 221 | for(var j=0; j<y.length; ++j) { |
712 | 222 | if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};} | ||
713 | 223 | else{y[j].textContent = vars[x[i]];} | ||
714 | 224 | } | ||
715 | 225 | |||
716 | 217 | } | 226 | } |
717 | 218 | } | 227 | } |
718 | 219 | </script> | 228 | </script> |
719 | 220 | 229 | ||
720 | === modified file 'l10n_it_vat_registries/templates/registro_iva_acquisti.mako' | |||
721 | --- l10n_it_vat_registries/templates/registro_iva_acquisti.mako 2013-01-08 23:01:16 +0000 | |||
722 | +++ l10n_it_vat_registries/templates/registro_iva_acquisti.mako 2013-05-09 15:50:30 +0000 | |||
723 | @@ -19,20 +19,19 @@ | |||
724 | 19 | <body> | 19 | <body> |
725 | 20 | <h2>Fatture Ricevute</h2> | 20 | <h2>Fatture Ricevute</h2> |
726 | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> |
728 | 22 | <table style="width:100%;" cellspacing="0"> | 22 | <table style="width:100%; font-size: small;" cellspacing="0"> |
729 | 23 | <thead> | 23 | <thead> |
730 | 24 | <tr> | 24 | <tr> |
731 | 25 | <th class="left_without_line">Data registrazione</th> | 25 | <th class="left_without_line">Data registrazione</th> |
732 | 26 | <th class="left_without_line">Numero</th> | 26 | <th class="left_without_line">Numero</th> |
733 | 27 | <th class="left_without_line">Ragione sociale</th> | 27 | <th class="left_without_line">Ragione sociale</th> |
734 | 28 | <th class="left_without_line">Numero registrazione</th> | ||
735 | 28 | <th class="left_without_line">Numero fattura</th> | 29 | <th class="left_without_line">Numero fattura</th> |
736 | 29 | <th class="left_without_line">Data fattura</th> | 30 | <th class="left_without_line">Data fattura</th> |
738 | 30 | <th class="left_without_line">Causale</th> | 31 | <th class="left_without_line">Sezionale</th> |
739 | 31 | <th class="right_without_line">Totale fattura</th> | 32 | <th class="right_without_line">Totale fattura</th> |
740 | 32 | <th class="right_without_line">Imponibile</th> | ||
741 | 33 | <th class="right_without_line">% IVA</th> | ||
742 | 34 | <th class="right_without_line">Imposta</th> | 33 | <th class="right_without_line">Imposta</th> |
744 | 35 | <th class="right_without_line">% inded.</th> | 34 | <th class="right_without_line">Importo</th> |
745 | 36 | <th></th> | 35 | <th></th> |
746 | 37 | </tr> | 36 | </tr> |
747 | 38 | </thead> | 37 | </thead> |
748 | @@ -63,7 +62,7 @@ | |||
749 | 63 | </td><td class="left_without_line"> | 62 | </td><td class="left_without_line"> |
750 | 64 | %endif | 63 | %endif |
751 | 65 | %if line['index']==0: | 64 | %if line['index']==0: |
753 | 66 | ${object.partner_id.name or ''| entity} | 65 | ${object.partner_id.name or ''| entity} |
754 | 67 | %endif | 66 | %endif |
755 | 68 | %if line['index']==0: | 67 | %if line['index']==0: |
756 | 69 | </td><td class="left_with_line"> | 68 | </td><td class="left_with_line"> |
757 | @@ -79,19 +78,23 @@ | |||
758 | 79 | </td><td class="left_without_line"> | 78 | </td><td class="left_without_line"> |
759 | 80 | %endif | 79 | %endif |
760 | 81 | %if line['index']==0: | 80 | %if line['index']==0: |
774 | 82 | ${ formatLang(object.date,date=True) or '' | entity} | 81 | ${ line['supplier_invoice_number'] or '' | entity} |
775 | 83 | %endif | 82 | %endif |
776 | 84 | %if line['index']==0: | 83 | %if line['index']==0: |
777 | 85 | </td><td class="left_with_line"> | 84 | </td><td class="left_with_line"> |
778 | 86 | %else: | 85 | %else: |
779 | 87 | </td><td class="left_without_line"> | 86 | </td><td class="left_without_line"> |
780 | 88 | %endif | 87 | %endif |
781 | 89 | %if line['index']==0: | 88 | %if line['index']==0: |
782 | 90 | %if line['amount_total'] >= 0: | 89 | ${ formatLang(line['invoice_date'],date=True) or '' | entity} |
783 | 91 | Fattura | 90 | %endif |
784 | 92 | %else: | 91 | %if line['index']==0: |
785 | 93 | Nota di credito | 92 | </td><td class="left_with_line"> |
786 | 94 | %endif | 93 | %else: |
787 | 94 | </td><td class="left_without_line"> | ||
788 | 95 | %endif | ||
789 | 96 | %if line['index']==0: | ||
790 | 97 | ${object.journal_id.name or ''| entity} | ||
791 | 95 | %endif | 98 | %endif |
792 | 96 | %if line['index']==0: | 99 | %if line['index']==0: |
793 | 97 | </td><td class="right_with_line"> | 100 | </td><td class="right_with_line"> |
794 | @@ -99,34 +102,19 @@ | |||
795 | 99 | </td><td class="right_without_line"> | 102 | </td><td class="right_without_line"> |
796 | 100 | %endif | 103 | %endif |
797 | 101 | %if line['index']==0: | 104 | %if line['index']==0: |
826 | 102 | ${ formatLang(line['amount_total']) | entity} | 105 | ${ formatLang(object.amount) | entity} |
827 | 103 | %endif | 106 | %endif |
828 | 104 | </td> | 107 | </td> |
829 | 105 | %if line['index']==0: | 108 | %if line['index']==0: |
830 | 106 | <td class="right_with_line">${ formatLang(line['base']) or ''| entity}</td> | 109 | <td class="right_with_line">${ (line['tax_code_name']) or ''| entity}</td> |
831 | 107 | %else: | 110 | %else: |
832 | 108 | <td class="right_without_line">${ formatLang(line['base']) or ''| entity}</td> | 111 | <td class="right_without_line">${ (line['tax_code_name']) or ''| entity}</td> |
833 | 109 | %endif | 112 | %endif |
834 | 110 | %if line['index']==0: | 113 | %if line['index']==0: |
835 | 111 | <td class="right_with_line">${ line['tax_percentage'] or ''| entity}</td> | 114 | <td class="right_with_line">${ formatLang(line['amount'])| entity}</td> |
836 | 112 | %else: | 115 | %else: |
837 | 113 | <td class="right_without_line">${ line['tax_percentage'] or ''| entity}</td> | 116 | <td class="right_without_line">${ formatLang(line['amount'])| entity}</td> |
838 | 114 | %endif | 117 | %endif |
811 | 115 | %if line['index']==0: | ||
812 | 116 | <td class="right_with_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
813 | 117 | %else: | ||
814 | 118 | <td class="right_without_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
815 | 119 | %endif | ||
816 | 120 | %if line['index']==0: | ||
817 | 121 | <td class="right_with_line"> | ||
818 | 122 | %else: | ||
819 | 123 | <td class="right_without_line"> | ||
820 | 124 | %endif | ||
821 | 125 | %if line['non_deductible']: | ||
822 | 126 | ${ line['non_deductible'] | entity} % | ||
823 | 127 | %endif | ||
824 | 128 | </td> | ||
825 | 129 | <td></td> | ||
839 | 130 | </tr> | 118 | </tr> |
840 | 131 | %endfor | 119 | %endfor |
841 | 132 | %endfor | 120 | %endfor |
842 | @@ -134,34 +122,87 @@ | |||
843 | 134 | </table> | 122 | </table> |
844 | 135 | <div style="page-break-inside: avoid;"> | 123 | <div style="page-break-inside: avoid;"> |
845 | 136 | <br/> | 124 | <br/> |
846 | 125 | <% tax_code_list = tax_codes() %> | ||
847 | 126 | <% tax_code_totals_list = tax_codes_totals() %> | ||
848 | 137 | <table style="width:100%; " border="1"> | 127 | <table style="width:100%; " border="1"> |
849 | 138 | <tr style="border-style:ridge;border-width:5px"> | 128 | <tr style="border-style:ridge;border-width:5px"> |
876 | 139 | <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> | 129 | <td colspan="3" style="padding:10; ">Periodo di stampa dal <strong>${formatLang(start_date(),date=True)| entity}</strong> al <strong>${formatLang(end_date(),date=True)| entity}</strong></td> |
877 | 140 | </tr> | 130 | </tr> |
878 | 141 | <tr> | 131 | <tr> |
879 | 142 | <td rowspan="2" style="vertical-align:text-top;padding:10"> | 132 | <td colspan="2" style="vertical-align:text-top;padding:10"> |
880 | 143 | <table style="width:100%;"> | 133 | <h3>Dettaglio</h3> |
881 | 144 | <tr> | 134 | <table style="width:100%;"> |
882 | 145 | <th style="text-align:left">Descrizione</th> | 135 | <tr> |
883 | 146 | <th style="text-align:right">Imponibile</th> | 136 | <th style="text-align:left">Descrizione</th> |
884 | 147 | <th style="text-align:right">Imposta</th> | 137 | <th style="text-align:right">Importo</th> |
885 | 148 | </tr> | 138 | </tr> |
886 | 149 | %for tax_code in tax_codes : | 139 | %for tax_code_tuple in tax_code_list : |
887 | 150 | <tr> | 140 | % if not tax_code_tuple[2]: |
888 | 151 | <td>${tax_code|entity} | 141 | <tr> |
889 | 152 | </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity} | 142 | <td>${tax_code_tuple[0]|entity} |
890 | 153 | </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['amount']) or ''|entity} | 143 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} |
891 | 154 | </td> | 144 | </td> |
892 | 155 | </tr> | 145 | </tr> |
893 | 156 | %endfor | 146 | %endif |
894 | 157 | </table> | 147 | %endfor |
895 | 158 | </td><td style="padding:10">Totale operazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_operazioni'])|entity}</strong></p><br/></td> | 148 | </table> |
896 | 159 | <td colspan="2" style="padding:10">Totale imponibili:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_imponibili'])|entity}</strong></p><br/></td> | 149 | </td> |
897 | 160 | </tr> | 150 | <td style="vertical-align:text-top;padding:10"> |
898 | 161 | <tr> | 151 | <h3>Totali</h3> |
899 | 162 | <td style="padding:10">Totale variazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_variazioni'])|entity}</strong></p><br/></td> | 152 | <table style="width:100%;"> |
900 | 163 | <td style="padding:10">Totale IVA Detraibile:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva'])|entity}</strong></p><br/></td> | 153 | <tr> |
901 | 164 | <td style="padding:10">Totale IVA Indetraibile:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva_inded'])|entity}</strong></p><br/></td> | 154 | <th style="text-align:left">Descrizione</th> |
902 | 155 | <th style="text-align:right">Importo</th> | ||
903 | 156 | </tr> | ||
904 | 157 | %for tax_code_tuple in tax_code_totals_list : | ||
905 | 158 | % if not tax_code_tuple[2]: | ||
906 | 159 | <tr> | ||
907 | 160 | <td>${tax_code_tuple[0]|entity} | ||
908 | 161 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
909 | 162 | </td> | ||
910 | 163 | </tr> | ||
911 | 164 | %endif | ||
912 | 165 | %endfor | ||
913 | 166 | </table> | ||
914 | 167 | </td> | ||
915 | 168 | </tr> | ||
916 | 169 | <tr> | ||
917 | 170 | <td colspan="2" style="vertical-align:text-top;padding:10"> | ||
918 | 171 | <h3>Dettaglio imponibili</h3> | ||
919 | 172 | <table style="width:100%;"> | ||
920 | 173 | <tr> | ||
921 | 174 | <th style="text-align:left">Descrizione</th> | ||
922 | 175 | <th style="text-align:right">Importo</th> | ||
923 | 176 | </tr> | ||
924 | 177 | %for tax_code_tuple in tax_code_list : | ||
925 | 178 | % if tax_code_tuple[2]: | ||
926 | 179 | <tr> | ||
927 | 180 | <td>${tax_code_tuple[0]|entity} | ||
928 | 181 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
929 | 182 | </td> | ||
930 | 183 | </tr> | ||
931 | 184 | %endif | ||
932 | 185 | %endfor | ||
933 | 186 | </table> | ||
934 | 187 | </td> | ||
935 | 188 | <td style="vertical-align:text-top;padding:10"> | ||
936 | 189 | <h3>Totali imponibili</h3> | ||
937 | 190 | <table style="width:100%;"> | ||
938 | 191 | <tr> | ||
939 | 192 | <th style="text-align:left">Descrizione</th> | ||
940 | 193 | <th style="text-align:right">Importo</th> | ||
941 | 194 | </tr> | ||
942 | 195 | %for tax_code_tuple in tax_code_totals_list : | ||
943 | 196 | % if tax_code_tuple[2]: | ||
944 | 197 | <tr> | ||
945 | 198 | <td>${tax_code_tuple[0]|entity} | ||
946 | 199 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
947 | 200 | </td> | ||
948 | 201 | </tr> | ||
949 | 202 | %endif | ||
950 | 203 | %endfor | ||
951 | 204 | </table> | ||
952 | 205 | </td> | ||
953 | 165 | </tr> | 206 | </tr> |
954 | 166 | </table> | 207 | </table> |
955 | 167 | </div> | 208 | </div> |
956 | 168 | 209 | ||
957 | === modified file 'l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako' | |||
958 | --- l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako 2013-01-08 23:01:16 +0000 | |||
959 | +++ l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako 2013-05-09 15:50:30 +0000 | |||
960 | @@ -19,16 +19,15 @@ | |||
961 | 19 | <body> | 19 | <body> |
962 | 20 | <h2>Corrispettivi</h2> | 20 | <h2>Corrispettivi</h2> |
963 | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> |
965 | 22 | <table style="width:100%;" cellspacing="0"> | 22 | <table style="width:100%; font-size: small;" cellspacing="0"> |
966 | 23 | <thead> | 23 | <thead> |
967 | 24 | <tr> | 24 | <tr> |
968 | 25 | <th class="left_without_line">Numero</th> | 25 | <th class="left_without_line">Numero</th> |
969 | 26 | <th class="left_without_line">Data registrazione</th> | 26 | <th class="left_without_line">Data registrazione</th> |
971 | 27 | <th class="left_without_line">Causale</th> | 27 | <th class="left_without_line">Sezionale</th> |
972 | 28 | <th class="right_without_line">Importo totale</th> | 28 | <th class="right_without_line">Importo totale</th> |
973 | 29 | <th class="right_without_line">Imponibile</th> | ||
974 | 30 | <th class="right_without_line">% IVA</th> | ||
975 | 31 | <th class="right_without_line">Imposta</th> | 29 | <th class="right_without_line">Imposta</th> |
976 | 30 | <th class="right_without_line">Importo</th> | ||
977 | 32 | <th></th> | 31 | <th></th> |
978 | 33 | </tr> | 32 | </tr> |
979 | 34 | </thead> | 33 | </thead> |
980 | @@ -59,7 +58,7 @@ | |||
981 | 59 | </td><td class="left_without_line"> | 58 | </td><td class="left_without_line"> |
982 | 60 | %endif | 59 | %endif |
983 | 61 | %if line['index']==0: | 60 | %if line['index']==0: |
985 | 62 | Corrispettivi | 61 | ${object.journal_id.name or ''| entity} |
986 | 63 | %endif | 62 | %endif |
987 | 64 | %if line['index']==0: | 63 | %if line['index']==0: |
988 | 65 | </td><td class="right_with_line"> | 64 | </td><td class="right_with_line"> |
989 | @@ -67,25 +66,19 @@ | |||
990 | 67 | </td><td class="right_without_line"> | 66 | </td><td class="right_without_line"> |
991 | 68 | %endif | 67 | %endif |
992 | 69 | %if line['index']==0: | 68 | %if line['index']==0: |
994 | 70 | ${ formatLang(line['amount_total']) | entity} | 69 | ${ formatLang(object.amount) | entity} |
995 | 71 | %endif | 70 | %endif |
996 | 72 | </td> | 71 | </td> |
997 | 73 | %if line['index']==0: | 72 | %if line['index']==0: |
1013 | 74 | <td class="right_with_line">${ formatLang(line['base']) or ''| entity}</td> | 73 | <td class="right_with_line">${ (line['tax_code_name']) or ''| entity}</td> |
1014 | 75 | %else: | 74 | %else: |
1015 | 76 | <td class="right_without_line">${ formatLang(line['base']) or ''| entity}</td> | 75 | <td class="right_without_line">${ (line['tax_code_name']) or ''| entity}</td> |
1016 | 77 | %endif | 76 | %endif |
1017 | 78 | %if line['index']==0: | 77 | %if line['index']==0: |
1018 | 79 | <td class="right_with_line">${ line['tax_percentage'] or ''| entity}</td> | 78 | <td class="right_with_line">${ formatLang(line['amount'])| entity}</td> |
1019 | 80 | %else: | 79 | %else: |
1020 | 81 | <td class="right_without_line">${ line['tax_percentage'] or ''| entity}</td> | 80 | <td class="right_without_line">${ formatLang(line['amount'])| entity}</td> |
1021 | 82 | %endif | 81 | %endif |
1007 | 83 | %if line['index']==0: | ||
1008 | 84 | <td class="right_with_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
1009 | 85 | %else: | ||
1010 | 86 | <td class="right_without_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
1011 | 87 | %endif | ||
1012 | 88 | <td></td> | ||
1022 | 89 | </tr> | 82 | </tr> |
1023 | 90 | %endfor | 83 | %endfor |
1024 | 91 | %endfor | 84 | %endfor |
1025 | @@ -93,33 +86,87 @@ | |||
1026 | 93 | </table> | 86 | </table> |
1027 | 94 | <div style="page-break-inside: avoid;"> | 87 | <div style="page-break-inside: avoid;"> |
1028 | 95 | <br/> | 88 | <br/> |
1029 | 89 | <% tax_code_list = tax_codes() %> | ||
1030 | 90 | <% tax_code_totals_list = tax_codes_totals() %> | ||
1031 | 96 | <table style="width:100%; " border="1"> | 91 | <table style="width:100%; " border="1"> |
1032 | 97 | <tr style="border-style:ridge;border-width:5px"> | 92 | <tr style="border-style:ridge;border-width:5px"> |
1058 | 98 | <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> | 93 | <td colspan="3" style="padding:10; ">Periodo di stampa dal <strong>${formatLang(start_date(),date=True)| entity}</strong> al <strong>${formatLang(end_date(),date=True)| entity}</strong></td> |
1059 | 99 | </tr> | 94 | </tr> |
1060 | 100 | <tr> | 95 | <tr> |
1061 | 101 | <td rowspan="2" style="vertical-align:text-top;padding:10"> | 96 | <td colspan="2" style="vertical-align:text-top;padding:10"> |
1062 | 102 | <table style="width:100%;"> | 97 | <h3>Dettaglio</h3> |
1063 | 103 | <tr> | 98 | <table style="width:100%;"> |
1064 | 104 | <th style="text-align:left">Descrizione</th> | 99 | <tr> |
1065 | 105 | <th style="text-align:right">Imponibile</th> | 100 | <th style="text-align:left">Descrizione</th> |
1066 | 106 | <th style="text-align:right">Imposta</th> | 101 | <th style="text-align:right">Importo</th> |
1067 | 107 | </tr> | 102 | </tr> |
1068 | 108 | %for tax_code in tax_codes : | 103 | %for tax_code_tuple in tax_code_list : |
1069 | 109 | <tr> | 104 | % if not tax_code_tuple[2]: |
1070 | 110 | <td>${tax_code|entity} | 105 | <tr> |
1071 | 111 | </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity} | 106 | <td>${tax_code_tuple[0]|entity} |
1072 | 112 | </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['amount']) or ''|entity} | 107 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} |
1073 | 113 | </td> | 108 | </td> |
1074 | 114 | </tr> | 109 | </tr> |
1075 | 115 | %endfor | 110 | %endif |
1076 | 116 | </table> | 111 | %endfor |
1077 | 117 | </td><td style="padding:10">Totale operazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_operazioni'])|entity}</strong></p><br/></td> | 112 | </table> |
1078 | 118 | <td style="padding:10">Totale imponibili:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_imponibili'])|entity}</strong></p><br/></td> | 113 | </td> |
1079 | 119 | </tr> | 114 | <td style="vertical-align:text-top;padding:10"> |
1080 | 120 | <tr> | 115 | <h3>Totali</h3> |
1081 | 121 | <td style="padding:10">Totale variazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_variazioni'])|entity}</strong></p><br/></td> | 116 | <table style="width:100%;"> |
1082 | 122 | <td style="padding:10">Totale IVA:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva'])|entity}</strong></p><br/></td> | 117 | <tr> |
1083 | 118 | <th style="text-align:left">Descrizione</th> | ||
1084 | 119 | <th style="text-align:right">Importo</th> | ||
1085 | 120 | </tr> | ||
1086 | 121 | %for tax_code_tuple in tax_code_totals_list : | ||
1087 | 122 | % if not tax_code_tuple[2]: | ||
1088 | 123 | <tr> | ||
1089 | 124 | <td>${tax_code_tuple[0]|entity} | ||
1090 | 125 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1091 | 126 | </td> | ||
1092 | 127 | </tr> | ||
1093 | 128 | %endif | ||
1094 | 129 | %endfor | ||
1095 | 130 | </table> | ||
1096 | 131 | </td> | ||
1097 | 132 | </tr> | ||
1098 | 133 | <tr> | ||
1099 | 134 | <td colspan="2" style="vertical-align:text-top;padding:10"> | ||
1100 | 135 | <h3>Dettaglio imponibili</h3> | ||
1101 | 136 | <table style="width:100%;"> | ||
1102 | 137 | <tr> | ||
1103 | 138 | <th style="text-align:left">Descrizione</th> | ||
1104 | 139 | <th style="text-align:right">Importo</th> | ||
1105 | 140 | </tr> | ||
1106 | 141 | %for tax_code_tuple in tax_code_list : | ||
1107 | 142 | % if tax_code_tuple[2]: | ||
1108 | 143 | <tr> | ||
1109 | 144 | <td>${tax_code_tuple[0]|entity} | ||
1110 | 145 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1111 | 146 | </td> | ||
1112 | 147 | </tr> | ||
1113 | 148 | %endif | ||
1114 | 149 | %endfor | ||
1115 | 150 | </table> | ||
1116 | 151 | </td> | ||
1117 | 152 | <td style="vertical-align:text-top;padding:10"> | ||
1118 | 153 | <h3>Totali imponibili</h3> | ||
1119 | 154 | <table style="width:100%;"> | ||
1120 | 155 | <tr> | ||
1121 | 156 | <th style="text-align:left">Descrizione</th> | ||
1122 | 157 | <th style="text-align:right">Importo</th> | ||
1123 | 158 | </tr> | ||
1124 | 159 | %for tax_code_tuple in tax_code_totals_list : | ||
1125 | 160 | % if tax_code_tuple[2]: | ||
1126 | 161 | <tr> | ||
1127 | 162 | <td>${tax_code_tuple[0]|entity} | ||
1128 | 163 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1129 | 164 | </td> | ||
1130 | 165 | </tr> | ||
1131 | 166 | %endif | ||
1132 | 167 | %endfor | ||
1133 | 168 | </table> | ||
1134 | 169 | </td> | ||
1135 | 123 | </tr> | 170 | </tr> |
1136 | 124 | </table> | 171 | </table> |
1137 | 125 | </div> | 172 | </div> |
1138 | 126 | 173 | ||
1139 | === modified file 'l10n_it_vat_registries/templates/registro_iva_vendite.mako' | |||
1140 | --- l10n_it_vat_registries/templates/registro_iva_vendite.mako 2013-01-08 23:01:16 +0000 | |||
1141 | +++ l10n_it_vat_registries/templates/registro_iva_vendite.mako 2013-05-09 15:50:30 +0000 | |||
1142 | @@ -19,7 +19,7 @@ | |||
1143 | 19 | <body> | 19 | <body> |
1144 | 20 | <h2>Fatture Emesse</h2> | 20 | <h2>Fatture Emesse</h2> |
1145 | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> |
1147 | 22 | <table style="width:100%;" cellspacing="0"> | 22 | <table style="width:100%; font-size: small;" cellspacing="0"> |
1148 | 23 | <thead> | 23 | <thead> |
1149 | 24 | <tr> | 24 | <tr> |
1150 | 25 | <th class="left_without_line">Data registrazione</th> | 25 | <th class="left_without_line">Data registrazione</th> |
1151 | @@ -27,11 +27,10 @@ | |||
1152 | 27 | <th class="left_without_line">Ragione sociale</th> | 27 | <th class="left_without_line">Ragione sociale</th> |
1153 | 28 | <th class="left_without_line">Numero fattura</th> | 28 | <th class="left_without_line">Numero fattura</th> |
1154 | 29 | <th class="left_without_line">Data fattura</th> | 29 | <th class="left_without_line">Data fattura</th> |
1156 | 30 | <th class="left_without_line">Causale</th> | 30 | <th class="left_without_line">Sezionale</th> |
1157 | 31 | <th class="right_without_line">Totale fattura</th> | 31 | <th class="right_without_line">Totale fattura</th> |
1158 | 32 | <th class="right_without_line">Imponibile</th> | ||
1159 | 33 | <th class="right_without_line">% IVA</th> | ||
1160 | 34 | <th class="right_without_line">Imposta</th> | 32 | <th class="right_without_line">Imposta</th> |
1161 | 33 | <th class="right_without_line">Importo</th> | ||
1162 | 35 | <th></th> | 34 | <th></th> |
1163 | 36 | </tr> | 35 | </tr> |
1164 | 37 | </thead> | 36 | </thead> |
1165 | @@ -78,7 +77,7 @@ | |||
1166 | 78 | </td><td class="left_without_line"> | 77 | </td><td class="left_without_line"> |
1167 | 79 | %endif | 78 | %endif |
1168 | 80 | %if line['index']==0: | 79 | %if line['index']==0: |
1170 | 81 | ${ formatLang(object.date,date=True) or '' | entity} | 80 | ${ formatLang(line['invoice_date'],date=True) or '' | entity} |
1171 | 82 | %endif | 81 | %endif |
1172 | 83 | %if line['index']==0: | 82 | %if line['index']==0: |
1173 | 84 | </td><td class="left_with_line"> | 83 | </td><td class="left_with_line"> |
1174 | @@ -86,11 +85,7 @@ | |||
1175 | 86 | </td><td class="left_without_line"> | 85 | </td><td class="left_without_line"> |
1176 | 87 | %endif | 86 | %endif |
1177 | 88 | %if line['index']==0: | 87 | %if line['index']==0: |
1183 | 89 | %if line['amount_total'] >= 0: | 88 | ${object.journal_id.name or ''| entity} |
1179 | 90 | Fattura | ||
1180 | 91 | %else: | ||
1181 | 92 | Nota di credito | ||
1182 | 93 | %endif | ||
1184 | 94 | %endif | 89 | %endif |
1185 | 95 | %if line['index']==0: | 90 | %if line['index']==0: |
1186 | 96 | </td><td class="right_with_line"> | 91 | </td><td class="right_with_line"> |
1187 | @@ -98,25 +93,19 @@ | |||
1188 | 98 | </td><td class="right_without_line"> | 93 | </td><td class="right_without_line"> |
1189 | 99 | %endif | 94 | %endif |
1190 | 100 | %if line['index']==0: | 95 | %if line['index']==0: |
1192 | 101 | ${ formatLang(line['amount_total']) | entity} | 96 | ${ formatLang(object.amount) | entity} |
1193 | 102 | %endif | 97 | %endif |
1194 | 103 | </td> | 98 | </td> |
1195 | 104 | %if line['index']==0: | 99 | %if line['index']==0: |
1211 | 105 | <td class="right_with_line">${ formatLang(line['base']) or ''| entity}</td> | 100 | <td class="right_with_line">${ (line['tax_code_name']) or ''| entity}</td> |
1212 | 106 | %else: | 101 | %else: |
1213 | 107 | <td class="right_without_line">${ formatLang(line['base']) or ''| entity}</td> | 102 | <td class="right_without_line">${ (line['tax_code_name']) or ''| entity}</td> |
1214 | 108 | %endif | 103 | %endif |
1215 | 109 | %if line['index']==0: | 104 | %if line['index']==0: |
1216 | 110 | <td class="right_with_line">${ line['tax_percentage'] or ''| entity}</td> | 105 | <td class="right_with_line">${ formatLang(line['amount'])| entity}</td> |
1217 | 111 | %else: | 106 | %else: |
1218 | 112 | <td class="right_without_line">${ line['tax_percentage'] or ''| entity}</td> | 107 | <td class="right_without_line">${ formatLang(line['amount'])| entity}</td> |
1219 | 113 | %endif | 108 | %endif |
1205 | 114 | %if line['index']==0: | ||
1206 | 115 | <td class="right_with_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
1207 | 116 | %else: | ||
1208 | 117 | <td class="right_without_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
1209 | 118 | %endif | ||
1210 | 119 | <td></td> | ||
1220 | 120 | </tr> | 109 | </tr> |
1221 | 121 | %endfor | 110 | %endfor |
1222 | 122 | %endfor | 111 | %endfor |
1223 | @@ -124,33 +113,87 @@ | |||
1224 | 124 | </table> | 113 | </table> |
1225 | 125 | <div style="page-break-inside: avoid;"> | 114 | <div style="page-break-inside: avoid;"> |
1226 | 126 | <br/> | 115 | <br/> |
1227 | 116 | <% tax_code_list = tax_codes() %> | ||
1228 | 117 | <% tax_code_totals_list = tax_codes_totals() %> | ||
1229 | 127 | <table style="width:100%; " border="1"> | 118 | <table style="width:100%; " border="1"> |
1230 | 128 | <tr style="border-style:ridge;border-width:5px"> | 119 | <tr style="border-style:ridge;border-width:5px"> |
1256 | 129 | <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> | 120 | <td colspan="3" style="padding:10; ">Periodo di stampa dal <strong>${formatLang(start_date(),date=True)| entity}</strong> al <strong>${formatLang(end_date(),date=True)| entity}</strong></td> |
1257 | 130 | </tr> | 121 | </tr> |
1258 | 131 | <tr> | 122 | <tr> |
1259 | 132 | <td rowspan="2" style="vertical-align:text-top;padding:10"> | 123 | <td colspan="2" style="vertical-align:text-top;padding:10"> |
1260 | 133 | <table style="width:100%;"> | 124 | <h3>Dettaglio</h3> |
1261 | 134 | <tr> | 125 | <table style="width:100%;"> |
1262 | 135 | <th style="text-align:left">Descrizione</th> | 126 | <tr> |
1263 | 136 | <th style="text-align:right">Imponibile</th> | 127 | <th style="text-align:left">Descrizione</th> |
1264 | 137 | <th style="text-align:right">Imposta</th> | 128 | <th style="text-align:right">Importo</th> |
1265 | 138 | </tr> | 129 | </tr> |
1266 | 139 | %for tax_code in tax_codes : | 130 | %for tax_code_tuple in tax_code_list : |
1267 | 140 | <tr> | 131 | % if not tax_code_tuple[2]: |
1268 | 141 | <td>${tax_code|entity} | 132 | <tr> |
1269 | 142 | </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity} | 133 | <td>${tax_code_tuple[0]|entity} |
1270 | 143 | </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['amount']) or ''|entity} | 134 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} |
1271 | 144 | </td> | 135 | </td> |
1272 | 145 | </tr> | 136 | </tr> |
1273 | 146 | %endfor | 137 | %endif |
1274 | 147 | </table> | 138 | %endfor |
1275 | 148 | </td><td style="padding:10">Totale operazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_operazioni'])|entity}</strong></p><br/></td> | 139 | </table> |
1276 | 149 | <td style="padding:10">Totale imponibili:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_imponibili'])|entity}</strong></p><br/></td> | 140 | </td> |
1277 | 150 | </tr> | 141 | <td style="vertical-align:text-top;padding:10"> |
1278 | 151 | <tr> | 142 | <h3>Totali</h3> |
1279 | 152 | <td style="padding:10">Totale variazioni:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_variazioni'])|entity}</strong></p><br/></td> | 143 | <table style="width:100%;"> |
1280 | 153 | <td style="padding:10">Totale IVA:<br/><p style="text-align:center"><strong>${formatLang(totali['totale_iva'])|entity}</strong></p><br/></td> | 144 | <tr> |
1281 | 145 | <th style="text-align:left">Descrizione</th> | ||
1282 | 146 | <th style="text-align:right">Importo</th> | ||
1283 | 147 | </tr> | ||
1284 | 148 | %for tax_code_tuple in tax_code_totals_list : | ||
1285 | 149 | % if not tax_code_tuple[2]: | ||
1286 | 150 | <tr> | ||
1287 | 151 | <td>${tax_code_tuple[0]|entity} | ||
1288 | 152 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1289 | 153 | </td> | ||
1290 | 154 | </tr> | ||
1291 | 155 | %endif | ||
1292 | 156 | %endfor | ||
1293 | 157 | </table> | ||
1294 | 158 | </td> | ||
1295 | 159 | </tr> | ||
1296 | 160 | <tr> | ||
1297 | 161 | <td colspan="2" style="vertical-align:text-top;padding:10"> | ||
1298 | 162 | <h3>Dettaglio imponibili</h3> | ||
1299 | 163 | <table style="width:100%;"> | ||
1300 | 164 | <tr> | ||
1301 | 165 | <th style="text-align:left">Descrizione</th> | ||
1302 | 166 | <th style="text-align:right">Importo</th> | ||
1303 | 167 | </tr> | ||
1304 | 168 | %for tax_code_tuple in tax_code_list : | ||
1305 | 169 | % if tax_code_tuple[2]: | ||
1306 | 170 | <tr> | ||
1307 | 171 | <td>${tax_code_tuple[0]|entity} | ||
1308 | 172 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1309 | 173 | </td> | ||
1310 | 174 | </tr> | ||
1311 | 175 | %endif | ||
1312 | 176 | %endfor | ||
1313 | 177 | </table> | ||
1314 | 178 | </td> | ||
1315 | 179 | <td style="vertical-align:text-top;padding:10"> | ||
1316 | 180 | <h3>Totali imponibili</h3> | ||
1317 | 181 | <table style="width:100%;"> | ||
1318 | 182 | <tr> | ||
1319 | 183 | <th style="text-align:left">Descrizione</th> | ||
1320 | 184 | <th style="text-align:right">Importo</th> | ||
1321 | 185 | </tr> | ||
1322 | 186 | %for tax_code_tuple in tax_code_totals_list : | ||
1323 | 187 | % if tax_code_tuple[2]: | ||
1324 | 188 | <tr> | ||
1325 | 189 | <td>${tax_code_tuple[0]|entity} | ||
1326 | 190 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1327 | 191 | </td> | ||
1328 | 192 | </tr> | ||
1329 | 193 | %endif | ||
1330 | 194 | %endfor | ||
1331 | 195 | </table> | ||
1332 | 196 | </td> | ||
1333 | 154 | </tr> | 197 | </tr> |
1334 | 155 | </table> | 198 | </table> |
1335 | 156 | </div> | 199 | </div> |
1336 | 157 | 200 | ||
1337 | === modified file 'l10n_it_vat_registries/wizard/__init__.py' | |||
1338 | --- l10n_it_vat_registries/wizard/__init__.py 2013-01-29 22:08:50 +0000 | |||
1339 | +++ l10n_it_vat_registries/wizard/__init__.py 2013-05-09 15:50:30 +0000 | |||
1340 | @@ -1,7 +1,7 @@ | |||
1341 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
1342 | 2 | ############################################################################## | 2 | ############################################################################## |
1343 | 3 | # | 3 | # |
1345 | 4 | # Copyright (C) 2011 Associazione OpenERP Italia | 4 | # Copyright (C) 2011-2013 Associazione OpenERP Italia |
1346 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
1347 | 6 | # | 6 | # |
1348 | 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
1349 | @@ -12,7 +12,7 @@ | |||
1350 | 12 | # This program is distributed in the hope that it will be useful, | 12 | # This program is distributed in the hope that it will be useful, |
1351 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
1352 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1354 | 15 | # GNU General Public License for more details. | 15 | # GNU Affero General Public License for more details. |
1355 | 16 | # | 16 | # |
1356 | 17 | # You should have received a copy of the GNU Affero General Public License | 17 | # You should have received a copy of the GNU Affero General Public License |
1357 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1358 | 19 | 19 | ||
1359 | === modified file 'l10n_it_vat_registries/wizard/print_registro_iva.py' | |||
1360 | --- l10n_it_vat_registries/wizard/print_registro_iva.py 2013-01-29 22:08:50 +0000 | |||
1361 | +++ l10n_it_vat_registries/wizard/print_registro_iva.py 2013-05-09 15:50:30 +0000 | |||
1362 | @@ -25,79 +25,64 @@ | |||
1363 | 25 | 25 | ||
1364 | 26 | class wizard_registro_iva(osv.osv_memory): | 26 | class wizard_registro_iva(osv.osv_memory): |
1365 | 27 | 27 | ||
1366 | 28 | def _get_period(self, cr, uid, context=None): | ||
1367 | 29 | ctx = dict(context or {}, account_period_prefer_normal=True) | ||
1368 | 30 | period_ids = self.pool.get('account.period').find(cr, uid, context=ctx) | ||
1369 | 31 | return period_ids | ||
1370 | 32 | |||
1371 | 28 | _name = "wizard.registro.iva" | 33 | _name = "wizard.registro.iva" |
1372 | 29 | _columns = { | 34 | _columns = { |
1375 | 30 | 'date_from': fields.date('From date', required=True), | 35 | 'period_ids': fields.many2many('account.period', 'registro_iva_periods_rel', 'period_id', 'registro_id', 'Periods', help='Select periods you want retrieve documents from', required=True), |
1374 | 31 | 'date_to': fields.date('To date', required=True), | ||
1376 | 32 | 'type': fields.selection([ | 36 | 'type': fields.selection([ |
1377 | 33 | ('customer', 'Customer Invoices'), | 37 | ('customer', 'Customer Invoices'), |
1378 | 34 | ('supplier', 'Supplier Invoices'), | 38 | ('supplier', 'Supplier Invoices'), |
1379 | 35 | ('corrispettivi', 'Corrispettivi'), | 39 | ('corrispettivi', 'Corrispettivi'), |
1380 | 36 | ], 'Layout', required=True), | 40 | ], 'Layout', required=True), |
1381 | 37 | '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), | 41 | '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), |
1382 | 42 | 'tax_sign': fields.float('Tax amount sign', | ||
1383 | 43 | help="Use -1 you have negative tax amounts and you want to print them prositive"), | ||
1384 | 38 | 'message': fields.char('Message', size=64, readonly=True), | 44 | 'message': fields.char('Message', size=64, readonly=True), |
1385 | 45 | 'fiscal_page_base': fields.integer('Last printed page', required=True), | ||
1386 | 39 | } | 46 | } |
1387 | 40 | _defaults = { | 47 | _defaults = { |
1388 | 41 | 'type': 'customer', | 48 | 'type': 'customer', |
1392 | 42 | 'date_from': lambda * a: time.strftime('%Y-%m-%d'), | 49 | 'period_ids': _get_period, |
1393 | 43 | 'date_to': lambda * a: time.strftime('%Y-%m-%d'), | 50 | 'tax_sign': 1.0, |
1394 | 44 | #'journal_ids': lambda s, cr, uid, c: s.pool.get('account.journal').search(cr, uid, []), | 51 | 'fiscal_page_base': 0, |
1395 | 45 | } | 52 | } |
1396 | 46 | |||
1397 | 47 | def counterparts_number(self, move_line): | ||
1398 | 48 | counter = 0 | ||
1399 | 49 | if not move_line.credit: | ||
1400 | 50 | for line in move_line.move_id.line_id: | ||
1401 | 51 | if line.credit: | ||
1402 | 52 | counter += 1 | ||
1403 | 53 | elif not move_line.debit: | ||
1404 | 54 | for line in move_line.move_id.line_id: | ||
1405 | 55 | if line.debit: | ||
1406 | 56 | counter += 1 | ||
1407 | 57 | return counter | ||
1408 | 58 | 53 | ||
1409 | 59 | def print_registro(self, cr, uid, ids, context=None): | 54 | def print_registro(self, cr, uid, ids, context=None): |
1410 | 60 | move_ids = [] | ||
1411 | 61 | wizard = self.read(cr, uid, ids)[0] | ||
1412 | 62 | move_line_obj = self.pool.get('account.move.line') | ||
1413 | 63 | tax_pool = self.pool.get('account.tax') | ||
1414 | 64 | search_list = [] | ||
1415 | 65 | search_list = [ | ||
1416 | 66 | ('journal_id', 'in', wizard['journal_ids']), | ||
1417 | 67 | ('move_id.date', '<=', wizard['date_to']), | ||
1418 | 68 | ('move_id.date', '>=', wizard['date_from']), | ||
1419 | 69 | ('move_id.state', '=', 'posted'), | ||
1420 | 70 | ('tax_code_id', '!=', False), | ||
1421 | 71 | ] | ||
1422 | 72 | move_line_ids = move_line_obj.search(cr, uid, search_list, order='date') | ||
1423 | 73 | if context is None: | 55 | if context is None: |
1424 | 74 | context = {} | 56 | context = {} |
1444 | 75 | for move_line in move_line_obj.browse(cr, uid, move_line_ids): | 57 | wizard = self.browse(cr, uid, ids)[0] |
1445 | 76 | # verifico che sia coinvolto un conto imposta legato ad un'imposta tramite conto standard o conto refund | 58 | move_obj = self.pool.get('account.move') |
1446 | 77 | if move_line.tax_code_id.tax_ids or move_line.tax_code_id.ref_tax_ids: | 59 | obj_model_data = self.pool.get('ir.model.data') |
1447 | 78 | if move_line.tax_code_id.tax_ids: | 60 | move_ids = move_obj.search(cr, uid, [ |
1448 | 79 | if not tax_pool._have_same_rate(move_line.tax_code_id.tax_ids): | 61 | ('journal_id', 'in', [j.id for j in wizard.journal_ids]), |
1449 | 80 | raise osv.except_osv(_('Error'), _('Taxes %s have different rates') | 62 | ('period_id', 'in', [p.id for p in wizard.period_ids]), |
1450 | 81 | % str(move_line.tax_code_id.tax_ids)) | 63 | ('state', '=', 'posted'), |
1451 | 82 | if move_line.tax_code_id.ref_tax_ids: | 64 | ], order='date') |
1433 | 83 | if not tax_pool._have_same_rate(move_line.tax_code_id.ref_tax_ids): | ||
1434 | 84 | raise osv.except_osv(_('Error'), _('Taxes %s have different rates') | ||
1435 | 85 | % str(move_line.tax_code_id.ref_tax_ids)) | ||
1436 | 86 | # controllo che ogni tax code abbia una e una sola imposta | ||
1437 | 87 | ''' non posso farlo per via dell IVA inclusa nel prezzo | ||
1438 | 88 | if len(move_line.tax_code_id.tax_ids) != 1: | ||
1439 | 89 | raise osv.except_osv(_('Error'), _('Wrong tax configuration for tax code %s') | ||
1440 | 90 | % move_line.tax_code_id.name) | ||
1441 | 91 | ''' | ||
1442 | 92 | if move_line.move_id.id not in move_ids: | ||
1443 | 93 | move_ids.append(move_line.move_id.id) | ||
1452 | 94 | if not move_ids: | 65 | if not move_ids: |
1453 | 95 | self.write(cr, uid, ids, {'message': _('No documents found in the current selection')}) | 66 | self.write(cr, uid, ids, {'message': _('No documents found in the current selection')}) |
1455 | 96 | return True | 67 | model_data_ids = obj_model_data.search(cr, uid, [('model','=','ir.ui.view'), ('name','=','wizard_registro_iva')]) |
1456 | 68 | resource_id = obj_model_data.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id'] | ||
1457 | 69 | return { | ||
1458 | 70 | 'name': _('No documents'), | ||
1459 | 71 | 'res_id': ids[0], | ||
1460 | 72 | 'view_type': 'form', | ||
1461 | 73 | 'view_mode': 'form', | ||
1462 | 74 | 'res_model': 'wizard.registro.iva', | ||
1463 | 75 | 'views': [(resource_id,'form')], | ||
1464 | 76 | 'context': context, | ||
1465 | 77 | 'type': 'ir.actions.act_window', | ||
1466 | 78 | 'target': 'new', | ||
1467 | 79 | } | ||
1468 | 97 | datas = {'ids': move_ids} | 80 | datas = {'ids': move_ids} |
1469 | 98 | datas['model'] = 'account.move' | 81 | datas['model'] = 'account.move' |
1472 | 99 | datas['form'] = wizard | 82 | datas['fiscal_page_base'] = wizard.fiscal_page_base |
1473 | 100 | datas['move_ids'] = move_ids | 83 | datas['period_ids'] = [p.id for p in wizard.period_ids] |
1474 | 84 | datas['layout'] = wizard['type'] | ||
1475 | 85 | datas['tax_sign'] = wizard['tax_sign'] | ||
1476 | 101 | res= { | 86 | res= { |
1477 | 102 | 'type': 'ir.actions.report.xml', | 87 | 'type': 'ir.actions.report.xml', |
1478 | 103 | 'datas': datas, | 88 | 'datas': datas, |
1479 | @@ -110,4 +95,11 @@ | |||
1480 | 110 | res['report_name'] = 'registro_iva_corrispettivi' | 95 | res['report_name'] = 'registro_iva_corrispettivi' |
1481 | 111 | return res | 96 | return res |
1482 | 112 | 97 | ||
1484 | 113 | wizard_registro_iva() | 98 | def on_type_changed(self, cr, uid, ids, j_type, context=None): |
1485 | 99 | res={} | ||
1486 | 100 | if j_type: | ||
1487 | 101 | if j_type == 'supplier': | ||
1488 | 102 | res['value'] = {'tax_sign': -1} | ||
1489 | 103 | else: | ||
1490 | 104 | res['value'] = {'tax_sign': 1} | ||
1491 | 105 | return res | ||
1492 | 114 | 106 | ||
1493 | === modified file 'l10n_it_vat_registries/wizard/print_registro_iva.xml' | |||
1494 | --- l10n_it_vat_registries/wizard/print_registro_iva.xml 2013-01-08 23:01:16 +0000 | |||
1495 | +++ l10n_it_vat_registries/wizard/print_registro_iva.xml 2013-05-09 15:50:30 +0000 | |||
1496 | @@ -7,16 +7,23 @@ | |||
1497 | 7 | <field name="model">wizard.registro.iva</field> | 7 | <field name="model">wizard.registro.iva</field> |
1498 | 8 | <field name="type">form</field> | 8 | <field name="type">form</field> |
1499 | 9 | <field name="arch" type="xml"> | 9 | <field name="arch" type="xml"> |
1510 | 10 | <form string="Tax Journal"> | 10 | <form string="Tax Journal" version="7.0"> |
1511 | 11 | <field name="date_from"/> | 11 | <group> |
1512 | 12 | <field name="date_to"/> | 12 | <field name="type" on_change="on_type_changed(type)"/> |
1513 | 13 | <field name="type" colspan="4"/> | 13 | <field name="tax_sign"/> |
1514 | 14 | <separator string="Journals" colspan="4"/> | 14 | <field name="fiscal_page_base"/> |
1515 | 15 | <field name="journal_ids" colspan="4" nolabel="1" height="250"/> | 15 | <separator string="Periods" colspan="4"/> |
1516 | 16 | <button icon="gtk-cancel" special="cancel" string="Cancel"/> | 16 | <field name="period_ids" colspan="4" nolabel="1" height="250"/> |
1517 | 17 | <button icon="gtk-ok" name="print_registro" string="Print" type="object"/> | 17 | <separator string="Journals" colspan="4"/> |
1518 | 18 | <newline/> | 18 | <field name="journal_ids" colspan="4" nolabel="1" height="250" domain="[('type', 'in', ('sale','purchase','sale_refund','purchase_refund'))]"/> |
1519 | 19 | <field name="message" nolabel="1" colspan="4"/> | 19 | <newline/> |
1520 | 20 | <field name="message" nolabel="1" colspan="4"/> | ||
1521 | 21 | </group> | ||
1522 | 22 | <footer> | ||
1523 | 23 | <button string="Print" name="print_registro" type="object" class="oe_highlight"/> | ||
1524 | 24 | or | ||
1525 | 25 | <button string="Cancel" class="oe_link" special="cancel"/> | ||
1526 | 26 | </footer> | ||
1527 | 20 | </form> | 27 | </form> |
1528 | 21 | </field> | 28 | </field> |
1529 | 22 | </record> | 29 | </record> |
Ottimo lavoro!
Puoi mettere anche l'opzione di impostare manualmente il numero di pagina di partenza? Serve in quanto la numerazione dev'essere progressiva e unica per tutto l'anno.