Merge lp:~elbati/openobject-italia/7-l10n_it_vat_registries_simplified into lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0

Proposed by Lorenzo Battistini
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
Reviewer Review Type Date Requested Status
OpenERP Italia core devs Pending
Review via email: mp+162188@code.launchpad.net
To post a comment you must log in.
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

Revision history for this message
Sergio Corato (icsergio) wrote :

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.

Revision history for this message
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','purchase','sale_refund','purchase_refund'))]
- 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

Revision history for this message
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"

Revision history for this message
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

Revision history for this message
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','purchase','sale_refund','purchase_refund'))]

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" ?

Revision history for this message
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

Revision history for this message
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://code.launchpad.net/~elbati/openobject-italia/7-l10n_it_vat_registries_simplified/+merge/162188
> 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://launchpad.net/~openobject-italia-core-devs
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~openobject-italia-core-devs
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
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','purchase','sale_refund','purchase_refund'))]
>
> 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://code.launchpad.net/~elbati/openobject-italia/7-l10n_it_vat_registries_simplified/+merge/162188
> 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://launchpad.net/~openobject-italia-core-devs
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~openobject-italia-core-devs
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
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_invoice_entry_date come proposta (in verifica) su https://code.launchpad.net/~a-camilli/openobject-italia/6.1-fix-controllo-data-registrazione-consecutiva

Manca infine il numero fattura dato dal fornitore

Revision history for this message
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.

Revision history for this message
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

Revision history for this message
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.

Revision history for this message
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

Revision history for this message
Lorenzo Battistini (elbati) wrote :

On 05/07/2013 01:04 AM, Sergio Corato wrote:
> Manca infine il numero fattura dato dal fornitore

Aggiunto.

Revision history for this message
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

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

Questo MP è da considerare obsoleto?

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Lo stato è 'merged' quindi le modifiche sono già finite nel target branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'l10n_it_vat_registries/AUTHORS.txt'
--- l10n_it_vat_registries/AUTHORS.txt 2013-01-08 23:01:16 +0000
+++ l10n_it_vat_registries/AUTHORS.txt 2013-05-09 15:50:30 +0000
@@ -1,2 +1,2 @@
1Lorenzo Battistini <lorenzo.battistini@domsense.com>1Lorenzo Battistini <lorenzo.battistini@agilebg.com>
2Ingrid Barcaro2Ingrid Barcaro
33
=== modified file 'l10n_it_vat_registries/__init__.py'
--- l10n_it_vat_registries/__init__.py 2013-01-29 22:08:50 +0000
+++ l10n_it_vat_registries/__init__.py 2013-05-09 15:50:30 +0000
@@ -1,7 +1,7 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2##############################################################################2##############################################################################
3# 3#
4# Copyright (C) 2011 Associazione OpenERP Italia4# Copyright (C) 2011-2013 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>). 5# (<http://www.openerp-italia.org>).
6#6#
7# This program is free software: you can redistribute it and/or modify7# This program is free software: you can redistribute it and/or modify
@@ -12,7 +12,7 @@
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,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.15# GNU Affero General Public License for more details.
16#16#
17# You should have received a copy of the GNU Affero General Public License17# You should have received a copy of the GNU Affero General Public License
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/>.
@@ -20,5 +20,5 @@
20##############################################################################20##############################################################################
2121
22import wizard22import wizard
23import invoice
23import account24import account
24import invoice
2525
=== modified file 'l10n_it_vat_registries/__openerp__.py'
--- l10n_it_vat_registries/__openerp__.py 2013-02-18 19:37:15 +0000
+++ l10n_it_vat_registries/__openerp__.py 2013-05-09 15:50:30 +0000
@@ -1,7 +1,7 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2##############################################################################2##############################################################################
3# 3#
4# Copyright (C) 2011-2012 Associazione OpenERP Italia4# Copyright (C) 2011-2013 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>). 5# (<http://www.openerp-italia.org>).
6# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)6# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
7# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)7# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
@@ -14,7 +14,7 @@
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,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.17# GNU Affero General Public License for more details.
18#18#
19# You should have received a copy of the GNU Affero General Public License19# You should have received a copy of the GNU Affero General Public License
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/>.
@@ -33,8 +33,8 @@
33 ],33 ],
34 "update_xml" : [34 "update_xml" : [
35 'reports.xml',35 'reports.xml',
36 'wizard/print_registro_iva.xml',
36 'account_view.xml',37 'account_view.xml',
37 'wizard/print_registro_iva.xml',
38 ],38 ],
39 "demo_xml" : [],39 "demo_xml" : [],
40 "active": False,40 "active": False,
4141
=== 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 2013-05-09 15:50:30 +0000
@@ -0,0 +1,30 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published
9# by the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import fields, osv
23from openerp.tools.translate import _
24
25class account_tax_code(osv.osv):
26 _inherit = "account.tax.code"
27
28 _columns = {
29 'is_base': fields.boolean('Is base', help="This tax code is used for base amounts (field used by VAT registries)"),
30 }
031
=== removed file 'l10n_it_vat_registries/account.py'
--- l10n_it_vat_registries/account.py 2013-01-29 22:08:50 +0000
+++ l10n_it_vat_registries/account.py 1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2011-2012 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>).
6# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
7# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as published
11# by the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23
24from osv import fields, osv
25from tools.translate import _
26
27
28class account_tax(osv.osv):
29
30 _inherit = 'account.tax'
31 _columns = {
32 'exclude_from_registries': fields.boolean(
33 'Exclude from VAT registries'),
34 'base_tax_ids': fields.one2many(
35 'account.tax', 'base_code_id', 'Base Taxes'), # serve ancora?
36 }
37 _sql_constraints = [
38 ('name_uniq', 'UNIQUE(name)', 'The tax name must be unique!'),
39 ]
40
41 def get_account_tax(self, inv_tax):
42 if inv_tax.tax_code_id:
43 return self.get_account_tax_by_tax_code(inv_tax.tax_code_id)
44 if inv_tax.base_code_id:
45 return self.get_account_tax_by_base_code(inv_tax.base_code_id)
46 raise osv.except_osv(_('Error'),
47 _('No tax codes for invoice tax %s') % str(inv_tax.name))
48
490
=== 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 2013-05-09 15:50:30 +0000
@@ -0,0 +1,16 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record id="view_tax_code_form" model="ir.ui.view">
5 <field name="name">account.tax.code.form</field>
6 <field name="model">account.tax.code</field>
7 <field name="inherit_id" ref="account.view_tax_code_form"></field>
8 <field name="arch" type="xml">
9 <field name="sign" position="after">
10 <field name="is_base"/>
11 </field>
12 </field>
13 </record>
14 </data>
15</openerp>
16
017
=== removed file 'l10n_it_vat_registries/account_view.xml'
--- l10n_it_vat_registries/account_view.xml 2013-01-08 23:01:16 +0000
+++ l10n_it_vat_registries/account_view.xml 1970-01-01 00:00:00 +0000
@@ -1,17 +0,0 @@
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>
180
=== modified file 'l10n_it_vat_registries/invoice.py'
--- l10n_it_vat_registries/invoice.py 2013-04-24 10:14:49 +0000
+++ l10n_it_vat_registries/invoice.py 2013-05-09 15:50:30 +0000
@@ -1,8 +1,8 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# Copyright (C) 2011 Associazione OpenERP Italia4# Copyright (C) 2011-2013 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>).5# (<http://www.openerp-italia.org>).
6#6#
7# This program is free software: you can redistribute it and/or modify7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as published8# it under the terms of the GNU Affero General Public License as published
@@ -22,328 +22,123 @@
22import time22import time
23from report import report_sxw23from report import report_sxw
24from tools.translate import _24from tools.translate import _
25from decimal import *25import logging
26import netsvc26from datetime import datetime
27
28_logger = logging.getLogger(__name__)
2729
28class Parser(report_sxw.rml_parse):30class Parser(report_sxw.rml_parse):
2931
30 logger = netsvc.Logger()32 def _tax_amounts_by_code(self, move):
3133 res={}
32 def _get_partner_type(self, move_line):34 for move_line in move.line_id:
33 partner_type = ''35 if move_line.tax_code_id and move_line.tax_amount:
34 for line in move_line.move_id.line_id:36 if not res.get(move_line.tax_code_id.id):
35 if line.account_id.type == 'payable' or line.account_id.type == 'receivable':37 res[move_line.tax_code_id.id] = 0.0
36 if not partner_type:38 self.localcontext['used_tax_codes'][move_line.tax_code_id.id] = True
37 partner_type = line.account_id.type39 res[move_line.tax_code_id.id] += (move_line.tax_amount
38 elif partner_type != line.account_id.type:40 * self.localcontext['data']['tax_sign'])
39 raise Exception(41 return res
40 _('The move %s has different partner account type') % move_line.move_id.name)
41 return partner_type
42
43 def _move_total(self, move_line):
44 partner_type = self._get_partner_type(move_line)
45 total = 0.0
46 for line in move_line.move_id.line_id:
47 if line.account_id.type == partner_type:
48 total += (line.debit or line.credit)
49 return total
50
51 # Metto al tax code il segno dell'importo dell'imposta.
52 # Il tax code ha l'importo in valuta base, ma ha segno negativo per l'IVA a credito (da stampare positiva)
53 # e per le note di credito (da stampare negative)
54 def _get_amount_with_sign(self, tax_code_amount, amount):
55 return abs(tax_code_amount) * cmp(amount, 0)
56
57 def _is_refund(self, move_line):
58 if self._get_partner_type(move_line) == 'receivable' and move_line.debit > move_line.credit:
59 return True
60 if self._get_partner_type(move_line) == 'payable' and move_line.debit < move_line.credit:
61 return True
62
63 def _get_line_amount_with_sign(self, move_line):
64 if self._get_partner_type(move_line) == 'receivable':
65 return self._get_amount_with_sign(move_line.tax_amount, move_line.credit - move_line.debit)
66 if self._get_partner_type(move_line) == 'payable':
67 return self._get_amount_with_sign(move_line.tax_amount, move_line.debit - move_line.credit)
68
69 # in valuta base
70 def _get_invoice_amount_total(self, invoice):
71 total = 0.0
72 for inv_tax in invoice.tax_line:
73 total += self._get_amount_with_sign(inv_tax.base_amount, inv_tax.base) \
74 + self._get_amount_with_sign(inv_tax.tax_amount, inv_tax.amount)
75 return total
76
77 # in valuta base
78 def _get_invoice_amount_untaxed(self, invoice):
79 total = 0.0
80 for inv_tax in invoice.tax_line:
81 total += self._get_amount_with_sign(inv_tax.base_amount, inv_tax.base)
82 return total
8342
84 def _get_tax_lines(self, move):43 def _get_tax_lines(self, move):
85 res=[]44 res=[]
86 tax_obj = self.pool.get('account.tax')45 tax_code_obj=self.pool.get('account.tax.code')
87 cur_pool = self.pool.get('res.currency')
88 inv_pool = self.pool.get('account.invoice')
89 # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA46 # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA
90 index=047 index=0
91 totale_iva = 0.048 invoice = False
92 totale_iva_inded = 0.049 for move_line in move.line_id:
93 invoice_amount_total = 0.050 if move_line.invoice:
94 invoice_amount_untaxed = 0.051 if invoice and invoice.id != move_line.invoice.id:
95 related_invoices = []52 raise Exception(_("Move %s contains different invoices") % move.name)
9653 invoice = move_line.invoice
97 ''' riusciamo a essere sempre indipendenti dalle fatture?54 amounts_by_code = self._tax_amounts_by_code(move)
98 # se c'è l'oggetto fattura, utilizzo il calcolo su fattura55 for tax_code_id in amounts_by_code:
99 for move_line in move.line_id:56 tax_code = tax_code_obj.browse(self.cr, self.uid, tax_code_id)
100 if move_line.invoice and move_line.invoice.id not in related_invoices:57 tax_item = {
101 related_invoices.append(move_line.invoice.id)58 'tax_code_name': tax_code.name,
102 '''59 'amount': amounts_by_code[tax_code_id],
10360 'index': index,
104 if related_invoices:61 'invoice_date': (invoice and invoice.date_invoice
105 for invoice_id in related_invoices:62 or move.date or ''),
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 '')
10764 }
108 for move_line in move.line_id:65 res.append(tax_item)
109 tax_item = {}66 index += 1
110 if move_line.tax_code_id and move_line.tax_code_id.tax_ids:67 return res
111 # Nel wizard ho già controllato che le eventuali diverse68
112 # imposte abbiamo la stessa aliquota.69 def build_parent_tax_codes(self, tax_code):
113 # Le diverse imposte devono comunque usare gli stessi tax code70 res={}
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:
115 if main_tax.exclude_from_registries:72 res[tax_code.parent_id.id]=True
116 self.logger.notifyChannel("l10n_it_vat_registries", netsvc.LOG_INFO,73 res.update(self.build_parent_tax_codes(tax_code.parent_id))
117 _('The tax %s is excluded from registries') % main_tax.name)74 return res
118 continue75
119 # sommo gli imponibili relativi all'imposta corrente76 def _compute_totals(self, tax_code_ids):
120 base_amount = 0.0
121 for line in move_line.move_id.line_id:
122 if line.tax_code_id.id == main_tax.base_code_id.id:
123 base_amount += self._get_line_amount_with_sign(line)
124 if base_amount and main_tax.amount:
125 actual_tax_amount = base_amount * main_tax.amount
126 else:
127 actual_tax_amount = move_line.tax_amount
128 actual_tax_amount = cur_pool.round(
129 self.cr, self.uid, move.company_id.currency_id,
130 actual_tax_amount)
131 # calcolo % indetraibile
132 non_deductible = 0.0
133 if abs(actual_tax_amount) != abs(move_line.tax_amount):
134 non_deductible = 100
135 if move_line.tax_amount:
136 non_deductible = 100 - abs((
137 move_line.tax_amount * 100.0) / actual_tax_amount)
138 non_deductible = cur_pool.round(
139 self.cr, self.uid, move.company_id.currency_id,
140 non_deductible)
141 # calcolo il totale dell'operazione
142 invoice_amount_total = self._move_total(move_line)
143 if self._is_refund(move_line):
144 invoice_amount_total = - invoice_amount_total
145 str_non_deductible = str(non_deductible).split('.')[0]
146 tax_item = {
147 'tax_percentage': main_tax.amount and str(
148 main_tax.amount * 100).split('.')[0] or
149 move_line.tax_code_id.name,
150 'tax_code_name': move_line.tax_code_id.name,
151 'base': base_amount,
152 'amount': actual_tax_amount,
153 'non_deductible': str_non_deductible != '0' and
154 str_non_deductible or '',
155 'index': index,
156 'amount_total': invoice_amount_total,
157 }
158 res.append(tax_item)
159 iva = cur_pool.round(
160 self.cr, self.uid, move.company_id.currency_id,
161 (actual_tax_amount * (100 - non_deductible) * 0.01))
162 iva_inded = cur_pool.round(
163 self.cr, self.uid, move.company_id.currency_id,
164 (actual_tax_amount * non_deductible * 0.01))
165 tax_difference= (iva + iva_inded) - actual_tax_amount
166 # se risulta un'eccedenza, la tolgo dalla parte detraibile
167 if tax_difference > 0:
168 iva = iva - tax_difference
169 # se risulta una mancanza, la aggiungo alla parte indetraibile
170 elif tax_difference < 0:
171 iva_inded = iva_inded + tax_difference
172 totale_iva += iva
173 invoice_amount_untaxed += base_amount
174 totale_iva_inded += iva_inded
175 index += 1
176
177 if tax_item:
178 if tax_item['tax_code_name'] not in self.localcontext[
179 'tax_codes']:
180 self.localcontext['tax_codes'][tax_item[
181 'tax_code_name']] = {
182 'base': tax_item['base'],
183 'amount': tax_item['amount'],
184 }
185 else:
186 self.localcontext['tax_codes'][tax_item[
187 'tax_code_name']]['base'] += tax_item['base']
188 self.localcontext['tax_codes'][tax_item[
189 'tax_code_name']]['amount'] += tax_item['amount']
190
191 self.localcontext['totali'][
192 'totale_operazioni'] += invoice_amount_total
193 self.localcontext['totali'][
194 'totale_imponibili'] += invoice_amount_untaxed
195 self.localcontext['totali']['totale_iva'] += totale_iva
196 self.localcontext['totali']['totale_iva_inded'] += totale_iva_inded
197
198 return res
199
200 def _get_tax_lines_by_invoice(self, invoice):
201 res=[]77 res=[]
202 tax_obj = self.pool.get('account.tax')78 res_dict={}
203 # index è usato per non ripetere la stampa dei dati fattura quando ci sono più codici IVA79 tax_code_obj = self.pool.get('account.tax.code')
204 index = 080 for period_id in self.localcontext['data']['period_ids']:
205 totale_iva = 0.081 for tax_code in tax_code_obj.browse(self.cr, self.uid,
206 totale_iva_inded = 0.082 tax_code_ids, context={
207 invoice_amount_total = 0.083 'period_id': period_id,
208 invoice_amount_untaxed = 0.084 }):
209 for inv_tax in invoice.tax_line:85 if not res_dict.get(tax_code.id):
210 tax_item = {}86 res_dict[tax_code.id] = 0.0
211 if inv_tax.base_code_id and inv_tax.tax_code_id:87 res_dict[tax_code.id] += (tax_code.sum_period
212 account_tax = tax_obj.get_account_tax(inv_tax)88 * self.localcontext['data']['tax_sign'])
213 if account_tax.exclude_from_registries:89 for tax_code_id in res_dict:
214 self.logger.notifyChannel("l10n_it_vat_registries",90 tax_code = tax_code_obj.browse(self.cr, self.uid, tax_code_id)
215 netsvc.LOG_INFO, _(91 if res_dict[tax_code_id]:
216 'The tax %s is excluded from registries')92 res.append((tax_code.name,res_dict[tax_code_id],tax_code.is_base))
217 % account_tax.name)
218 continue
219 account_tax_amount = account_tax.amount
220 invoice_amount_total = self._get_invoice_amount_total(invoice)
221 invoice_amount_untaxed = self._get_invoice_amount_untaxed(
222 invoice)
223 amount = self._get_amount_with_sign(inv_tax.tax_amount,
224 inv_tax.amount)
225 base = self._get_amount_with_sign(inv_tax.base_amount,
226 inv_tax.base)
227 # calcolo le note di credito con segno invertito
228 if invoice.type in ('in_refund', 'out_refund'):
229 amount = -amount
230 base = -base
231 invoice_amount_untaxed = -invoice_amount_untaxed
232 invoice_amount_total = -invoice_amount_total
233 tax_item = {
234 'tax_percentage': account_tax_amount and str(
235 account_tax_amount * 100).split('.')[0] or
236 inv_tax.tax_code_id.name,
237 'base': base,
238 'amount': amount, # in valuta base
239 'non_deductible': 0.0,
240 'index': index,
241 'amount_total': invoice_amount_total,
242 }
243 res.append(tax_item)
244 totale_iva += amount
245 index += 1
246 # Se non c'è il tax code imponibile, cerco la tassa relativa alla parte non deducibile
247 elif inv_tax.tax_code_id:
248 tax = tax_obj.get_main_tax(tax_obj.get_account_tax(inv_tax))
249 if tax.exclude_from_registries:
250 self.logger.notifyChannel("l10n_it_vat_registries",
251 netsvc.LOG_INFO,
252 _('The tax %s is excluded from registries') % tax.name)
253 continue
254 for inv_tax_2 in invoice.tax_line:
255 if inv_tax_2.base_code_id and not inv_tax_2.tax_code_id:
256 base_tax = tax_obj.get_main_tax(
257 tax_obj.get_account_tax(inv_tax_2))
258 # Se hanno la stessa tassa
259 if base_tax.id == tax.id:
260 # Uso il valore assoluto perchè riferendosi
261 # alla stessa imposta non ci possono essere
262 # segni differenti
263 non_deductible = (abs(inv_tax_2.base_amount) /
264 (abs(inv_tax.base_amount) + abs(
265 inv_tax_2.base_amount)) * 100)
266 invoice_amount_total = \
267 self._get_invoice_amount_total(invoice)
268 invoice_amount_untaxed = \
269 self._get_invoice_amount_untaxed(invoice)
270 amount = self._get_amount_with_sign(
271 inv_tax.tax_amount, inv_tax.amount)
272 base = self._get_amount_with_sign(
273 inv_tax.base_amount, inv_tax.base)
274 amount2 = self._get_amount_with_sign(
275 inv_tax_2.tax_amount, inv_tax_2.amount)
276 base2 = self._get_amount_with_sign(
277 inv_tax_2.base_amount, inv_tax_2.base)
278 # calcolo le note di credito con segno invertito
279 if invoice.type in ('in_refund', 'out_refund'):
280 amount = -amount
281 base = -base
282 amount2 = -amount2
283 base2 = -base2
284 invoice_amount_untaxed = \
285 -invoice_amount_untaxed
286 invoice_amount_total = -invoice_amount_total
287 tax_item = {
288 'tax_percentage': base_tax.amount and str(
289 base_tax.amount * 100).split('.')[0] or
290 inv_tax.tax_code_id.name,
291 'base': base + base2,
292 'amount': amount + amount2,
293 'non_deductible': non_deductible and str(
294 non_deductible).split('.')[0] or '',
295 'index': index,
296 'amount_total': invoice_amount_total,
297 }
298 res.append(tax_item)
299 totale_iva += amount
300 totale_iva_inded += amount2
301 index += 1
302 break
303 elif not inv_tax.tax_code_id and not inv_tax.base_code_id:
304 self.logger.notifyChannel("l10n_it_vat_registries",
305 netsvc.LOG_INFO,
306 _('The tax %s has no tax codes') % inv_tax.name)
307 continue
308 if tax_item:
309 if tax_item['tax_percentage'] not in self.localcontext[
310 'tax_codes']:
311 self.localcontext['tax_codes'][tax_item[
312 'tax_percentage']] = {
313 'base': tax_item['base'],
314 'amount': tax_item['amount'],
315 }
316 else:
317 self.localcontext['tax_codes'][tax_item[
318 'tax_percentage']]['base'] += tax_item['base']
319 self.localcontext['tax_codes'][tax_item[
320 'tax_percentage']]['amount'] += tax_item['amount']
321
322 self.localcontext['totali'][
323 'totale_operazioni'] += invoice_amount_total
324 self.localcontext['totali'][
325 'totale_imponibili'] += invoice_amount_untaxed
326# da analizzare self.totale_variazioni += invoice.amount_total
327 self.localcontext['totali']['totale_iva'] += totale_iva
328 self.localcontext['totali']['totale_iva_inded'] += totale_iva_inded
329
330 return res93 return res
94
95 def _get_tax_codes(self):
96 return self._compute_totals(self.localcontext['used_tax_codes'].keys())
97
98 def _get_tax_codes_totals(self):
99 parent_codes = {}
100 tax_code_obj = self.pool.get('account.tax.code')
101 for tax_code in tax_code_obj.browse(self.cr, self.uid,
102 self.localcontext['used_tax_codes'].keys()):
103 parent_codes.update(self.build_parent_tax_codes(tax_code))
104 return self._compute_totals(parent_codes.keys())
105
106 def _get_start_date(self):
107 period_obj = self.pool.get('account.period')
108 start_date = False
109 for period in period_obj.browse(self.cr,self.uid,
110 self.localcontext['data']['period_ids']):
111 period_start = datetime.strptime(period.date_start, '%Y-%m-%d')
112 if not start_date or start_date > period_start:
113 start_date = period_start
114 return start_date.strftime('%Y-%m-%d')
115
116 def _get_end_date(self):
117 period_obj = self.pool.get('account.period')
118 end_date = False
119 for period in period_obj.browse(self.cr,self.uid,
120 self.localcontext['data']['period_ids']):
121 period_end = datetime.strptime(period.date_stop, '%Y-%m-%d')
122 if not end_date or end_date < period_end:
123 end_date = period_end
124 return end_date.strftime('%Y-%m-%d')
331125
332 def __init__(self, cr, uid, name, context):126 def __init__(self, cr, uid, name, context):
333 super(Parser, self).__init__(cr, uid, name, context)127 super(Parser, self).__init__(cr, uid, name, context)
334 self.localcontext.update({128 self.localcontext.update({
335 'time': time,
336 'tax_lines': self._get_tax_lines,129 'tax_lines': self._get_tax_lines,
337 'totali': {130 'tax_codes': self._get_tax_codes,
338 'totale_operazioni': 0.0,131 'tax_codes_totals': self._get_tax_codes_totals,
339 'totale_imponibili': 0.0,132 'used_tax_codes': {},
340 'totale_variazioni': 0.0,133 'start_date': self._get_start_date,
341 'totale_iva': 0.0,134 'end_date': self._get_end_date,
342 'totale_iva_inded': 0.0,
343 },
344 'tax_codes': {},
345 })135 })
346136
137 def set_context(self, objects, data, ids, report_type=None):
138 self.localcontext.update({
139 'fiscal_page_base': data.get('fiscal_page_base'),
140 })
141 return super(Parser, self).set_context(objects, data, ids, report_type=report_type)
347142
348report_sxw.report_sxw('report.registro_iva_vendite',143report_sxw.report_sxw('report.registro_iva_vendite',
349 'registro_iva_vendite',144 'registro_iva_vendite',
350145
=== modified file 'l10n_it_vat_registries/reports.xml'
--- l10n_it_vat_registries/reports.xml 2013-01-08 23:01:16 +0000
+++ l10n_it_vat_registries/reports.xml 2013-05-09 15:50:30 +0000
@@ -37,8 +37,7 @@
37 <td>37 <td>
38 <div>P. IVA: ${company.partner_id.vat or ''|entity}</div>38 <div>P. IVA: ${company.partner_id.vat or ''|entity}</div>
39 <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div>39 <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div>
40 <div>Codice Attività:</div>40
41 <div>Registro Imprese:</div>
42 </td>41 </td>
43 </tr>42 </tr>
44 </table>43 </table>
@@ -57,7 +56,11 @@
57 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];56 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
58 for(var i in x) {57 for(var i in x) {
59 var y = document.getElementsByClassName(x[i]);58 var y = document.getElementsByClassName(x[i]);
60 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];59 for(var j=0; j<y.length; ++j) {
60 if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};}
61 else{y[j].textContent = vars[x[i]];}
62 }
63
61 }64 }
62 }65 }
63 </script>66 </script>
@@ -115,8 +118,7 @@
115 <td>118 <td>
116 <div>P. IVA: ${company.partner_id.vat or ''|entity}</div>119 <div>P. IVA: ${company.partner_id.vat or ''|entity}</div>
117 <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div>120 <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div>
118 <div>Codice Attività:</div>121
119 <div>Registro Imprese:</div>
120 </td>122 </td>
121 </tr>123 </tr>
122 </table>124 </table>
@@ -135,7 +137,11 @@
135 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];137 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
136 for(var i in x) {138 for(var i in x) {
137 var y = document.getElementsByClassName(x[i]);139 var y = document.getElementsByClassName(x[i]);
138 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];140 for(var j=0; j<y.length; ++j) {
141 if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};}
142 else{y[j].textContent = vars[x[i]];}
143 }
144
139 }145 }
140 }146 }
141 </script>147 </script>
@@ -193,8 +199,7 @@
193 <td>199 <td>
194 <div>P. IVA: ${company.partner_id.vat or ''|entity}</div>200 <div>P. IVA: ${company.partner_id.vat or ''|entity}</div>
195 <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div>201 <div>Codice Fiscale: ${company.partner_id.fiscalcode or ''|entity}</div>
196 <div>Codice Attività:</div>202
197 <div>Registro Imprese:</div>
198 </td>203 </td>
199 </tr>204 </tr>
200 </table>205 </table>
@@ -213,7 +218,11 @@
213 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];218 var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
214 for(var i in x) {219 for(var i in x) {
215 var y = document.getElementsByClassName(x[i]);220 var y = document.getElementsByClassName(x[i]);
216 for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];221 for(var j=0; j<y.length; ++j) {
222 if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};}
223 else{y[j].textContent = vars[x[i]];}
224 }
225
217 }226 }
218 }227 }
219 </script>228 </script>
220229
=== modified file 'l10n_it_vat_registries/templates/registro_iva_acquisti.mako'
--- l10n_it_vat_registries/templates/registro_iva_acquisti.mako 2013-01-08 23:01:16 +0000
+++ l10n_it_vat_registries/templates/registro_iva_acquisti.mako 2013-05-09 15:50:30 +0000
@@ -19,20 +19,19 @@
19<body>19<body>
20 <h2>Fatture Ricevute</h2>20 <h2>Fatture Ricevute</h2>
21 <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>21 <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>
22 <table style="width:100%;" cellspacing="0">22 <table style="width:100%; font-size: small;" cellspacing="0">
23 <thead>23 <thead>
24 <tr>24 <tr>
25 <th class="left_without_line">Data registrazione</th>25 <th class="left_without_line">Data registrazione</th>
26 <th class="left_without_line">Numero</th>26 <th class="left_without_line">Numero</th>
27 <th class="left_without_line">Ragione sociale</th>27 <th class="left_without_line">Ragione sociale</th>
28 <th class="left_without_line">Numero registrazione</th>
28 <th class="left_without_line">Numero fattura</th>29 <th class="left_without_line">Numero fattura</th>
29 <th class="left_without_line">Data fattura</th>30 <th class="left_without_line">Data fattura</th>
30 <th class="left_without_line">Causale</th>31 <th class="left_without_line">Sezionale</th>
31 <th class="right_without_line">Totale fattura</th>32 <th class="right_without_line">Totale fattura</th>
32 <th class="right_without_line">Imponibile</th>
33 <th class="right_without_line">% IVA</th>
34 <th class="right_without_line">Imposta</th>33 <th class="right_without_line">Imposta</th>
35 <th class="right_without_line">% inded.</th>34 <th class="right_without_line">Importo</th>
36 <th></th>35 <th></th>
37 </tr>36 </tr>
38 </thead>37 </thead>
@@ -63,7 +62,7 @@
63 </td><td class="left_without_line">62 </td><td class="left_without_line">
64 %endif63 %endif
65 %if line['index']==0:64 %if line['index']==0:
66 ${object.partner_id.name or ''| entity}65 ${object.partner_id.name or ''| entity}
67 %endif66 %endif
68 %if line['index']==0:67 %if line['index']==0:
69 </td><td class="left_with_line">68 </td><td class="left_with_line">
@@ -79,19 +78,23 @@
79 </td><td class="left_without_line">78 </td><td class="left_without_line">
80 %endif79 %endif
81 %if line['index']==0:80 %if line['index']==0:
82 ${ formatLang(object.date,date=True) or '' | entity}81 ${ line['supplier_invoice_number'] or '' | entity}
83 %endif82 %endif
84 %if line['index']==0:83 %if line['index']==0:
85 </td><td class="left_with_line">84 </td><td class="left_with_line">
86 %else:85 %else:
87 </td><td class="left_without_line">86 </td><td class="left_without_line">
88 %endif87 %endif
89 %if line['index']==0:88 %if line['index']==0:
90 %if line['amount_total'] >= 0:89 ${ formatLang(line['invoice_date'],date=True) or '' | entity}
91 Fattura90 %endif
92 %else:91 %if line['index']==0:
93 Nota di credito92 </td><td class="left_with_line">
94 %endif93 %else:
94 </td><td class="left_without_line">
95 %endif
96 %if line['index']==0:
97 ${object.journal_id.name or ''| entity}
95 %endif98 %endif
96 %if line['index']==0:99 %if line['index']==0:
97 </td><td class="right_with_line">100 </td><td class="right_with_line">
@@ -99,34 +102,19 @@
99 </td><td class="right_without_line">102 </td><td class="right_without_line">
100 %endif103 %endif
101 %if line['index']==0:104 %if line['index']==0:
102 ${ formatLang(line['amount_total']) | entity}105 ${ formatLang(object.amount) | entity}
103 %endif106 %endif
104 </td>107 </td>
105 %if line['index']==0:108 %if line['index']==0:
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>
107 %else:110 %else:
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>
109 %endif112 %endif
110 %if line['index']==0:113 %if line['index']==0:
111 <td class="right_with_line">${ line['tax_percentage'] or ''| entity}</td>114 <td class="right_with_line">${ formatLang(line['amount'])| entity}</td>
112 %else:115 %else:
113 <td class="right_without_line">${ line['tax_percentage'] or ''| entity}</td>116 <td class="right_without_line">${ formatLang(line['amount'])| entity}</td>
114 %endif117 %endif
115 %if line['index']==0:
116 <td class="right_with_line">${ formatLang(line['amount']) or ''| entity}</td>
117 %else:
118 <td class="right_without_line">${ formatLang(line['amount']) or ''| entity}</td>
119 %endif
120 %if line['index']==0:
121 <td class="right_with_line">
122 %else:
123 <td class="right_without_line">
124 %endif
125 %if line['non_deductible']:
126 ${ line['non_deductible'] | entity} %
127 %endif
128 </td>
129 <td></td>
130 </tr>118 </tr>
131 %endfor119 %endfor
132 %endfor120 %endfor
@@ -134,34 +122,87 @@
134 </table>122 </table>
135 <div style="page-break-inside: avoid;">123 <div style="page-break-inside: avoid;">
136 <br/>124 <br/>
125 <% tax_code_list = tax_codes() %>
126 <% tax_code_totals_list = tax_codes_totals() %>
137 <table style="width:100%; " border="1">127 <table style="width:100%; " border="1">
138 <tr style="border-style:ridge;border-width:5px">128 <tr style="border-style:ridge;border-width:5px">
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>
140 </tr>130 </tr>
141 <tr>131 <tr>
142 <td rowspan="2" style="vertical-align:text-top;padding:10">132 <td colspan="2" style="vertical-align:text-top;padding:10">
143 <table style="width:100%;">133 <h3>Dettaglio</h3>
144 <tr>134 <table style="width:100%;">
145 <th style="text-align:left">Descrizione</th>135 <tr>
146 <th style="text-align:right">Imponibile</th>136 <th style="text-align:left">Descrizione</th>
147 <th style="text-align:right">Imposta</th>137 <th style="text-align:right">Importo</th>
148 </tr>138 </tr>
149 %for tax_code in tax_codes :139 %for tax_code_tuple in tax_code_list :
150 <tr>140 % if not tax_code_tuple[2]:
151 <td>${tax_code|entity}141 <tr>
152 </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity}142 <td>${tax_code_tuple[0]|entity}
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}
154 </td>144 </td>
155 </tr>145 </tr>
156 %endfor146 %endif
157 </table>147 %endfor
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>
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>
160 </tr>150 <td style="vertical-align:text-top;padding:10">
161 <tr>151 <h3>Totali</h3>
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%;">
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>
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>
155 <th style="text-align:right">Importo</th>
156 </tr>
157 %for tax_code_tuple in tax_code_totals_list :
158 % if not tax_code_tuple[2]:
159 <tr>
160 <td>${tax_code_tuple[0]|entity}
161 </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity}
162 </td>
163 </tr>
164 %endif
165 %endfor
166 </table>
167 </td>
168 </tr>
169 <tr>
170 <td colspan="2" style="vertical-align:text-top;padding:10">
171 <h3>Dettaglio imponibili</h3>
172 <table style="width:100%;">
173 <tr>
174 <th style="text-align:left">Descrizione</th>
175 <th style="text-align:right">Importo</th>
176 </tr>
177 %for tax_code_tuple in tax_code_list :
178 % if tax_code_tuple[2]:
179 <tr>
180 <td>${tax_code_tuple[0]|entity}
181 </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity}
182 </td>
183 </tr>
184 %endif
185 %endfor
186 </table>
187 </td>
188 <td style="vertical-align:text-top;padding:10">
189 <h3>Totali imponibili</h3>
190 <table style="width:100%;">
191 <tr>
192 <th style="text-align:left">Descrizione</th>
193 <th style="text-align:right">Importo</th>
194 </tr>
195 %for tax_code_tuple in tax_code_totals_list :
196 % if tax_code_tuple[2]:
197 <tr>
198 <td>${tax_code_tuple[0]|entity}
199 </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity}
200 </td>
201 </tr>
202 %endif
203 %endfor
204 </table>
205 </td>
165 </tr>206 </tr>
166 </table>207 </table>
167 </div>208 </div>
168209
=== modified file 'l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako'
--- l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako 2013-01-08 23:01:16 +0000
+++ l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako 2013-05-09 15:50:30 +0000
@@ -19,16 +19,15 @@
19<body>19<body>
20 <h2>Corrispettivi</h2>20 <h2>Corrispettivi</h2>
21 <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>21 <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>
22 <table style="width:100%;" cellspacing="0">22 <table style="width:100%; font-size: small;" cellspacing="0">
23 <thead>23 <thead>
24 <tr>24 <tr>
25 <th class="left_without_line">Numero</th>25 <th class="left_without_line">Numero</th>
26 <th class="left_without_line">Data registrazione</th>26 <th class="left_without_line">Data registrazione</th>
27 <th class="left_without_line">Causale</th>27 <th class="left_without_line">Sezionale</th>
28 <th class="right_without_line">Importo totale</th>28 <th class="right_without_line">Importo totale</th>
29 <th class="right_without_line">Imponibile</th>
30 <th class="right_without_line">% IVA</th>
31 <th class="right_without_line">Imposta</th>29 <th class="right_without_line">Imposta</th>
30 <th class="right_without_line">Importo</th>
32 <th></th>31 <th></th>
33 </tr>32 </tr>
34 </thead>33 </thead>
@@ -59,7 +58,7 @@
59 </td><td class="left_without_line">58 </td><td class="left_without_line">
60 %endif59 %endif
61 %if line['index']==0:60 %if line['index']==0:
62 Corrispettivi61 ${object.journal_id.name or ''| entity}
63 %endif62 %endif
64 %if line['index']==0:63 %if line['index']==0:
65 </td><td class="right_with_line">64 </td><td class="right_with_line">
@@ -67,25 +66,19 @@
67 </td><td class="right_without_line">66 </td><td class="right_without_line">
68 %endif67 %endif
69 %if line['index']==0:68 %if line['index']==0:
70 ${ formatLang(line['amount_total']) | entity}69 ${ formatLang(object.amount) | entity}
71 %endif70 %endif
72 </td>71 </td>
73 %if line['index']==0:72 %if line['index']==0:
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>
75 %else:74 %else:
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>
77 %endif76 %endif
78 %if line['index']==0:77 %if line['index']==0:
79 <td class="right_with_line">${ line['tax_percentage'] or ''| entity}</td>78 <td class="right_with_line">${ formatLang(line['amount'])| entity}</td>
80 %else:79 %else:
81 <td class="right_without_line">${ line['tax_percentage'] or ''| entity}</td>80 <td class="right_without_line">${ formatLang(line['amount'])| entity}</td>
82 %endif81 %endif
83 %if line['index']==0:
84 <td class="right_with_line">${ formatLang(line['amount']) or ''| entity}</td>
85 %else:
86 <td class="right_without_line">${ formatLang(line['amount']) or ''| entity}</td>
87 %endif
88 <td></td>
89 </tr>82 </tr>
90 %endfor83 %endfor
91 %endfor84 %endfor
@@ -93,33 +86,87 @@
93 </table>86 </table>
94 <div style="page-break-inside: avoid;">87 <div style="page-break-inside: avoid;">
95 <br/>88 <br/>
89 <% tax_code_list = tax_codes() %>
90 <% tax_code_totals_list = tax_codes_totals() %>
96 <table style="width:100%; " border="1">91 <table style="width:100%; " border="1">
97 <tr style="border-style:ridge;border-width:5px">92 <tr style="border-style:ridge;border-width:5px">
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>
99 </tr>94 </tr>
100 <tr>95 <tr>
101 <td rowspan="2" style="vertical-align:text-top;padding:10">96 <td colspan="2" style="vertical-align:text-top;padding:10">
102 <table style="width:100%;">97 <h3>Dettaglio</h3>
103 <tr>98 <table style="width:100%;">
104 <th style="text-align:left">Descrizione</th>99 <tr>
105 <th style="text-align:right">Imponibile</th>100 <th style="text-align:left">Descrizione</th>
106 <th style="text-align:right">Imposta</th>101 <th style="text-align:right">Importo</th>
107 </tr>102 </tr>
108 %for tax_code in tax_codes :103 %for tax_code_tuple in tax_code_list :
109 <tr>104 % if not tax_code_tuple[2]:
110 <td>${tax_code|entity}105 <tr>
111 </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity}106 <td>${tax_code_tuple[0]|entity}
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}
113 </td>108 </td>
114 </tr>109 </tr>
115 %endfor110 %endif
116 </table>111 %endfor
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>
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>
119 </tr>114 <td style="vertical-align:text-top;padding:10">
120 <tr>115 <h3>Totali</h3>
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%;">
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>
118 <th style="text-align:left">Descrizione</th>
119 <th style="text-align:right">Importo</th>
120 </tr>
121 %for tax_code_tuple in tax_code_totals_list :
122 % if not tax_code_tuple[2]:
123 <tr>
124 <td>${tax_code_tuple[0]|entity}
125 </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity}
126 </td>
127 </tr>
128 %endif
129 %endfor
130 </table>
131 </td>
132 </tr>
133 <tr>
134 <td colspan="2" style="vertical-align:text-top;padding:10">
135 <h3>Dettaglio imponibili</h3>
136 <table style="width:100%;">
137 <tr>
138 <th style="text-align:left">Descrizione</th>
139 <th style="text-align:right">Importo</th>
140 </tr>
141 %for tax_code_tuple in tax_code_list :
142 % if tax_code_tuple[2]:
143 <tr>
144 <td>${tax_code_tuple[0]|entity}
145 </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity}
146 </td>
147 </tr>
148 %endif
149 %endfor
150 </table>
151 </td>
152 <td style="vertical-align:text-top;padding:10">
153 <h3>Totali imponibili</h3>
154 <table style="width:100%;">
155 <tr>
156 <th style="text-align:left">Descrizione</th>
157 <th style="text-align:right">Importo</th>
158 </tr>
159 %for tax_code_tuple in tax_code_totals_list :
160 % if tax_code_tuple[2]:
161 <tr>
162 <td>${tax_code_tuple[0]|entity}
163 </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity}
164 </td>
165 </tr>
166 %endif
167 %endfor
168 </table>
169 </td>
123 </tr>170 </tr>
124 </table>171 </table>
125 </div>172 </div>
126173
=== modified file 'l10n_it_vat_registries/templates/registro_iva_vendite.mako'
--- l10n_it_vat_registries/templates/registro_iva_vendite.mako 2013-01-08 23:01:16 +0000
+++ l10n_it_vat_registries/templates/registro_iva_vendite.mako 2013-05-09 15:50:30 +0000
@@ -19,7 +19,7 @@
19<body>19<body>
20 <h2>Fatture Emesse</h2>20 <h2>Fatture Emesse</h2>
21 <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>21 <% setLang(objects[0].company_id.partner_id.lang or "en_US") %>
22 <table style="width:100%;" cellspacing="0">22 <table style="width:100%; font-size: small;" cellspacing="0">
23 <thead>23 <thead>
24 <tr>24 <tr>
25 <th class="left_without_line">Data registrazione</th>25 <th class="left_without_line">Data registrazione</th>
@@ -27,11 +27,10 @@
27 <th class="left_without_line">Ragione sociale</th>27 <th class="left_without_line">Ragione sociale</th>
28 <th class="left_without_line">Numero fattura</th>28 <th class="left_without_line">Numero fattura</th>
29 <th class="left_without_line">Data fattura</th>29 <th class="left_without_line">Data fattura</th>
30 <th class="left_without_line">Causale</th>30 <th class="left_without_line">Sezionale</th>
31 <th class="right_without_line">Totale fattura</th>31 <th class="right_without_line">Totale fattura</th>
32 <th class="right_without_line">Imponibile</th>
33 <th class="right_without_line">% IVA</th>
34 <th class="right_without_line">Imposta</th>32 <th class="right_without_line">Imposta</th>
33 <th class="right_without_line">Importo</th>
35 <th></th>34 <th></th>
36 </tr>35 </tr>
37 </thead>36 </thead>
@@ -78,7 +77,7 @@
78 </td><td class="left_without_line">77 </td><td class="left_without_line">
79 %endif78 %endif
80 %if line['index']==0:79 %if line['index']==0:
81 ${ formatLang(object.date,date=True) or '' | entity}80 ${ formatLang(line['invoice_date'],date=True) or '' | entity}
82 %endif81 %endif
83 %if line['index']==0:82 %if line['index']==0:
84 </td><td class="left_with_line">83 </td><td class="left_with_line">
@@ -86,11 +85,7 @@
86 </td><td class="left_without_line">85 </td><td class="left_without_line">
87 %endif86 %endif
88 %if line['index']==0:87 %if line['index']==0:
89 %if line['amount_total'] >= 0:88 ${object.journal_id.name or ''| entity}
90 Fattura
91 %else:
92 Nota di credito
93 %endif
94 %endif89 %endif
95 %if line['index']==0:90 %if line['index']==0:
96 </td><td class="right_with_line">91 </td><td class="right_with_line">
@@ -98,25 +93,19 @@
98 </td><td class="right_without_line">93 </td><td class="right_without_line">
99 %endif94 %endif
100 %if line['index']==0:95 %if line['index']==0:
101 ${ formatLang(line['amount_total']) | entity}96 ${ formatLang(object.amount) | entity}
102 %endif97 %endif
103 </td>98 </td>
104 %if line['index']==0:99 %if line['index']==0:
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>
106 %else:101 %else:
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>
108 %endif103 %endif
109 %if line['index']==0:104 %if line['index']==0:
110 <td class="right_with_line">${ line['tax_percentage'] or ''| entity}</td>105 <td class="right_with_line">${ formatLang(line['amount'])| entity}</td>
111 %else:106 %else:
112 <td class="right_without_line">${ line['tax_percentage'] or ''| entity}</td>107 <td class="right_without_line">${ formatLang(line['amount'])| entity}</td>
113 %endif108 %endif
114 %if line['index']==0:
115 <td class="right_with_line">${ formatLang(line['amount']) or ''| entity}</td>
116 %else:
117 <td class="right_without_line">${ formatLang(line['amount']) or ''| entity}</td>
118 %endif
119 <td></td>
120 </tr>109 </tr>
121 %endfor110 %endfor
122 %endfor111 %endfor
@@ -124,33 +113,87 @@
124 </table>113 </table>
125 <div style="page-break-inside: avoid;">114 <div style="page-break-inside: avoid;">
126 <br/>115 <br/>
116 <% tax_code_list = tax_codes() %>
117 <% tax_code_totals_list = tax_codes_totals() %>
127 <table style="width:100%; " border="1">118 <table style="width:100%; " border="1">
128 <tr style="border-style:ridge;border-width:5px">119 <tr style="border-style:ridge;border-width:5px">
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>
130 </tr>121 </tr>
131 <tr>122 <tr>
132 <td rowspan="2" style="vertical-align:text-top;padding:10">123 <td colspan="2" style="vertical-align:text-top;padding:10">
133 <table style="width:100%;">124 <h3>Dettaglio</h3>
134 <tr>125 <table style="width:100%;">
135 <th style="text-align:left">Descrizione</th>126 <tr>
136 <th style="text-align:right">Imponibile</th>127 <th style="text-align:left">Descrizione</th>
137 <th style="text-align:right">Imposta</th>128 <th style="text-align:right">Importo</th>
138 </tr>129 </tr>
139 %for tax_code in tax_codes :130 %for tax_code_tuple in tax_code_list :
140 <tr>131 % if not tax_code_tuple[2]:
141 <td>${tax_code|entity}132 <tr>
142 </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity}133 <td>${tax_code_tuple[0]|entity}
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}
144 </td>135 </td>
145 </tr>136 </tr>
146 %endfor137 %endif
147 </table>138 %endfor
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>
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>
150 </tr>141 <td style="vertical-align:text-top;padding:10">
151 <tr>142 <h3>Totali</h3>
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%;">
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>
145 <th style="text-align:left">Descrizione</th>
146 <th style="text-align:right">Importo</th>
147 </tr>
148 %for tax_code_tuple in tax_code_totals_list :
149 % if not tax_code_tuple[2]:
150 <tr>
151 <td>${tax_code_tuple[0]|entity}
152 </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity}
153 </td>
154 </tr>
155 %endif
156 %endfor
157 </table>
158 </td>
159 </tr>
160 <tr>
161 <td colspan="2" style="vertical-align:text-top;padding:10">
162 <h3>Dettaglio imponibili</h3>
163 <table style="width:100%;">
164 <tr>
165 <th style="text-align:left">Descrizione</th>
166 <th style="text-align:right">Importo</th>
167 </tr>
168 %for tax_code_tuple in tax_code_list :
169 % if tax_code_tuple[2]:
170 <tr>
171 <td>${tax_code_tuple[0]|entity}
172 </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity}
173 </td>
174 </tr>
175 %endif
176 %endfor
177 </table>
178 </td>
179 <td style="vertical-align:text-top;padding:10">
180 <h3>Totali imponibili</h3>
181 <table style="width:100%;">
182 <tr>
183 <th style="text-align:left">Descrizione</th>
184 <th style="text-align:right">Importo</th>
185 </tr>
186 %for tax_code_tuple in tax_code_totals_list :
187 % if tax_code_tuple[2]:
188 <tr>
189 <td>${tax_code_tuple[0]|entity}
190 </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity}
191 </td>
192 </tr>
193 %endif
194 %endfor
195 </table>
196 </td>
154 </tr>197 </tr>
155 </table>198 </table>
156 </div>199 </div>
157200
=== modified file 'l10n_it_vat_registries/wizard/__init__.py'
--- l10n_it_vat_registries/wizard/__init__.py 2013-01-29 22:08:50 +0000
+++ l10n_it_vat_registries/wizard/__init__.py 2013-05-09 15:50:30 +0000
@@ -1,7 +1,7 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2##############################################################################2##############################################################################
3# 3#
4# Copyright (C) 2011 Associazione OpenERP Italia4# Copyright (C) 2011-2013 Associazione OpenERP Italia
5# (<http://www.openerp-italia.org>). 5# (<http://www.openerp-italia.org>).
6#6#
7# This program is free software: you can redistribute it and/or modify7# This program is free software: you can redistribute it and/or modify
@@ -12,7 +12,7 @@
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,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.15# GNU Affero General Public License for more details.
16#16#
17# You should have received a copy of the GNU Affero General Public License17# You should have received a copy of the GNU Affero General Public License
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/>.
1919
=== modified file 'l10n_it_vat_registries/wizard/print_registro_iva.py'
--- l10n_it_vat_registries/wizard/print_registro_iva.py 2013-01-29 22:08:50 +0000
+++ l10n_it_vat_registries/wizard/print_registro_iva.py 2013-05-09 15:50:30 +0000
@@ -25,79 +25,64 @@
2525
26class wizard_registro_iva(osv.osv_memory):26class wizard_registro_iva(osv.osv_memory):
2727
28 def _get_period(self, cr, uid, context=None):
29 ctx = dict(context or {}, account_period_prefer_normal=True)
30 period_ids = self.pool.get('account.period').find(cr, uid, context=ctx)
31 return period_ids
32
28 _name = "wizard.registro.iva"33 _name = "wizard.registro.iva"
29 _columns = {34 _columns = {
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),
31 'date_to': fields.date('To date', required=True),
32 'type': fields.selection([36 'type': fields.selection([
33 ('customer', 'Customer Invoices'),37 ('customer', 'Customer Invoices'),
34 ('supplier', 'Supplier Invoices'),38 ('supplier', 'Supplier Invoices'),
35 ('corrispettivi', 'Corrispettivi'),39 ('corrispettivi', 'Corrispettivi'),
36 ], 'Layout', required=True),40 ], 'Layout', required=True),
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),
42 'tax_sign': fields.float('Tax amount sign',
43 help="Use -1 you have negative tax amounts and you want to print them prositive"),
38 'message': fields.char('Message', size=64, readonly=True),44 'message': fields.char('Message', size=64, readonly=True),
45 'fiscal_page_base': fields.integer('Last printed page', required=True),
39 }46 }
40 _defaults = {47 _defaults = {
41 'type': 'customer',48 'type': 'customer',
42 'date_from': lambda * a: time.strftime('%Y-%m-%d'),49 'period_ids': _get_period,
43 'date_to': lambda * a: time.strftime('%Y-%m-%d'),50 'tax_sign': 1.0,
44 #'journal_ids': lambda s, cr, uid, c: s.pool.get('account.journal').search(cr, uid, []),51 'fiscal_page_base': 0,
45 }52 }
46
47 def counterparts_number(self, move_line):
48 counter = 0
49 if not move_line.credit:
50 for line in move_line.move_id.line_id:
51 if line.credit:
52 counter += 1
53 elif not move_line.debit:
54 for line in move_line.move_id.line_id:
55 if line.debit:
56 counter += 1
57 return counter
5853
59 def print_registro(self, cr, uid, ids, context=None):54 def print_registro(self, cr, uid, ids, context=None):
60 move_ids = []
61 wizard = self.read(cr, uid, ids)[0]
62 move_line_obj = self.pool.get('account.move.line')
63 tax_pool = self.pool.get('account.tax')
64 search_list = []
65 search_list = [
66 ('journal_id', 'in', wizard['journal_ids']),
67 ('move_id.date', '<=', wizard['date_to']),
68 ('move_id.date', '>=', wizard['date_from']),
69 ('move_id.state', '=', 'posted'),
70 ('tax_code_id', '!=', False),
71 ]
72 move_line_ids = move_line_obj.search(cr, uid, search_list, order='date')
73 if context is None:55 if context is None:
74 context = {}56 context = {}
75 for move_line in move_line_obj.browse(cr, uid, move_line_ids):57 wizard = self.browse(cr, uid, ids)[0]
76 # verifico che sia coinvolto un conto imposta legato ad un'imposta tramite conto standard o conto refund58 move_obj = self.pool.get('account.move')
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')
78 if move_line.tax_code_id.tax_ids:60 move_ids = move_obj.search(cr, uid, [
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]),
80 raise osv.except_osv(_('Error'), _('Taxes %s have different rates')62 ('period_id', 'in', [p.id for p in wizard.period_ids]),
81 % str(move_line.tax_code_id.tax_ids))63 ('state', '=', 'posted'),
82 if move_line.tax_code_id.ref_tax_ids:64 ], order='date')
83 if not tax_pool._have_same_rate(move_line.tax_code_id.ref_tax_ids):
84 raise osv.except_osv(_('Error'), _('Taxes %s have different rates')
85 % str(move_line.tax_code_id.ref_tax_ids))
86 # controllo che ogni tax code abbia una e una sola imposta
87 ''' non posso farlo per via dell IVA inclusa nel prezzo
88 if len(move_line.tax_code_id.tax_ids) != 1:
89 raise osv.except_osv(_('Error'), _('Wrong tax configuration for tax code %s')
90 % move_line.tax_code_id.name)
91 '''
92 if move_line.move_id.id not in move_ids:
93 move_ids.append(move_line.move_id.id)
94 if not move_ids:65 if not move_ids:
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')})
96 return True67 model_data_ids = obj_model_data.search(cr, uid, [('model','=','ir.ui.view'), ('name','=','wizard_registro_iva')])
68 resource_id = obj_model_data.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
69 return {
70 'name': _('No documents'),
71 'res_id': ids[0],
72 'view_type': 'form',
73 'view_mode': 'form',
74 'res_model': 'wizard.registro.iva',
75 'views': [(resource_id,'form')],
76 'context': context,
77 'type': 'ir.actions.act_window',
78 'target': 'new',
79 }
97 datas = {'ids': move_ids}80 datas = {'ids': move_ids}
98 datas['model'] = 'account.move'81 datas['model'] = 'account.move'
99 datas['form'] = wizard82 datas['fiscal_page_base'] = wizard.fiscal_page_base
100 datas['move_ids'] = move_ids83 datas['period_ids'] = [p.id for p in wizard.period_ids]
84 datas['layout'] = wizard['type']
85 datas['tax_sign'] = wizard['tax_sign']
101 res= {86 res= {
102 'type': 'ir.actions.report.xml',87 'type': 'ir.actions.report.xml',
103 'datas': datas,88 'datas': datas,
@@ -110,4 +95,11 @@
110 res['report_name'] = 'registro_iva_corrispettivi'95 res['report_name'] = 'registro_iva_corrispettivi'
111 return res96 return res
11297
113wizard_registro_iva()98 def on_type_changed(self, cr, uid, ids, j_type, context=None):
99 res={}
100 if j_type:
101 if j_type == 'supplier':
102 res['value'] = {'tax_sign': -1}
103 else:
104 res['value'] = {'tax_sign': 1}
105 return res
114106
=== modified file 'l10n_it_vat_registries/wizard/print_registro_iva.xml'
--- l10n_it_vat_registries/wizard/print_registro_iva.xml 2013-01-08 23:01:16 +0000
+++ l10n_it_vat_registries/wizard/print_registro_iva.xml 2013-05-09 15:50:30 +0000
@@ -7,16 +7,23 @@
7 <field name="model">wizard.registro.iva</field>7 <field name="model">wizard.registro.iva</field>
8 <field name="type">form</field>8 <field name="type">form</field>
9 <field name="arch" type="xml">9 <field name="arch" type="xml">
10 <form string="Tax Journal">10 <form string="Tax Journal" version="7.0">
11 <field name="date_from"/>11 <group>
12 <field name="date_to"/>12 <field name="type" on_change="on_type_changed(type)"/>
13 <field name="type" colspan="4"/>13 <field name="tax_sign"/>
14 <separator string="Journals" colspan="4"/>14 <field name="fiscal_page_base"/>
15 <field name="journal_ids" colspan="4" nolabel="1" height="250"/>15 <separator string="Periods" colspan="4"/>
16 <button icon="gtk-cancel" special="cancel" string="Cancel"/>16 <field name="period_ids" colspan="4" nolabel="1" height="250"/>
17 <button icon="gtk-ok" name="print_registro" string="Print" type="object"/>17 <separator string="Journals" colspan="4"/>
18 <newline/>18 <field name="journal_ids" colspan="4" nolabel="1" height="250" domain="[('type', 'in', ('sale','purchase','sale_refund','purchase_refund'))]"/>
19 <field name="message" nolabel="1" colspan="4"/>19 <newline/>
20 <field name="message" nolabel="1" colspan="4"/>
21 </group>
22 <footer>
23 <button string="Print" name="print_registro" type="object" class="oe_highlight"/>
24 or
25 <button string="Cancel" class="oe_link" special="cancel"/>
26 </footer>
20 </form>27 </form>
21 </field>28 </field>
22 </record>29 </record>

Subscribers

People subscribed via source and target branches