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