Merge lp:~elbati/openobject-italia/6.1-l10n_it_vat_registries_simplified into lp:~openobject-italia-core-devs/openobject-italia/italian-addons-6.1
- 6.1-l10n_it_vat_registries_simplified
- Merge into italian-addons-6.1
Proposed by
Lorenzo Battistini
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 235 | ||||
Proposed branch: | lp:~elbati/openobject-italia/6.1-l10n_it_vat_registries_simplified | ||||
Merge into: | lp:~openobject-italia-core-devs/openobject-italia/italian-addons-6.1 | ||||
Diff against target: |
1439 lines (+499/-583) 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 (+4/-4) l10n_it_vat_registries/account.py (+10/-28) l10n_it_vat_registries/account_view.xml (+8/-9) l10n_it_vat_registries/invoice.py (+104/-306) l10n_it_vat_registries/reports.xml (+15/-3) 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 (+6/-4) |
||||
To merge this branch: | bzr merge lp:~elbati/openobject-italia/6.1-l10n_it_vat_registries_simplified | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sergio Corato (community) | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
- 232. By Lorenzo Battistini
-
[imp] journal domain
- 233. By Lorenzo Battistini
-
[add] on_type_changed
- 234. By Lorenzo Battistini
-
[add] back porting http://
bazaar. launchpad. net/~elbati/ openobject- italia/ 7-l10n_ it_vat_ registries_ simplified/ revision/ 231?remember= 231&compare_ revid=229
- 235. By Lorenzo Battistini
-
[FIX] AttributeError: "Field 'supplier_
invoice_ number' does not exist in object 'browse_ record( account. invoice, 1)'"
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Lorenzo Battistini (elbati) wrote : | # |
Per ora uso il campo 'reference' che di solito è usato come numero fattura fornitore.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'l10n_it_vat_registries/AUTHORS.txt' | |||
2 | --- l10n_it_vat_registries/AUTHORS.txt 2011-07-23 14:39:45 +0000 | |||
3 | +++ l10n_it_vat_registries/AUTHORS.txt 2013-05-23 04:44:28 +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-04 14:02:10 +0000 | |||
11 | +++ l10n_it_vat_registries/__init__.py 2013-05-23 04:44:28 +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-01-04 14:02:10 +0000 | |||
40 | +++ l10n_it_vat_registries/__openerp__.py 2013-05-23 04:44:28 +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 | @@ -28,13 +28,13 @@ | |||
60 | 28 | 'author': 'OpenERP Italian Community', | 28 | 'author': 'OpenERP Italian Community', |
61 | 29 | 'website': 'http://www.openerp-italia.org', | 29 | 'website': 'http://www.openerp-italia.org', |
62 | 30 | 'license': 'AGPL-3', | 30 | 'license': 'AGPL-3', |
64 | 31 | "depends" : ['report_webkit', 'l10n_it_account', 'l10n_it_partially_deductible_vat'], | 31 | "depends" : ['report_webkit', 'l10n_it_base', 'l10n_it_fiscalcode', 'l10n_it_partially_deductible_vat'], |
65 | 32 | "init_xml" : [ | 32 | "init_xml" : [ |
66 | 33 | ], | 33 | ], |
67 | 34 | "update_xml" : [ | 34 | "update_xml" : [ |
68 | 35 | 'reports.xml', | 35 | 'reports.xml', |
69 | 36 | 'wizard/print_registro_iva.xml', | ||
70 | 36 | 'account_view.xml', | 37 | 'account_view.xml', |
71 | 37 | 'wizard/print_registro_iva.xml', | ||
72 | 38 | ], | 38 | ], |
73 | 39 | "demo_xml" : [], | 39 | "demo_xml" : [], |
74 | 40 | "active": False, | 40 | "active": False, |
75 | 41 | 41 | ||
76 | === modified file 'l10n_it_vat_registries/account.py' | |||
77 | --- l10n_it_vat_registries/account.py 2013-01-04 14:02:10 +0000 | |||
78 | +++ l10n_it_vat_registries/account.py 2013-05-23 04:44:28 +0000 | |||
79 | @@ -1,10 +1,8 @@ | |||
80 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
81 | 2 | ############################################################################## | 2 | ############################################################################## |
87 | 3 | # | 3 | # |
88 | 4 | # Copyright (C) 2011-2012 Associazione OpenERP Italia | 4 | # Copyright (C) 2013 Associazione OpenERP Italia |
89 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
85 | 6 | # Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>) | ||
86 | 7 | # Copyright (C) 2012 Domsense srl (<http://www.domsense.com>) | ||
90 | 8 | # | 6 | # |
91 | 9 | # 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 |
92 | 10 | # 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 |
93 | @@ -21,28 +19,12 @@ | |||
94 | 21 | # | 19 | # |
95 | 22 | ############################################################################## | 20 | ############################################################################## |
96 | 23 | 21 | ||
104 | 24 | from osv import fields, osv | 22 | from openerp.osv import fields, osv |
105 | 25 | from tools.translate import _ | 23 | from openerp.tools.translate import _ |
106 | 26 | 24 | ||
107 | 27 | 25 | class account_tax_code(osv.osv): | |
108 | 28 | class account_tax(osv.osv): | 26 | _inherit = "account.tax.code" |
109 | 29 | 27 | ||
103 | 30 | _inherit = 'account.tax' | ||
110 | 31 | _columns = { | 28 | _columns = { |
115 | 32 | 'exclude_from_registries': fields.boolean( | 29 | 'is_base': fields.boolean('Is base', help="This tax code is used for base amounts (field used by VAT registries)"), |
112 | 33 | 'Exclude from VAT registries'), | ||
113 | 34 | 'base_tax_ids': fields.one2many( | ||
114 | 35 | 'account.tax', 'base_code_id', 'Base Taxes'), # serve ancora? | ||
116 | 36 | } | 30 | } |
117 | 37 | _sql_constraints = [ | ||
118 | 38 | ('name_uniq', 'UNIQUE(name)', 'The tax name must be unique!'), | ||
119 | 39 | ] | ||
120 | 40 | |||
121 | 41 | def get_account_tax(self, inv_tax): | ||
122 | 42 | if inv_tax.tax_code_id: | ||
123 | 43 | return self.get_account_tax_by_tax_code(inv_tax.tax_code_id) | ||
124 | 44 | if inv_tax.base_code_id: | ||
125 | 45 | return self.get_account_tax_by_base_code(inv_tax.base_code_id) | ||
126 | 46 | raise osv.except_osv(_('Error'), | ||
127 | 47 | _('No tax codes for invoice tax %s') % str(inv_tax.name)) | ||
128 | 48 | |||
129 | 49 | 31 | ||
130 | === modified file 'l10n_it_vat_registries/account_view.xml' | |||
131 | --- l10n_it_vat_registries/account_view.xml 2011-08-19 13:08:24 +0000 | |||
132 | +++ l10n_it_vat_registries/account_view.xml 2013-05-23 04:44:28 +0000 | |||
133 | @@ -1,17 +1,16 @@ | |||
135 | 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0"?> |
136 | 2 | <openerp> | 2 | <openerp> |
137 | 3 | <data> | 3 | <data> |
144 | 4 | 4 | <record id="view_tax_code_form" model="ir.ui.view"> | |
145 | 5 | <record id="view_tax_form" model="ir.ui.view"> | 5 | <field name="name">account.tax.code.form</field> |
146 | 6 | <field name="name">account.tax.form</field> | 6 | <field name="model">account.tax.code</field> |
147 | 7 | <field name="model">account.tax</field> | 7 | <field name="inherit_id" ref="account.view_tax_code_form"></field> |
142 | 8 | <field name="type">form</field> | ||
143 | 9 | <field name="inherit_id" ref="account.view_tax_form"></field> | ||
148 | 10 | <field name="arch" type="xml"> | 8 | <field name="arch" type="xml"> |
151 | 11 | <field name="active" position="after"> | 9 | <field name="sign" position="after"> |
152 | 12 | <field name="exclude_from_registries"/> | 10 | <field name="is_base"/> |
153 | 13 | </field> | 11 | </field> |
154 | 14 | </field> | 12 | </field> |
155 | 15 | </record> | 13 | </record> |
156 | 16 | </data> | 14 | </data> |
157 | 17 | </openerp> | 15 | </openerp> |
158 | 16 | |||
159 | 18 | 17 | ||
160 | === modified file 'l10n_it_vat_registries/invoice.py' | |||
161 | --- l10n_it_vat_registries/invoice.py 2013-01-04 14:02:10 +0000 | |||
162 | +++ l10n_it_vat_registries/invoice.py 2013-05-23 04:44:28 +0000 | |||
163 | @@ -1,8 +1,8 @@ | |||
164 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
165 | 2 | ############################################################################## | 2 | ############################################################################## |
169 | 3 | # | 3 | # |
170 | 4 | # Copyright (C) 2011 Associazione OpenERP Italia | 4 | # Copyright (C) 2011-2013 Associazione OpenERP Italia |
171 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
172 | 6 | # | 6 | # |
173 | 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 |
174 | 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 |
175 | @@ -22,325 +22,123 @@ | |||
176 | 22 | import time | 22 | import time |
177 | 23 | from report import report_sxw | 23 | from report import report_sxw |
178 | 24 | from tools.translate import _ | 24 | from tools.translate import _ |
181 | 25 | from decimal import * | 25 | import logging |
182 | 26 | import netsvc | 26 | from datetime import datetime |
183 | 27 | |||
184 | 28 | _logger = logging.getLogger(__name__) | ||
185 | 27 | 29 | ||
186 | 28 | class Parser(report_sxw.rml_parse): | 30 | class Parser(report_sxw.rml_parse): |
241 | 29 | 31 | ||
242 | 30 | logger = netsvc.Logger() | 32 | def _tax_amounts_by_code(self, move): |
243 | 31 | 33 | res={} | |
244 | 32 | def _get_partner_type(self, move_line): | 34 | for move_line in move.line_id: |
245 | 33 | partner_type = '' | 35 | if move_line.tax_code_id and move_line.tax_amount: |
246 | 34 | for line in move_line.move_id.line_id: | 36 | if not res.get(move_line.tax_code_id.id): |
247 | 35 | if line.account_id.type == 'payable' or line.account_id.type == 'receivable': | 37 | res[move_line.tax_code_id.id] = 0.0 |
248 | 36 | if not partner_type: | 38 | self.localcontext['used_tax_codes'][move_line.tax_code_id.id] = True |
249 | 37 | partner_type = line.account_id.type | 39 | res[move_line.tax_code_id.id] += (move_line.tax_amount |
250 | 38 | elif partner_type != line.account_id.type: | 40 | * self.localcontext['data']['tax_sign']) |
251 | 39 | raise Exception( | 41 | return res |
198 | 40 | _('The move %s has different partner account type') % move_line.move_id.name) | ||
199 | 41 | return partner_type | ||
200 | 42 | |||
201 | 43 | def _move_total(self, move_line): | ||
202 | 44 | partner_type = self._get_partner_type(move_line) | ||
203 | 45 | total = 0.0 | ||
204 | 46 | for line in move_line.move_id.line_id: | ||
205 | 47 | if line.account_id.type == partner_type: | ||
206 | 48 | total += (line.debit or line.credit) | ||
207 | 49 | return total | ||
208 | 50 | |||
209 | 51 | # Metto al tax code il segno dell'importo dell'imposta. | ||
210 | 52 | # Il tax code ha l'importo in valuta base, ma ha segno negativo per l'IVA a credito (da stampare positiva) | ||
211 | 53 | # e per le note di credito (da stampare negative) | ||
212 | 54 | def _get_amount_with_sign(self, tax_code_amount, amount): | ||
213 | 55 | return abs(tax_code_amount) * cmp(amount, 0) | ||
214 | 56 | |||
215 | 57 | def _is_refund(self, move_line): | ||
216 | 58 | if self._get_partner_type(move_line) == 'receivable' and move_line.debit > move_line.credit: | ||
217 | 59 | return True | ||
218 | 60 | if self._get_partner_type(move_line) == 'payable' and move_line.debit < move_line.credit: | ||
219 | 61 | return True | ||
220 | 62 | |||
221 | 63 | def _get_line_amount_with_sign(self, move_line): | ||
222 | 64 | if self._get_partner_type(move_line) == 'receivable': | ||
223 | 65 | return self._get_amount_with_sign(move_line.tax_amount, move_line.credit - move_line.debit) | ||
224 | 66 | if self._get_partner_type(move_line) == 'payable': | ||
225 | 67 | return self._get_amount_with_sign(move_line.tax_amount, move_line.debit - move_line.credit) | ||
226 | 68 | |||
227 | 69 | # in valuta base | ||
228 | 70 | def _get_invoice_amount_total(self, invoice): | ||
229 | 71 | total = 0.0 | ||
230 | 72 | for inv_tax in invoice.tax_line: | ||
231 | 73 | total += self._get_amount_with_sign(inv_tax.base_amount, inv_tax.base) \ | ||
232 | 74 | + self._get_amount_with_sign(inv_tax.tax_amount, inv_tax.amount) | ||
233 | 75 | return total | ||
234 | 76 | |||
235 | 77 | # in valuta base | ||
236 | 78 | def _get_invoice_amount_untaxed(self, invoice): | ||
237 | 79 | total = 0.0 | ||
238 | 80 | for inv_tax in invoice.tax_line: | ||
239 | 81 | total += self._get_amount_with_sign(inv_tax.base_amount, inv_tax.base) | ||
240 | 82 | return total | ||
252 | 83 | 42 | ||
253 | 84 | def _get_tax_lines(self, move): | 43 | def _get_tax_lines(self, move): |
254 | 85 | res=[] | 44 | res=[] |
258 | 86 | tax_obj = self.pool.get('account.tax') | 45 | tax_code_obj=self.pool.get('account.tax.code') |
256 | 87 | cur_pool = self.pool.get('res.currency') | ||
257 | 88 | inv_pool = self.pool.get('account.invoice') | ||
259 | 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 |
260 | 90 | index=0 | 47 | index=0 |
368 | 91 | totale_iva = 0.0 | 48 | invoice = False |
369 | 92 | totale_iva_inded = 0.0 | 49 | for move_line in move.line_id: |
370 | 93 | invoice_amount_total = 0.0 | 50 | if move_line.invoice: |
371 | 94 | invoice_amount_untaxed = 0.0 | 51 | if invoice and invoice.id != move_line.invoice.id: |
372 | 95 | related_invoices = [] | 52 | raise Exception(_("Move %s contains different invoices") % move.name) |
373 | 96 | 53 | invoice = move_line.invoice | |
374 | 97 | ''' riusciamo a essere sempre indipendenti dalle fatture? | 54 | amounts_by_code = self._tax_amounts_by_code(move) |
375 | 98 | # se c'è l'oggetto fattura, utilizzo il calcolo su fattura | 55 | for tax_code_id in amounts_by_code: |
376 | 99 | for move_line in move.line_id: | 56 | tax_code = tax_code_obj.browse(self.cr, self.uid, tax_code_id) |
377 | 100 | if move_line.invoice and move_line.invoice.id not in related_invoices: | 57 | tax_item = { |
378 | 101 | related_invoices.append(move_line.invoice.id) | 58 | 'tax_code_name': tax_code.name, |
379 | 102 | ''' | 59 | 'amount': amounts_by_code[tax_code_id], |
380 | 103 | 60 | 'index': index, | |
381 | 104 | if related_invoices: | 61 | 'invoice_date': (invoice and invoice.date_invoice |
382 | 105 | for invoice_id in related_invoices: | 62 | or move.date or ''), |
383 | 106 | return self._get_tax_lines_by_invoice(inv_pool.browse(self.cr, self.uid, invoice_id)) | 63 | 'reference': (invoice and invoice.reference or '') |
384 | 107 | 64 | } | |
385 | 108 | for move_line in move.line_id: | 65 | res.append(tax_item) |
386 | 109 | tax_item = {} | 66 | index += 1 |
387 | 110 | if move_line.tax_code_id and move_line.tax_code_id.tax_ids: | 67 | return res |
388 | 111 | # Nel wizard ho già controllato che le eventuali diverse | 68 | |
389 | 112 | # imposte abbiamo la stessa aliquota. | 69 | def build_parent_tax_codes(self, tax_code): |
390 | 113 | # Le diverse imposte devono comunque usare gli stessi tax code | 70 | res={} |
391 | 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: |
392 | 115 | if main_tax.exclude_from_registries: | 72 | res[tax_code.parent_id.id]=True |
393 | 116 | self.logger.notifyChannel("l10n_it_vat_registries", netsvc.LOG_INFO, | 73 | res.update(self.build_parent_tax_codes(tax_code.parent_id)) |
394 | 117 | _('The tax %s is excluded from registries') % main_tax.name) | 74 | return res |
395 | 118 | continue | 75 | |
396 | 119 | # sommo gli imponibili relativi all'imposta corrente | 76 | def _compute_totals(self, tax_code_ids): |
290 | 120 | base_amount = 0.0 | ||
291 | 121 | for line in move_line.move_id.line_id: | ||
292 | 122 | if line.tax_code_id.id == main_tax.base_code_id.id: | ||
293 | 123 | base_amount += self._get_line_amount_with_sign(line) | ||
294 | 124 | # calcolo % indetraibile | ||
295 | 125 | actual_tax_amount = base_amount * main_tax.amount | ||
296 | 126 | actual_tax_amount = cur_pool.round( | ||
297 | 127 | self.cr, self.uid, move.company_id.currency_id, | ||
298 | 128 | actual_tax_amount) | ||
299 | 129 | non_deductible = 0.0 | ||
300 | 130 | if abs(actual_tax_amount) != abs(move_line.tax_amount): | ||
301 | 131 | non_deductible = 100 | ||
302 | 132 | if move_line.tax_amount: | ||
303 | 133 | non_deductible = 100 - abs(( | ||
304 | 134 | move_line.tax_amount * 100.0) / actual_tax_amount) | ||
305 | 135 | non_deductible = cur_pool.round( | ||
306 | 136 | self.cr, self.uid, move.company_id.currency_id, | ||
307 | 137 | non_deductible) | ||
308 | 138 | # calcolo il totale dell'operazione | ||
309 | 139 | invoice_amount_total = self._move_total(move_line) | ||
310 | 140 | if self._is_refund(move_line): | ||
311 | 141 | invoice_amount_total = - invoice_amount_total | ||
312 | 142 | str_non_deductible = str(non_deductible).split('.')[0] | ||
313 | 143 | tax_item = { | ||
314 | 144 | 'tax_percentage': main_tax.amount and str( | ||
315 | 145 | main_tax.amount * 100).split('.')[0] or | ||
316 | 146 | move_line.tax_code_id.name, | ||
317 | 147 | 'tax_code_name': move_line.tax_code_id.name, | ||
318 | 148 | 'base': base_amount, | ||
319 | 149 | 'amount': actual_tax_amount, | ||
320 | 150 | 'non_deductible': str_non_deductible != '0' and | ||
321 | 151 | str_non_deductible or '', | ||
322 | 152 | 'index': index, | ||
323 | 153 | 'amount_total': invoice_amount_total, | ||
324 | 154 | } | ||
325 | 155 | res.append(tax_item) | ||
326 | 156 | iva = cur_pool.round( | ||
327 | 157 | self.cr, self.uid, move.company_id.currency_id, | ||
328 | 158 | (actual_tax_amount * (100 - non_deductible) * 0.01)) | ||
329 | 159 | iva_inded = cur_pool.round( | ||
330 | 160 | self.cr, self.uid, move.company_id.currency_id, | ||
331 | 161 | (actual_tax_amount * non_deductible * 0.01)) | ||
332 | 162 | tax_difference= (iva + iva_inded) - actual_tax_amount | ||
333 | 163 | # se risulta un'eccedenza, la tolgo dalla parte detraibile | ||
334 | 164 | if tax_difference > 0: | ||
335 | 165 | iva = iva - tax_difference | ||
336 | 166 | # se risulta una mancanza, la aggiungo alla parte indetraibile | ||
337 | 167 | elif tax_difference < 0: | ||
338 | 168 | iva_inded = iva_inded + tax_difference | ||
339 | 169 | totale_iva += iva | ||
340 | 170 | invoice_amount_untaxed += base_amount | ||
341 | 171 | totale_iva_inded += iva_inded | ||
342 | 172 | index += 1 | ||
343 | 173 | |||
344 | 174 | if tax_item: | ||
345 | 175 | if tax_item['tax_code_name'] not in self.localcontext[ | ||
346 | 176 | 'tax_codes']: | ||
347 | 177 | self.localcontext['tax_codes'][tax_item[ | ||
348 | 178 | 'tax_code_name']] = { | ||
349 | 179 | 'base': tax_item['base'], | ||
350 | 180 | 'amount': tax_item['amount'], | ||
351 | 181 | } | ||
352 | 182 | else: | ||
353 | 183 | self.localcontext['tax_codes'][tax_item[ | ||
354 | 184 | 'tax_code_name']]['base'] += tax_item['base'] | ||
355 | 185 | self.localcontext['tax_codes'][tax_item[ | ||
356 | 186 | 'tax_code_name']]['amount'] += tax_item['amount'] | ||
357 | 187 | |||
358 | 188 | self.localcontext['totali'][ | ||
359 | 189 | 'totale_operazioni'] += invoice_amount_total | ||
360 | 190 | self.localcontext['totali'][ | ||
361 | 191 | 'totale_imponibili'] += invoice_amount_untaxed | ||
362 | 192 | self.localcontext['totali']['totale_iva'] += totale_iva | ||
363 | 193 | self.localcontext['totali']['totale_iva_inded'] += totale_iva_inded | ||
364 | 194 | |||
365 | 195 | return res | ||
366 | 196 | |||
367 | 197 | def _get_tax_lines_by_invoice(self, invoice): | ||
397 | 198 | res=[] | 77 | res=[] |
526 | 199 | tax_obj = self.pool.get('account.tax') | 78 | res_dict={} |
527 | 200 | # 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') |
528 | 201 | index = 0 | 80 | for period_id in self.localcontext['data']['period_ids']: |
529 | 202 | totale_iva = 0.0 | 81 | for tax_code in tax_code_obj.browse(self.cr, self.uid, |
530 | 203 | totale_iva_inded = 0.0 | 82 | tax_code_ids, context={ |
531 | 204 | invoice_amount_total = 0.0 | 83 | 'period_id': period_id, |
532 | 205 | invoice_amount_untaxed = 0.0 | 84 | }): |
533 | 206 | for inv_tax in invoice.tax_line: | 85 | if not res_dict.get(tax_code.id): |
534 | 207 | tax_item = {} | 86 | res_dict[tax_code.id] = 0.0 |
535 | 208 | if inv_tax.base_code_id and inv_tax.tax_code_id: | 87 | res_dict[tax_code.id] += (tax_code.sum_period |
536 | 209 | account_tax = tax_obj.get_account_tax(inv_tax) | 88 | * self.localcontext['data']['tax_sign']) |
537 | 210 | if account_tax.exclude_from_registries: | 89 | for tax_code_id in res_dict: |
538 | 211 | self.logger.notifyChannel("l10n_it_vat_registries", | 90 | tax_code = tax_code_obj.browse(self.cr, self.uid, tax_code_id) |
539 | 212 | netsvc.LOG_INFO, _( | 91 | if res_dict[tax_code_id]: |
540 | 213 | 'The tax %s is excluded from registries') | 92 | res.append((tax_code.name,res_dict[tax_code_id],tax_code.is_base)) |
413 | 214 | % account_tax.name) | ||
414 | 215 | continue | ||
415 | 216 | account_tax_amount = account_tax.amount | ||
416 | 217 | invoice_amount_total = self._get_invoice_amount_total(invoice) | ||
417 | 218 | invoice_amount_untaxed = self._get_invoice_amount_untaxed( | ||
418 | 219 | invoice) | ||
419 | 220 | amount = self._get_amount_with_sign(inv_tax.tax_amount, | ||
420 | 221 | inv_tax.amount) | ||
421 | 222 | base = self._get_amount_with_sign(inv_tax.base_amount, | ||
422 | 223 | inv_tax.base) | ||
423 | 224 | # calcolo le note di credito con segno invertito | ||
424 | 225 | if invoice.type in ('in_refund', 'out_refund'): | ||
425 | 226 | amount = -amount | ||
426 | 227 | base = -base | ||
427 | 228 | invoice_amount_untaxed = -invoice_amount_untaxed | ||
428 | 229 | invoice_amount_total = -invoice_amount_total | ||
429 | 230 | tax_item = { | ||
430 | 231 | 'tax_percentage': account_tax_amount and str( | ||
431 | 232 | account_tax_amount * 100).split('.')[0] or | ||
432 | 233 | inv_tax.tax_code_id.name, | ||
433 | 234 | 'base': base, | ||
434 | 235 | 'amount': amount, # in valuta base | ||
435 | 236 | 'non_deductible': 0.0, | ||
436 | 237 | 'index': index, | ||
437 | 238 | 'amount_total': invoice_amount_total, | ||
438 | 239 | } | ||
439 | 240 | res.append(tax_item) | ||
440 | 241 | totale_iva += amount | ||
441 | 242 | index += 1 | ||
442 | 243 | # Se non c'è il tax code imponibile, cerco la tassa relativa alla parte non deducibile | ||
443 | 244 | elif inv_tax.tax_code_id: | ||
444 | 245 | tax = tax_obj.get_main_tax(tax_obj.get_account_tax(inv_tax)) | ||
445 | 246 | if tax.exclude_from_registries: | ||
446 | 247 | self.logger.notifyChannel("l10n_it_vat_registries", | ||
447 | 248 | netsvc.LOG_INFO, | ||
448 | 249 | _('The tax %s is excluded from registries') % tax.name) | ||
449 | 250 | continue | ||
450 | 251 | for inv_tax_2 in invoice.tax_line: | ||
451 | 252 | if inv_tax_2.base_code_id and not inv_tax_2.tax_code_id: | ||
452 | 253 | base_tax = tax_obj.get_main_tax( | ||
453 | 254 | tax_obj.get_account_tax(inv_tax_2)) | ||
454 | 255 | # Se hanno la stessa tassa | ||
455 | 256 | if base_tax.id == tax.id: | ||
456 | 257 | # Uso il valore assoluto perchè riferendosi | ||
457 | 258 | # alla stessa imposta non ci possono essere | ||
458 | 259 | # segni differenti | ||
459 | 260 | non_deductible = (abs(inv_tax_2.base_amount) / | ||
460 | 261 | (abs(inv_tax.base_amount) + abs( | ||
461 | 262 | inv_tax_2.base_amount)) * 100) | ||
462 | 263 | invoice_amount_total = \ | ||
463 | 264 | self._get_invoice_amount_total(invoice) | ||
464 | 265 | invoice_amount_untaxed = \ | ||
465 | 266 | self._get_invoice_amount_untaxed(invoice) | ||
466 | 267 | amount = self._get_amount_with_sign( | ||
467 | 268 | inv_tax.tax_amount, inv_tax.amount) | ||
468 | 269 | base = self._get_amount_with_sign( | ||
469 | 270 | inv_tax.base_amount, inv_tax.base) | ||
470 | 271 | amount2 = self._get_amount_with_sign( | ||
471 | 272 | inv_tax_2.tax_amount, inv_tax_2.amount) | ||
472 | 273 | base2 = self._get_amount_with_sign( | ||
473 | 274 | inv_tax_2.base_amount, inv_tax_2.base) | ||
474 | 275 | # calcolo le note di credito con segno invertito | ||
475 | 276 | if invoice.type in ('in_refund', 'out_refund'): | ||
476 | 277 | amount = -amount | ||
477 | 278 | base = -base | ||
478 | 279 | amount2 = -amount2 | ||
479 | 280 | base2 = -base2 | ||
480 | 281 | invoice_amount_untaxed = \ | ||
481 | 282 | -invoice_amount_untaxed | ||
482 | 283 | invoice_amount_total = -invoice_amount_total | ||
483 | 284 | tax_item = { | ||
484 | 285 | 'tax_percentage': base_tax.amount and str( | ||
485 | 286 | base_tax.amount * 100).split('.')[0] or | ||
486 | 287 | inv_tax.tax_code_id.name, | ||
487 | 288 | 'base': base + base2, | ||
488 | 289 | 'amount': amount + amount2, | ||
489 | 290 | 'non_deductible': non_deductible and str( | ||
490 | 291 | non_deductible).split('.')[0] or '', | ||
491 | 292 | 'index': index, | ||
492 | 293 | 'amount_total': invoice_amount_total, | ||
493 | 294 | } | ||
494 | 295 | res.append(tax_item) | ||
495 | 296 | totale_iva += amount | ||
496 | 297 | totale_iva_inded += amount2 | ||
497 | 298 | index += 1 | ||
498 | 299 | break | ||
499 | 300 | elif not inv_tax.tax_code_id and not inv_tax.base_code_id: | ||
500 | 301 | self.logger.notifyChannel("l10n_it_vat_registries", | ||
501 | 302 | netsvc.LOG_INFO, | ||
502 | 303 | _('The tax %s has no tax codes') % inv_tax.name) | ||
503 | 304 | continue | ||
504 | 305 | if tax_item: | ||
505 | 306 | if tax_item['tax_percentage'] not in self.localcontext[ | ||
506 | 307 | 'tax_codes']: | ||
507 | 308 | self.localcontext['tax_codes'][tax_item[ | ||
508 | 309 | 'tax_percentage']] = { | ||
509 | 310 | 'base': tax_item['base'], | ||
510 | 311 | 'amount': tax_item['amount'], | ||
511 | 312 | } | ||
512 | 313 | else: | ||
513 | 314 | self.localcontext['tax_codes'][tax_item[ | ||
514 | 315 | 'tax_percentage']]['base'] += tax_item['base'] | ||
515 | 316 | self.localcontext['tax_codes'][tax_item[ | ||
516 | 317 | 'tax_percentage']]['amount'] += tax_item['amount'] | ||
517 | 318 | |||
518 | 319 | self.localcontext['totali'][ | ||
519 | 320 | 'totale_operazioni'] += invoice_amount_total | ||
520 | 321 | self.localcontext['totali'][ | ||
521 | 322 | 'totale_imponibili'] += invoice_amount_untaxed | ||
522 | 323 | # da analizzare self.totale_variazioni += invoice.amount_total | ||
523 | 324 | self.localcontext['totali']['totale_iva'] += totale_iva | ||
524 | 325 | self.localcontext['totali']['totale_iva_inded'] += totale_iva_inded | ||
525 | 326 | |||
541 | 327 | return res | 93 | return res |
542 | 94 | |||
543 | 95 | def _get_tax_codes(self): | ||
544 | 96 | return self._compute_totals(self.localcontext['used_tax_codes'].keys()) | ||
545 | 97 | |||
546 | 98 | def _get_tax_codes_totals(self): | ||
547 | 99 | parent_codes = {} | ||
548 | 100 | tax_code_obj = self.pool.get('account.tax.code') | ||
549 | 101 | for tax_code in tax_code_obj.browse(self.cr, self.uid, | ||
550 | 102 | self.localcontext['used_tax_codes'].keys()): | ||
551 | 103 | parent_codes.update(self.build_parent_tax_codes(tax_code)) | ||
552 | 104 | return self._compute_totals(parent_codes.keys()) | ||
553 | 105 | |||
554 | 106 | def _get_start_date(self): | ||
555 | 107 | period_obj = self.pool.get('account.period') | ||
556 | 108 | start_date = False | ||
557 | 109 | for period in period_obj.browse(self.cr,self.uid, | ||
558 | 110 | self.localcontext['data']['period_ids']): | ||
559 | 111 | period_start = datetime.strptime(period.date_start, '%Y-%m-%d') | ||
560 | 112 | if not start_date or start_date > period_start: | ||
561 | 113 | start_date = period_start | ||
562 | 114 | return start_date.strftime('%Y-%m-%d') | ||
563 | 115 | |||
564 | 116 | def _get_end_date(self): | ||
565 | 117 | period_obj = self.pool.get('account.period') | ||
566 | 118 | end_date = False | ||
567 | 119 | for period in period_obj.browse(self.cr,self.uid, | ||
568 | 120 | self.localcontext['data']['period_ids']): | ||
569 | 121 | period_end = datetime.strptime(period.date_stop, '%Y-%m-%d') | ||
570 | 122 | if not end_date or end_date < period_end: | ||
571 | 123 | end_date = period_end | ||
572 | 124 | return end_date.strftime('%Y-%m-%d') | ||
573 | 328 | 125 | ||
574 | 329 | def __init__(self, cr, uid, name, context): | 126 | def __init__(self, cr, uid, name, context): |
575 | 330 | super(Parser, self).__init__(cr, uid, name, context) | 127 | super(Parser, self).__init__(cr, uid, name, context) |
576 | 331 | self.localcontext.update({ | 128 | self.localcontext.update({ |
577 | 332 | 'time': time, | ||
578 | 333 | 'tax_lines': self._get_tax_lines, | 129 | 'tax_lines': self._get_tax_lines, |
587 | 334 | 'totali': { | 130 | 'tax_codes': self._get_tax_codes, |
588 | 335 | 'totale_operazioni': 0.0, | 131 | 'tax_codes_totals': self._get_tax_codes_totals, |
589 | 336 | 'totale_imponibili': 0.0, | 132 | 'used_tax_codes': {}, |
590 | 337 | 'totale_variazioni': 0.0, | 133 | 'start_date': self._get_start_date, |
591 | 338 | 'totale_iva': 0.0, | 134 | 'end_date': self._get_end_date, |
584 | 339 | 'totale_iva_inded': 0.0, | ||
585 | 340 | }, | ||
586 | 341 | 'tax_codes': {}, | ||
592 | 342 | }) | 135 | }) |
593 | 343 | 136 | ||
594 | 137 | def set_context(self, objects, data, ids, report_type=None): | ||
595 | 138 | self.localcontext.update({ | ||
596 | 139 | 'fiscal_page_base': data.get('fiscal_page_base'), | ||
597 | 140 | }) | ||
598 | 141 | return super(Parser, self).set_context(objects, data, ids, report_type=report_type) | ||
599 | 344 | 142 | ||
600 | 345 | report_sxw.report_sxw('report.registro_iva_vendite', | 143 | report_sxw.report_sxw('report.registro_iva_vendite', |
601 | 346 | 'registro_iva_vendite', | 144 | 'registro_iva_vendite', |
602 | 347 | 145 | ||
603 | === modified file 'l10n_it_vat_registries/reports.xml' | |||
604 | --- l10n_it_vat_registries/reports.xml 2012-08-16 08:50:00 +0000 | |||
605 | +++ l10n_it_vat_registries/reports.xml 2013-05-23 04:44:28 +0000 | |||
606 | @@ -57,7 +57,11 @@ | |||
607 | 57 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; | 57 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; |
608 | 58 | for(var i in x) { | 58 | for(var i in x) { |
609 | 59 | var y = document.getElementsByClassName(x[i]); | 59 | var y = document.getElementsByClassName(x[i]); |
611 | 60 | for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; | 60 | for(var j=0; j<y.length; ++j) { |
612 | 61 | if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};} | ||
613 | 62 | else{y[j].textContent = vars[x[i]];} | ||
614 | 63 | } | ||
615 | 64 | |||
616 | 61 | } | 65 | } |
617 | 62 | } | 66 | } |
618 | 63 | </script> | 67 | </script> |
619 | @@ -135,7 +139,11 @@ | |||
620 | 135 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; | 139 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; |
621 | 136 | for(var i in x) { | 140 | for(var i in x) { |
622 | 137 | var y = document.getElementsByClassName(x[i]); | 141 | var y = document.getElementsByClassName(x[i]); |
624 | 138 | for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; | 142 | for(var j=0; j<y.length; ++j) { |
625 | 143 | if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};} | ||
626 | 144 | else{y[j].textContent = vars[x[i]];} | ||
627 | 145 | } | ||
628 | 146 | |||
629 | 139 | } | 147 | } |
630 | 140 | } | 148 | } |
631 | 141 | </script> | 149 | </script> |
632 | @@ -213,7 +221,11 @@ | |||
633 | 213 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; | 221 | var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; |
634 | 214 | for(var i in x) { | 222 | for(var i in x) { |
635 | 215 | var y = document.getElementsByClassName(x[i]); | 223 | var y = document.getElementsByClassName(x[i]); |
637 | 216 | for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; | 224 | for(var j=0; j<y.length; ++j) { |
638 | 225 | if(x[i] == 'page') {y[j].textContent = eval(vars[x[i]]) + ${fiscal_page_base};} | ||
639 | 226 | else{y[j].textContent = vars[x[i]];} | ||
640 | 227 | } | ||
641 | 228 | |||
642 | 217 | } | 229 | } |
643 | 218 | } | 230 | } |
644 | 219 | </script> | 231 | </script> |
645 | 220 | 232 | ||
646 | === modified file 'l10n_it_vat_registries/templates/registro_iva_acquisti.mako' | |||
647 | --- l10n_it_vat_registries/templates/registro_iva_acquisti.mako 2012-08-16 09:25:37 +0000 | |||
648 | +++ l10n_it_vat_registries/templates/registro_iva_acquisti.mako 2013-05-23 04:44:28 +0000 | |||
649 | @@ -19,20 +19,19 @@ | |||
650 | 19 | <body> | 19 | <body> |
651 | 20 | <h2>Fatture Ricevute</h2> | 20 | <h2>Fatture Ricevute</h2> |
652 | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> |
654 | 22 | <table style="width:100%;" cellspacing="0"> | 22 | <table style="width:100%; font-size: small;" cellspacing="0"> |
655 | 23 | <thead> | 23 | <thead> |
656 | 24 | <tr> | 24 | <tr> |
657 | 25 | <th class="left_without_line">Data registrazione</th> | 25 | <th class="left_without_line">Data registrazione</th> |
658 | 26 | <th class="left_without_line">Numero</th> | 26 | <th class="left_without_line">Numero</th> |
659 | 27 | <th class="left_without_line">Ragione sociale</th> | 27 | <th class="left_without_line">Ragione sociale</th> |
660 | 28 | <th class="left_without_line">Numero registrazione</th> | ||
661 | 28 | <th class="left_without_line">Numero fattura</th> | 29 | <th class="left_without_line">Numero fattura</th> |
662 | 29 | <th class="left_without_line">Data fattura</th> | 30 | <th class="left_without_line">Data fattura</th> |
664 | 30 | <th class="left_without_line">Causale</th> | 31 | <th class="left_without_line">Sezionale</th> |
665 | 31 | <th class="right_without_line">Totale fattura</th> | 32 | <th class="right_without_line">Totale fattura</th> |
666 | 32 | <th class="right_without_line">Imponibile</th> | ||
667 | 33 | <th class="right_without_line">% IVA</th> | ||
668 | 34 | <th class="right_without_line">Imposta</th> | 33 | <th class="right_without_line">Imposta</th> |
670 | 35 | <th class="right_without_line">% inded.</th> | 34 | <th class="right_without_line">Importo</th> |
671 | 36 | <th></th> | 35 | <th></th> |
672 | 37 | </tr> | 36 | </tr> |
673 | 38 | </thead> | 37 | </thead> |
674 | @@ -63,7 +62,7 @@ | |||
675 | 63 | </td><td class="left_without_line"> | 62 | </td><td class="left_without_line"> |
676 | 64 | %endif | 63 | %endif |
677 | 65 | %if line['index']==0: | 64 | %if line['index']==0: |
679 | 66 | ${object.partner_id.name or ''| entity} | 65 | ${object.partner_id.name or ''| entity} |
680 | 67 | %endif | 66 | %endif |
681 | 68 | %if line['index']==0: | 67 | %if line['index']==0: |
682 | 69 | </td><td class="left_with_line"> | 68 | </td><td class="left_with_line"> |
683 | @@ -79,19 +78,23 @@ | |||
684 | 79 | </td><td class="left_without_line"> | 78 | </td><td class="left_without_line"> |
685 | 80 | %endif | 79 | %endif |
686 | 81 | %if line['index']==0: | 80 | %if line['index']==0: |
700 | 82 | ${ formatLang(object.date,date=True) or '' | entity} | 81 | ${ line['reference'] or '' | entity} |
701 | 83 | %endif | 82 | %endif |
702 | 84 | %if line['index']==0: | 83 | %if line['index']==0: |
703 | 85 | </td><td class="left_with_line"> | 84 | </td><td class="left_with_line"> |
704 | 86 | %else: | 85 | %else: |
705 | 87 | </td><td class="left_without_line"> | 86 | </td><td class="left_without_line"> |
706 | 88 | %endif | 87 | %endif |
707 | 89 | %if line['index']==0: | 88 | %if line['index']==0: |
708 | 90 | %if line['amount_total'] >= 0: | 89 | ${ formatLang(line['invoice_date'],date=True) or '' | entity} |
709 | 91 | Fattura | 90 | %endif |
710 | 92 | %else: | 91 | %if line['index']==0: |
711 | 93 | Nota di credito | 92 | </td><td class="left_with_line"> |
712 | 94 | %endif | 93 | %else: |
713 | 94 | </td><td class="left_without_line"> | ||
714 | 95 | %endif | ||
715 | 96 | %if line['index']==0: | ||
716 | 97 | ${object.journal_id.name or ''| entity} | ||
717 | 95 | %endif | 98 | %endif |
718 | 96 | %if line['index']==0: | 99 | %if line['index']==0: |
719 | 97 | </td><td class="right_with_line"> | 100 | </td><td class="right_with_line"> |
720 | @@ -99,34 +102,19 @@ | |||
721 | 99 | </td><td class="right_without_line"> | 102 | </td><td class="right_without_line"> |
722 | 100 | %endif | 103 | %endif |
723 | 101 | %if line['index']==0: | 104 | %if line['index']==0: |
752 | 102 | ${ formatLang(line['amount_total']) | entity} | 105 | ${ formatLang(object.amount) | entity} |
753 | 103 | %endif | 106 | %endif |
754 | 104 | </td> | 107 | </td> |
755 | 105 | %if line['index']==0: | 108 | %if line['index']==0: |
756 | 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> |
757 | 107 | %else: | 110 | %else: |
758 | 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> |
759 | 109 | %endif | 112 | %endif |
760 | 110 | %if line['index']==0: | 113 | %if line['index']==0: |
761 | 111 | <td class="right_with_line">${ line['tax_percentage'] or ''| entity}</td> | 114 | <td class="right_with_line">${ formatLang(line['amount'])| entity}</td> |
762 | 112 | %else: | 115 | %else: |
763 | 113 | <td class="right_without_line">${ line['tax_percentage'] or ''| entity}</td> | 116 | <td class="right_without_line">${ formatLang(line['amount'])| entity}</td> |
764 | 114 | %endif | 117 | %endif |
737 | 115 | %if line['index']==0: | ||
738 | 116 | <td class="right_with_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
739 | 117 | %else: | ||
740 | 118 | <td class="right_without_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
741 | 119 | %endif | ||
742 | 120 | %if line['index']==0: | ||
743 | 121 | <td class="right_with_line"> | ||
744 | 122 | %else: | ||
745 | 123 | <td class="right_without_line"> | ||
746 | 124 | %endif | ||
747 | 125 | %if line['non_deductible']: | ||
748 | 126 | ${ line['non_deductible'] | entity} % | ||
749 | 127 | %endif | ||
750 | 128 | </td> | ||
751 | 129 | <td></td> | ||
765 | 130 | </tr> | 118 | </tr> |
766 | 131 | %endfor | 119 | %endfor |
767 | 132 | %endfor | 120 | %endfor |
768 | @@ -134,34 +122,87 @@ | |||
769 | 134 | </table> | 122 | </table> |
770 | 135 | <div style="page-break-inside: avoid;"> | 123 | <div style="page-break-inside: avoid;"> |
771 | 136 | <br/> | 124 | <br/> |
772 | 125 | <% tax_code_list = tax_codes() %> | ||
773 | 126 | <% tax_code_totals_list = tax_codes_totals() %> | ||
774 | 137 | <table style="width:100%; " border="1"> | 127 | <table style="width:100%; " border="1"> |
775 | 138 | <tr style="border-style:ridge;border-width:5px"> | 128 | <tr style="border-style:ridge;border-width:5px"> |
802 | 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> |
803 | 140 | </tr> | 130 | </tr> |
804 | 141 | <tr> | 131 | <tr> |
805 | 142 | <td rowspan="2" style="vertical-align:text-top;padding:10"> | 132 | <td colspan="2" style="vertical-align:text-top;padding:10"> |
806 | 143 | <table style="width:100%;"> | 133 | <h3>Dettaglio</h3> |
807 | 144 | <tr> | 134 | <table style="width:100%;"> |
808 | 145 | <th style="text-align:left">Descrizione</th> | 135 | <tr> |
809 | 146 | <th style="text-align:right">Imponibile</th> | 136 | <th style="text-align:left">Descrizione</th> |
810 | 147 | <th style="text-align:right">Imposta</th> | 137 | <th style="text-align:right">Importo</th> |
811 | 148 | </tr> | 138 | </tr> |
812 | 149 | %for tax_code in tax_codes : | 139 | %for tax_code_tuple in tax_code_list : |
813 | 150 | <tr> | 140 | % if not tax_code_tuple[2]: |
814 | 151 | <td>${tax_code|entity} | 141 | <tr> |
815 | 152 | </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity} | 142 | <td>${tax_code_tuple[0]|entity} |
816 | 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} |
817 | 154 | </td> | 144 | </td> |
818 | 155 | </tr> | 145 | </tr> |
819 | 156 | %endfor | 146 | %endif |
820 | 157 | </table> | 147 | %endfor |
821 | 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> |
822 | 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> |
823 | 160 | </tr> | 150 | <td style="vertical-align:text-top;padding:10"> |
824 | 161 | <tr> | 151 | <h3>Totali</h3> |
825 | 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%;"> |
826 | 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> |
827 | 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> |
828 | 155 | <th style="text-align:right">Importo</th> | ||
829 | 156 | </tr> | ||
830 | 157 | %for tax_code_tuple in tax_code_totals_list : | ||
831 | 158 | % if not tax_code_tuple[2]: | ||
832 | 159 | <tr> | ||
833 | 160 | <td>${tax_code_tuple[0]|entity} | ||
834 | 161 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
835 | 162 | </td> | ||
836 | 163 | </tr> | ||
837 | 164 | %endif | ||
838 | 165 | %endfor | ||
839 | 166 | </table> | ||
840 | 167 | </td> | ||
841 | 168 | </tr> | ||
842 | 169 | <tr> | ||
843 | 170 | <td colspan="2" style="vertical-align:text-top;padding:10"> | ||
844 | 171 | <h3>Dettaglio imponibili</h3> | ||
845 | 172 | <table style="width:100%;"> | ||
846 | 173 | <tr> | ||
847 | 174 | <th style="text-align:left">Descrizione</th> | ||
848 | 175 | <th style="text-align:right">Importo</th> | ||
849 | 176 | </tr> | ||
850 | 177 | %for tax_code_tuple in tax_code_list : | ||
851 | 178 | % if tax_code_tuple[2]: | ||
852 | 179 | <tr> | ||
853 | 180 | <td>${tax_code_tuple[0]|entity} | ||
854 | 181 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
855 | 182 | </td> | ||
856 | 183 | </tr> | ||
857 | 184 | %endif | ||
858 | 185 | %endfor | ||
859 | 186 | </table> | ||
860 | 187 | </td> | ||
861 | 188 | <td style="vertical-align:text-top;padding:10"> | ||
862 | 189 | <h3>Totali imponibili</h3> | ||
863 | 190 | <table style="width:100%;"> | ||
864 | 191 | <tr> | ||
865 | 192 | <th style="text-align:left">Descrizione</th> | ||
866 | 193 | <th style="text-align:right">Importo</th> | ||
867 | 194 | </tr> | ||
868 | 195 | %for tax_code_tuple in tax_code_totals_list : | ||
869 | 196 | % if tax_code_tuple[2]: | ||
870 | 197 | <tr> | ||
871 | 198 | <td>${tax_code_tuple[0]|entity} | ||
872 | 199 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
873 | 200 | </td> | ||
874 | 201 | </tr> | ||
875 | 202 | %endif | ||
876 | 203 | %endfor | ||
877 | 204 | </table> | ||
878 | 205 | </td> | ||
879 | 165 | </tr> | 206 | </tr> |
880 | 166 | </table> | 207 | </table> |
881 | 167 | </div> | 208 | </div> |
882 | 168 | 209 | ||
883 | === modified file 'l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako' | |||
884 | --- l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako 2012-08-16 09:25:37 +0000 | |||
885 | +++ l10n_it_vat_registries/templates/registro_iva_corrispettivi.mako 2013-05-23 04:44:28 +0000 | |||
886 | @@ -19,16 +19,15 @@ | |||
887 | 19 | <body> | 19 | <body> |
888 | 20 | <h2>Corrispettivi</h2> | 20 | <h2>Corrispettivi</h2> |
889 | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> |
891 | 22 | <table style="width:100%;" cellspacing="0"> | 22 | <table style="width:100%; font-size: small;" cellspacing="0"> |
892 | 23 | <thead> | 23 | <thead> |
893 | 24 | <tr> | 24 | <tr> |
894 | 25 | <th class="left_without_line">Numero</th> | 25 | <th class="left_without_line">Numero</th> |
895 | 26 | <th class="left_without_line">Data registrazione</th> | 26 | <th class="left_without_line">Data registrazione</th> |
897 | 27 | <th class="left_without_line">Causale</th> | 27 | <th class="left_without_line">Sezionale</th> |
898 | 28 | <th class="right_without_line">Importo totale</th> | 28 | <th class="right_without_line">Importo totale</th> |
899 | 29 | <th class="right_without_line">Imponibile</th> | ||
900 | 30 | <th class="right_without_line">% IVA</th> | ||
901 | 31 | <th class="right_without_line">Imposta</th> | 29 | <th class="right_without_line">Imposta</th> |
902 | 30 | <th class="right_without_line">Importo</th> | ||
903 | 32 | <th></th> | 31 | <th></th> |
904 | 33 | </tr> | 32 | </tr> |
905 | 34 | </thead> | 33 | </thead> |
906 | @@ -59,7 +58,7 @@ | |||
907 | 59 | </td><td class="left_without_line"> | 58 | </td><td class="left_without_line"> |
908 | 60 | %endif | 59 | %endif |
909 | 61 | %if line['index']==0: | 60 | %if line['index']==0: |
911 | 62 | Corrispettivi | 61 | ${object.journal_id.name or ''| entity} |
912 | 63 | %endif | 62 | %endif |
913 | 64 | %if line['index']==0: | 63 | %if line['index']==0: |
914 | 65 | </td><td class="right_with_line"> | 64 | </td><td class="right_with_line"> |
915 | @@ -67,25 +66,19 @@ | |||
916 | 67 | </td><td class="right_without_line"> | 66 | </td><td class="right_without_line"> |
917 | 68 | %endif | 67 | %endif |
918 | 69 | %if line['index']==0: | 68 | %if line['index']==0: |
920 | 70 | ${ formatLang(line['amount_total']) | entity} | 69 | ${ formatLang(object.amount) | entity} |
921 | 71 | %endif | 70 | %endif |
922 | 72 | </td> | 71 | </td> |
923 | 73 | %if line['index']==0: | 72 | %if line['index']==0: |
939 | 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> |
940 | 75 | %else: | 74 | %else: |
941 | 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> |
942 | 77 | %endif | 76 | %endif |
943 | 78 | %if line['index']==0: | 77 | %if line['index']==0: |
944 | 79 | <td class="right_with_line">${ line['tax_percentage'] or ''| entity}</td> | 78 | <td class="right_with_line">${ formatLang(line['amount'])| entity}</td> |
945 | 80 | %else: | 79 | %else: |
946 | 81 | <td class="right_without_line">${ line['tax_percentage'] or ''| entity}</td> | 80 | <td class="right_without_line">${ formatLang(line['amount'])| entity}</td> |
947 | 82 | %endif | 81 | %endif |
933 | 83 | %if line['index']==0: | ||
934 | 84 | <td class="right_with_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
935 | 85 | %else: | ||
936 | 86 | <td class="right_without_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
937 | 87 | %endif | ||
938 | 88 | <td></td> | ||
948 | 89 | </tr> | 82 | </tr> |
949 | 90 | %endfor | 83 | %endfor |
950 | 91 | %endfor | 84 | %endfor |
951 | @@ -93,33 +86,87 @@ | |||
952 | 93 | </table> | 86 | </table> |
953 | 94 | <div style="page-break-inside: avoid;"> | 87 | <div style="page-break-inside: avoid;"> |
954 | 95 | <br/> | 88 | <br/> |
955 | 89 | <% tax_code_list = tax_codes() %> | ||
956 | 90 | <% tax_code_totals_list = tax_codes_totals() %> | ||
957 | 96 | <table style="width:100%; " border="1"> | 91 | <table style="width:100%; " border="1"> |
958 | 97 | <tr style="border-style:ridge;border-width:5px"> | 92 | <tr style="border-style:ridge;border-width:5px"> |
984 | 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> |
985 | 99 | </tr> | 94 | </tr> |
986 | 100 | <tr> | 95 | <tr> |
987 | 101 | <td rowspan="2" style="vertical-align:text-top;padding:10"> | 96 | <td colspan="2" style="vertical-align:text-top;padding:10"> |
988 | 102 | <table style="width:100%;"> | 97 | <h3>Dettaglio</h3> |
989 | 103 | <tr> | 98 | <table style="width:100%;"> |
990 | 104 | <th style="text-align:left">Descrizione</th> | 99 | <tr> |
991 | 105 | <th style="text-align:right">Imponibile</th> | 100 | <th style="text-align:left">Descrizione</th> |
992 | 106 | <th style="text-align:right">Imposta</th> | 101 | <th style="text-align:right">Importo</th> |
993 | 107 | </tr> | 102 | </tr> |
994 | 108 | %for tax_code in tax_codes : | 103 | %for tax_code_tuple in tax_code_list : |
995 | 109 | <tr> | 104 | % if not tax_code_tuple[2]: |
996 | 110 | <td>${tax_code|entity} | 105 | <tr> |
997 | 111 | </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity} | 106 | <td>${tax_code_tuple[0]|entity} |
998 | 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} |
999 | 113 | </td> | 108 | </td> |
1000 | 114 | </tr> | 109 | </tr> |
1001 | 115 | %endfor | 110 | %endif |
1002 | 116 | </table> | 111 | %endfor |
1003 | 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> |
1004 | 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> |
1005 | 119 | </tr> | 114 | <td style="vertical-align:text-top;padding:10"> |
1006 | 120 | <tr> | 115 | <h3>Totali</h3> |
1007 | 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%;"> |
1008 | 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> |
1009 | 118 | <th style="text-align:left">Descrizione</th> | ||
1010 | 119 | <th style="text-align:right">Importo</th> | ||
1011 | 120 | </tr> | ||
1012 | 121 | %for tax_code_tuple in tax_code_totals_list : | ||
1013 | 122 | % if not tax_code_tuple[2]: | ||
1014 | 123 | <tr> | ||
1015 | 124 | <td>${tax_code_tuple[0]|entity} | ||
1016 | 125 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1017 | 126 | </td> | ||
1018 | 127 | </tr> | ||
1019 | 128 | %endif | ||
1020 | 129 | %endfor | ||
1021 | 130 | </table> | ||
1022 | 131 | </td> | ||
1023 | 132 | </tr> | ||
1024 | 133 | <tr> | ||
1025 | 134 | <td colspan="2" style="vertical-align:text-top;padding:10"> | ||
1026 | 135 | <h3>Dettaglio imponibili</h3> | ||
1027 | 136 | <table style="width:100%;"> | ||
1028 | 137 | <tr> | ||
1029 | 138 | <th style="text-align:left">Descrizione</th> | ||
1030 | 139 | <th style="text-align:right">Importo</th> | ||
1031 | 140 | </tr> | ||
1032 | 141 | %for tax_code_tuple in tax_code_list : | ||
1033 | 142 | % if tax_code_tuple[2]: | ||
1034 | 143 | <tr> | ||
1035 | 144 | <td>${tax_code_tuple[0]|entity} | ||
1036 | 145 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1037 | 146 | </td> | ||
1038 | 147 | </tr> | ||
1039 | 148 | %endif | ||
1040 | 149 | %endfor | ||
1041 | 150 | </table> | ||
1042 | 151 | </td> | ||
1043 | 152 | <td style="vertical-align:text-top;padding:10"> | ||
1044 | 153 | <h3>Totali imponibili</h3> | ||
1045 | 154 | <table style="width:100%;"> | ||
1046 | 155 | <tr> | ||
1047 | 156 | <th style="text-align:left">Descrizione</th> | ||
1048 | 157 | <th style="text-align:right">Importo</th> | ||
1049 | 158 | </tr> | ||
1050 | 159 | %for tax_code_tuple in tax_code_totals_list : | ||
1051 | 160 | % if tax_code_tuple[2]: | ||
1052 | 161 | <tr> | ||
1053 | 162 | <td>${tax_code_tuple[0]|entity} | ||
1054 | 163 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1055 | 164 | </td> | ||
1056 | 165 | </tr> | ||
1057 | 166 | %endif | ||
1058 | 167 | %endfor | ||
1059 | 168 | </table> | ||
1060 | 169 | </td> | ||
1061 | 123 | </tr> | 170 | </tr> |
1062 | 124 | </table> | 171 | </table> |
1063 | 125 | </div> | 172 | </div> |
1064 | 126 | 173 | ||
1065 | === modified file 'l10n_it_vat_registries/templates/registro_iva_vendite.mako' | |||
1066 | --- l10n_it_vat_registries/templates/registro_iva_vendite.mako 2012-08-16 09:25:37 +0000 | |||
1067 | +++ l10n_it_vat_registries/templates/registro_iva_vendite.mako 2013-05-23 04:44:28 +0000 | |||
1068 | @@ -19,7 +19,7 @@ | |||
1069 | 19 | <body> | 19 | <body> |
1070 | 20 | <h2>Fatture Emesse</h2> | 20 | <h2>Fatture Emesse</h2> |
1071 | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> | 21 | <% setLang(objects[0].company_id.partner_id.lang or "en_US") %> |
1073 | 22 | <table style="width:100%;" cellspacing="0"> | 22 | <table style="width:100%; font-size: small;" cellspacing="0"> |
1074 | 23 | <thead> | 23 | <thead> |
1075 | 24 | <tr> | 24 | <tr> |
1076 | 25 | <th class="left_without_line">Data registrazione</th> | 25 | <th class="left_without_line">Data registrazione</th> |
1077 | @@ -27,11 +27,10 @@ | |||
1078 | 27 | <th class="left_without_line">Ragione sociale</th> | 27 | <th class="left_without_line">Ragione sociale</th> |
1079 | 28 | <th class="left_without_line">Numero fattura</th> | 28 | <th class="left_without_line">Numero fattura</th> |
1080 | 29 | <th class="left_without_line">Data fattura</th> | 29 | <th class="left_without_line">Data fattura</th> |
1082 | 30 | <th class="left_without_line">Causale</th> | 30 | <th class="left_without_line">Sezionale</th> |
1083 | 31 | <th class="right_without_line">Totale fattura</th> | 31 | <th class="right_without_line">Totale fattura</th> |
1084 | 32 | <th class="right_without_line">Imponibile</th> | ||
1085 | 33 | <th class="right_without_line">% IVA</th> | ||
1086 | 34 | <th class="right_without_line">Imposta</th> | 32 | <th class="right_without_line">Imposta</th> |
1087 | 33 | <th class="right_without_line">Importo</th> | ||
1088 | 35 | <th></th> | 34 | <th></th> |
1089 | 36 | </tr> | 35 | </tr> |
1090 | 37 | </thead> | 36 | </thead> |
1091 | @@ -78,7 +77,7 @@ | |||
1092 | 78 | </td><td class="left_without_line"> | 77 | </td><td class="left_without_line"> |
1093 | 79 | %endif | 78 | %endif |
1094 | 80 | %if line['index']==0: | 79 | %if line['index']==0: |
1096 | 81 | ${ formatLang(object.date,date=True) or '' | entity} | 80 | ${ formatLang(line['invoice_date'],date=True) or '' | entity} |
1097 | 82 | %endif | 81 | %endif |
1098 | 83 | %if line['index']==0: | 82 | %if line['index']==0: |
1099 | 84 | </td><td class="left_with_line"> | 83 | </td><td class="left_with_line"> |
1100 | @@ -86,11 +85,7 @@ | |||
1101 | 86 | </td><td class="left_without_line"> | 85 | </td><td class="left_without_line"> |
1102 | 87 | %endif | 86 | %endif |
1103 | 88 | %if line['index']==0: | 87 | %if line['index']==0: |
1109 | 89 | %if line['amount_total'] >= 0: | 88 | ${object.journal_id.name or ''| entity} |
1105 | 90 | Fattura | ||
1106 | 91 | %else: | ||
1107 | 92 | Nota di credito | ||
1108 | 93 | %endif | ||
1110 | 94 | %endif | 89 | %endif |
1111 | 95 | %if line['index']==0: | 90 | %if line['index']==0: |
1112 | 96 | </td><td class="right_with_line"> | 91 | </td><td class="right_with_line"> |
1113 | @@ -98,25 +93,19 @@ | |||
1114 | 98 | </td><td class="right_without_line"> | 93 | </td><td class="right_without_line"> |
1115 | 99 | %endif | 94 | %endif |
1116 | 100 | %if line['index']==0: | 95 | %if line['index']==0: |
1118 | 101 | ${ formatLang(line['amount_total']) | entity} | 96 | ${ formatLang(object.amount) | entity} |
1119 | 102 | %endif | 97 | %endif |
1120 | 103 | </td> | 98 | </td> |
1121 | 104 | %if line['index']==0: | 99 | %if line['index']==0: |
1137 | 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> |
1138 | 106 | %else: | 101 | %else: |
1139 | 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> |
1140 | 108 | %endif | 103 | %endif |
1141 | 109 | %if line['index']==0: | 104 | %if line['index']==0: |
1142 | 110 | <td class="right_with_line">${ line['tax_percentage'] or ''| entity}</td> | 105 | <td class="right_with_line">${ formatLang(line['amount'])| entity}</td> |
1143 | 111 | %else: | 106 | %else: |
1144 | 112 | <td class="right_without_line">${ line['tax_percentage'] or ''| entity}</td> | 107 | <td class="right_without_line">${ formatLang(line['amount'])| entity}</td> |
1145 | 113 | %endif | 108 | %endif |
1131 | 114 | %if line['index']==0: | ||
1132 | 115 | <td class="right_with_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
1133 | 116 | %else: | ||
1134 | 117 | <td class="right_without_line">${ formatLang(line['amount']) or ''| entity}</td> | ||
1135 | 118 | %endif | ||
1136 | 119 | <td></td> | ||
1146 | 120 | </tr> | 109 | </tr> |
1147 | 121 | %endfor | 110 | %endfor |
1148 | 122 | %endfor | 111 | %endfor |
1149 | @@ -124,33 +113,87 @@ | |||
1150 | 124 | </table> | 113 | </table> |
1151 | 125 | <div style="page-break-inside: avoid;"> | 114 | <div style="page-break-inside: avoid;"> |
1152 | 126 | <br/> | 115 | <br/> |
1153 | 116 | <% tax_code_list = tax_codes() %> | ||
1154 | 117 | <% tax_code_totals_list = tax_codes_totals() %> | ||
1155 | 127 | <table style="width:100%; " border="1"> | 118 | <table style="width:100%; " border="1"> |
1156 | 128 | <tr style="border-style:ridge;border-width:5px"> | 119 | <tr style="border-style:ridge;border-width:5px"> |
1182 | 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> |
1183 | 130 | </tr> | 121 | </tr> |
1184 | 131 | <tr> | 122 | <tr> |
1185 | 132 | <td rowspan="2" style="vertical-align:text-top;padding:10"> | 123 | <td colspan="2" style="vertical-align:text-top;padding:10"> |
1186 | 133 | <table style="width:100%;"> | 124 | <h3>Dettaglio</h3> |
1187 | 134 | <tr> | 125 | <table style="width:100%;"> |
1188 | 135 | <th style="text-align:left">Descrizione</th> | 126 | <tr> |
1189 | 136 | <th style="text-align:right">Imponibile</th> | 127 | <th style="text-align:left">Descrizione</th> |
1190 | 137 | <th style="text-align:right">Imposta</th> | 128 | <th style="text-align:right">Importo</th> |
1191 | 138 | </tr> | 129 | </tr> |
1192 | 139 | %for tax_code in tax_codes : | 130 | %for tax_code_tuple in tax_code_list : |
1193 | 140 | <tr> | 131 | % if not tax_code_tuple[2]: |
1194 | 141 | <td>${tax_code|entity} | 132 | <tr> |
1195 | 142 | </td><td style="text-align:right">${formatLang(tax_codes[tax_code]['base'])|entity} | 133 | <td>${tax_code_tuple[0]|entity} |
1196 | 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} |
1197 | 144 | </td> | 135 | </td> |
1198 | 145 | </tr> | 136 | </tr> |
1199 | 146 | %endfor | 137 | %endif |
1200 | 147 | </table> | 138 | %endfor |
1201 | 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> |
1202 | 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> |
1203 | 150 | </tr> | 141 | <td style="vertical-align:text-top;padding:10"> |
1204 | 151 | <tr> | 142 | <h3>Totali</h3> |
1205 | 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%;"> |
1206 | 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> |
1207 | 145 | <th style="text-align:left">Descrizione</th> | ||
1208 | 146 | <th style="text-align:right">Importo</th> | ||
1209 | 147 | </tr> | ||
1210 | 148 | %for tax_code_tuple in tax_code_totals_list : | ||
1211 | 149 | % if not tax_code_tuple[2]: | ||
1212 | 150 | <tr> | ||
1213 | 151 | <td>${tax_code_tuple[0]|entity} | ||
1214 | 152 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1215 | 153 | </td> | ||
1216 | 154 | </tr> | ||
1217 | 155 | %endif | ||
1218 | 156 | %endfor | ||
1219 | 157 | </table> | ||
1220 | 158 | </td> | ||
1221 | 159 | </tr> | ||
1222 | 160 | <tr> | ||
1223 | 161 | <td colspan="2" style="vertical-align:text-top;padding:10"> | ||
1224 | 162 | <h3>Dettaglio imponibili</h3> | ||
1225 | 163 | <table style="width:100%;"> | ||
1226 | 164 | <tr> | ||
1227 | 165 | <th style="text-align:left">Descrizione</th> | ||
1228 | 166 | <th style="text-align:right">Importo</th> | ||
1229 | 167 | </tr> | ||
1230 | 168 | %for tax_code_tuple in tax_code_list : | ||
1231 | 169 | % if tax_code_tuple[2]: | ||
1232 | 170 | <tr> | ||
1233 | 171 | <td>${tax_code_tuple[0]|entity} | ||
1234 | 172 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1235 | 173 | </td> | ||
1236 | 174 | </tr> | ||
1237 | 175 | %endif | ||
1238 | 176 | %endfor | ||
1239 | 177 | </table> | ||
1240 | 178 | </td> | ||
1241 | 179 | <td style="vertical-align:text-top;padding:10"> | ||
1242 | 180 | <h3>Totali imponibili</h3> | ||
1243 | 181 | <table style="width:100%;"> | ||
1244 | 182 | <tr> | ||
1245 | 183 | <th style="text-align:left">Descrizione</th> | ||
1246 | 184 | <th style="text-align:right">Importo</th> | ||
1247 | 185 | </tr> | ||
1248 | 186 | %for tax_code_tuple in tax_code_totals_list : | ||
1249 | 187 | % if tax_code_tuple[2]: | ||
1250 | 188 | <tr> | ||
1251 | 189 | <td>${tax_code_tuple[0]|entity} | ||
1252 | 190 | </td><td style="text-align:right">${formatLang(tax_code_tuple[1])|entity} | ||
1253 | 191 | </td> | ||
1254 | 192 | </tr> | ||
1255 | 193 | %endif | ||
1256 | 194 | %endfor | ||
1257 | 195 | </table> | ||
1258 | 196 | </td> | ||
1259 | 154 | </tr> | 197 | </tr> |
1260 | 155 | </table> | 198 | </table> |
1261 | 156 | </div> | 199 | </div> |
1262 | 157 | 200 | ||
1263 | === modified file 'l10n_it_vat_registries/wizard/__init__.py' | |||
1264 | --- l10n_it_vat_registries/wizard/__init__.py 2013-01-04 14:02:10 +0000 | |||
1265 | +++ l10n_it_vat_registries/wizard/__init__.py 2013-05-23 04:44:28 +0000 | |||
1266 | @@ -1,7 +1,7 @@ | |||
1267 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
1268 | 2 | ############################################################################## | 2 | ############################################################################## |
1269 | 3 | # | 3 | # |
1271 | 4 | # Copyright (C) 2011 Associazione OpenERP Italia | 4 | # Copyright (C) 2011-2013 Associazione OpenERP Italia |
1272 | 5 | # (<http://www.openerp-italia.org>). | 5 | # (<http://www.openerp-italia.org>). |
1273 | 6 | # | 6 | # |
1274 | 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 |
1275 | @@ -12,7 +12,7 @@ | |||
1276 | 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, |
1277 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
1278 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1280 | 15 | # GNU General Public License for more details. | 15 | # GNU Affero General Public License for more details. |
1281 | 16 | # | 16 | # |
1282 | 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 |
1283 | 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/>. |
1284 | 19 | 19 | ||
1285 | === modified file 'l10n_it_vat_registries/wizard/print_registro_iva.py' | |||
1286 | --- l10n_it_vat_registries/wizard/print_registro_iva.py 2013-01-04 14:02:10 +0000 | |||
1287 | +++ l10n_it_vat_registries/wizard/print_registro_iva.py 2013-05-23 04:44:28 +0000 | |||
1288 | @@ -25,79 +25,64 @@ | |||
1289 | 25 | 25 | ||
1290 | 26 | class wizard_registro_iva(osv.osv_memory): | 26 | class wizard_registro_iva(osv.osv_memory): |
1291 | 27 | 27 | ||
1292 | 28 | def _get_period(self, cr, uid, context=None): | ||
1293 | 29 | ctx = dict(context or {}, account_period_prefer_normal=True) | ||
1294 | 30 | period_ids = self.pool.get('account.period').find(cr, uid, context=ctx) | ||
1295 | 31 | return period_ids | ||
1296 | 32 | |||
1297 | 28 | _name = "wizard.registro.iva" | 33 | _name = "wizard.registro.iva" |
1298 | 29 | _columns = { | 34 | _columns = { |
1301 | 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), |
1300 | 31 | 'date_to': fields.date('To date', required=True), | ||
1302 | 32 | 'type': fields.selection([ | 36 | 'type': fields.selection([ |
1303 | 33 | ('customer', 'Customer Invoices'), | 37 | ('customer', 'Customer Invoices'), |
1304 | 34 | ('supplier', 'Supplier Invoices'), | 38 | ('supplier', 'Supplier Invoices'), |
1305 | 35 | ('corrispettivi', 'Corrispettivi'), | 39 | ('corrispettivi', 'Corrispettivi'), |
1306 | 36 | ], 'Layout', required=True), | 40 | ], 'Layout', required=True), |
1307 | 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), |
1308 | 42 | 'tax_sign': fields.float('Tax amount sign', | ||
1309 | 43 | help="Use -1 you have negative tax amounts and you want to print them prositive"), | ||
1310 | 38 | 'message': fields.char('Message', size=64, readonly=True), | 44 | 'message': fields.char('Message', size=64, readonly=True), |
1311 | 45 | 'fiscal_page_base': fields.integer('Last printed page', required=True), | ||
1312 | 39 | } | 46 | } |
1313 | 40 | _defaults = { | 47 | _defaults = { |
1314 | 41 | 'type': 'customer', | 48 | 'type': 'customer', |
1318 | 42 | 'date_from': lambda * a: time.strftime('%Y-%m-%d'), | 49 | 'period_ids': _get_period, |
1319 | 43 | 'date_to': lambda * a: time.strftime('%Y-%m-%d'), | 50 | 'tax_sign': 1.0, |
1320 | 44 | #'journal_ids': lambda s, cr, uid, c: s.pool.get('account.journal').search(cr, uid, []), | 51 | 'fiscal_page_base': 0, |
1321 | 45 | } | 52 | } |
1322 | 46 | |||
1323 | 47 | def counterparts_number(self, move_line): | ||
1324 | 48 | counter = 0 | ||
1325 | 49 | if not move_line.credit: | ||
1326 | 50 | for line in move_line.move_id.line_id: | ||
1327 | 51 | if line.credit: | ||
1328 | 52 | counter += 1 | ||
1329 | 53 | elif not move_line.debit: | ||
1330 | 54 | for line in move_line.move_id.line_id: | ||
1331 | 55 | if line.debit: | ||
1332 | 56 | counter += 1 | ||
1333 | 57 | return counter | ||
1334 | 58 | 53 | ||
1335 | 59 | def print_registro(self, cr, uid, ids, context=None): | 54 | def print_registro(self, cr, uid, ids, context=None): |
1336 | 60 | move_ids = [] | ||
1337 | 61 | wizard = self.read(cr, uid, ids)[0] | ||
1338 | 62 | move_line_obj = self.pool.get('account.move.line') | ||
1339 | 63 | tax_pool = self.pool.get('account.tax') | ||
1340 | 64 | search_list = [] | ||
1341 | 65 | search_list = [ | ||
1342 | 66 | ('journal_id', 'in', wizard['journal_ids']), | ||
1343 | 67 | ('move_id.date', '<=', wizard['date_to']), | ||
1344 | 68 | ('move_id.date', '>=', wizard['date_from']), | ||
1345 | 69 | ('move_id.state', '=', 'posted'), | ||
1346 | 70 | ('tax_code_id', '!=', False), | ||
1347 | 71 | ] | ||
1348 | 72 | move_line_ids = move_line_obj.search(cr, uid, search_list, order='date') | ||
1349 | 73 | if context is None: | 55 | if context is None: |
1350 | 74 | context = {} | 56 | context = {} |
1370 | 75 | for move_line in move_line_obj.browse(cr, uid, move_line_ids): | 57 | wizard = self.browse(cr, uid, ids)[0] |
1371 | 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') |
1372 | 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') |
1373 | 78 | if move_line.tax_code_id.tax_ids: | 60 | move_ids = move_obj.search(cr, uid, [ |
1374 | 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]), |
1375 | 80 | raise osv.except_osv(_('Error'), _('Taxes %s have different rates') | 62 | ('period_id', 'in', [p.id for p in wizard.period_ids]), |
1376 | 81 | % str(move_line.tax_code_id.tax_ids)) | 63 | ('state', '=', 'posted'), |
1377 | 82 | if move_line.tax_code_id.ref_tax_ids: | 64 | ], order='date') |
1359 | 83 | if not tax_pool._have_same_rate(move_line.tax_code_id.ref_tax_ids): | ||
1360 | 84 | raise osv.except_osv(_('Error'), _('Taxes %s have different rates') | ||
1361 | 85 | % str(move_line.tax_code_id.ref_tax_ids)) | ||
1362 | 86 | # controllo che ogni tax code abbia una e una sola imposta | ||
1363 | 87 | ''' non posso farlo per via dell IVA inclusa nel prezzo | ||
1364 | 88 | if len(move_line.tax_code_id.tax_ids) != 1: | ||
1365 | 89 | raise osv.except_osv(_('Error'), _('Wrong tax configuration for tax code %s') | ||
1366 | 90 | % move_line.tax_code_id.name) | ||
1367 | 91 | ''' | ||
1368 | 92 | if move_line.move_id.id not in move_ids: | ||
1369 | 93 | move_ids.append(move_line.move_id.id) | ||
1378 | 94 | if not move_ids: | 65 | if not move_ids: |
1379 | 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')}) |
1381 | 96 | return True | 67 | model_data_ids = obj_model_data.search(cr, uid, [('model','=','ir.ui.view'), ('name','=','wizard_registro_iva')]) |
1382 | 68 | resource_id = obj_model_data.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id'] | ||
1383 | 69 | return { | ||
1384 | 70 | 'name': _('No documents'), | ||
1385 | 71 | 'res_id': ids[0], | ||
1386 | 72 | 'view_type': 'form', | ||
1387 | 73 | 'view_mode': 'form', | ||
1388 | 74 | 'res_model': 'wizard.registro.iva', | ||
1389 | 75 | 'views': [(resource_id,'form')], | ||
1390 | 76 | 'context': context, | ||
1391 | 77 | 'type': 'ir.actions.act_window', | ||
1392 | 78 | 'target': 'new', | ||
1393 | 79 | } | ||
1394 | 97 | datas = {'ids': move_ids} | 80 | datas = {'ids': move_ids} |
1395 | 98 | datas['model'] = 'account.move' | 81 | datas['model'] = 'account.move' |
1398 | 99 | datas['form'] = wizard | 82 | datas['fiscal_page_base'] = wizard.fiscal_page_base |
1399 | 100 | datas['move_ids'] = move_ids | 83 | datas['period_ids'] = [p.id for p in wizard.period_ids] |
1400 | 84 | datas['layout'] = wizard['type'] | ||
1401 | 85 | datas['tax_sign'] = wizard['tax_sign'] | ||
1402 | 101 | res= { | 86 | res= { |
1403 | 102 | 'type': 'ir.actions.report.xml', | 87 | 'type': 'ir.actions.report.xml', |
1404 | 103 | 'datas': datas, | 88 | 'datas': datas, |
1405 | @@ -110,4 +95,11 @@ | |||
1406 | 110 | res['report_name'] = 'registro_iva_corrispettivi' | 95 | res['report_name'] = 'registro_iva_corrispettivi' |
1407 | 111 | return res | 96 | return res |
1408 | 112 | 97 | ||
1410 | 113 | wizard_registro_iva() | 98 | def on_type_changed(self, cr, uid, ids, j_type, context=None): |
1411 | 99 | res={} | ||
1412 | 100 | if j_type: | ||
1413 | 101 | if j_type == 'supplier': | ||
1414 | 102 | res['value'] = {'tax_sign': -1} | ||
1415 | 103 | else: | ||
1416 | 104 | res['value'] = {'tax_sign': 1} | ||
1417 | 105 | return res | ||
1418 | 114 | 106 | ||
1419 | === modified file 'l10n_it_vat_registries/wizard/print_registro_iva.xml' | |||
1420 | --- l10n_it_vat_registries/wizard/print_registro_iva.xml 2011-08-06 10:23:30 +0000 | |||
1421 | +++ l10n_it_vat_registries/wizard/print_registro_iva.xml 2013-05-23 04:44:28 +0000 | |||
1422 | @@ -8,11 +8,13 @@ | |||
1423 | 8 | <field name="type">form</field> | 8 | <field name="type">form</field> |
1424 | 9 | <field name="arch" type="xml"> | 9 | <field name="arch" type="xml"> |
1425 | 10 | <form string="Tax Journal"> | 10 | <form string="Tax Journal"> |
1429 | 11 | <field name="date_from"/> | 11 | <field name="type" on_change="on_type_changed(type)"/> |
1430 | 12 | <field name="date_to"/> | 12 | <field name="tax_sign"/> |
1431 | 13 | <field name="type" colspan="4"/> | 13 | <field name="fiscal_page_base"/> |
1432 | 14 | <separator string="Periods" colspan="4"/> | ||
1433 | 15 | <field name="period_ids" colspan="4" nolabel="1" height="250"/> | ||
1434 | 14 | <separator string="Journals" colspan="4"/> | 16 | <separator string="Journals" colspan="4"/> |
1436 | 15 | <field name="journal_ids" colspan="4" nolabel="1" height="250"/> | 17 | <field name="journal_ids" colspan="4" nolabel="1" height="250" domain="[('type', 'in', ('sale','purchase','sale_refund','purchase_refund'))]"/> |
1437 | 16 | <button icon="gtk-cancel" special="cancel" string="Cancel"/> | 18 | <button icon="gtk-cancel" special="cancel" string="Cancel"/> |
1438 | 17 | <button icon="gtk-ok" name="print_registro" string="Print" type="object"/> | 19 | <button icon="gtk-ok" name="print_registro" string="Print" type="object"/> |
1439 | 18 | <newline/> | 20 | <newline/> |
Non c'è nella 6.1 il campo supplier_ invoice_ number, si potrebbe aggiungere direttamente in questo modulo?
In account.py basterebbe:
class account_ invoice( osv.osv) :
_inherit = "account.invoice"
_columns = {
'supplier_ invoice_ number' : fields. char('Supplier invoice nr', size=16),
}