Merge lp:~openobject-italia-core-devs/openobject-italia/l10n_it_invoice_tax_compute into lp:~openobject-italia-core-devs/openobject-italia/italian-addons
- l10n_it_invoice_tax_compute
- Merge into italian-addons
Status: | Merged |
---|---|
Merge reported by: | Lorenzo Battistini |
Merged at revision: | not available |
Proposed branch: | lp:~openobject-italia-core-devs/openobject-italia/l10n_it_invoice_tax_compute |
Merge into: | lp:~openobject-italia-core-devs/openobject-italia/italian-addons |
Diff against target: |
535 lines (+493/-0) 8 files modified
account_invoice_tax_by_column/AUTHORS.txt (+4/-0) account_invoice_tax_by_column/__init__.py (+24/-0) account_invoice_tax_by_column/__openerp__.py (+58/-0) account_invoice_tax_by_column/account.py (+55/-0) account_invoice_tax_by_column/i18n/account_invoice_tax_by_column.pot (+72/-0) account_invoice_tax_by_column/i18n/it.po (+94/-0) account_invoice_tax_by_column/invoice.py (+79/-0) account_invoice_tax_by_column/tests/tests.txt (+107/-0) |
To merge this branch: | bzr merge lp:~openobject-italia-core-devs/openobject-italia/l10n_it_invoice_tax_compute |
Related bugs: | |
Related blueprints: |
Calcolo Verticale IVA
(High)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lorenzo Battistini | Approve | ||
Review via email: mp+60069@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-08-23.
Commit message
Description of the change
Lorenzo Battistini (elbati) wrote : | # |
Lorenzo Battistini (elbati) wrote : | # |
Sembrano esserci problemi con le tasse parzialmente deducibili.
Ho provato a creare una fattura fornitore con una riga da 123,57 e IVA 20% deducibile al 50%.
Cliccando su 'Compute Taxes' ottengo
ERROR:web-
Traceback (most recent call last):
File "/home/
return f(self, dbname, *args, **kwargs)
File "/home/
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/
for taxe in ait_obj.compute(cr, uid, id, context=
File "/home/
amount = tax_obj.
KeyError: 'tax'
Lorenzo Battistini (elbati) wrote : | # |
Per me ora il modulo 'account_
Lorenzo Battistini (elbati) wrote : | # |
Si potrebbe perfezionare il modulo cercando di usare 'super' ove possibile invece di riscrivere completamente i metodi di calcolo delle tasse
Lorenzo Battistini (elbati) wrote : | # |
Ecco: http://
Qualcuno vuole fare dei test?
Sergio Corato (icsergio) wrote : | # |
Il 20/08/2011 12:10, Lorenzo Battistini - Agile BG - Domsense ha scritto:
> Review: Approve
> Ecco: http://
> Qualcuno vuole fare dei test?
L'ho provato sulla 6.0.3, per me è tutto regolare.
Davide Corio (enlightx-deactivatedaccount) wrote : | # |
Allora, lato tecnico (codice, funzionamento wizard, stampe...) mi pare tutto ok, quindi il merge è ok per me.
Possiamo quindi iniziare a lavorare alle raffinatezze e all'usabilità. soprattutto per quanto riguarda wizard e stampe.
Cmq bravo Lorenzo
Davide Corio (enlightx-deactivatedaccount) wrote : | # |
Ooooops, ho fatto casino :-)
per qualche link confuso stavo testando il branch sui registri iva.
su questo branch invece ho trovato un errore di calcolo con aliquote parzialmente deducibili
Preview Diff
1 | === added directory 'account_invoice_tax_by_column' |
2 | === added file 'account_invoice_tax_by_column/AUTHORS.txt' |
3 | --- account_invoice_tax_by_column/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
4 | +++ account_invoice_tax_by_column/AUTHORS.txt 2011-08-20 10:12:24 +0000 |
5 | @@ -0,0 +1,4 @@ |
6 | +Matteo Grolla <magrolla@yahoo.it> |
7 | +Marco Marchiori <marcomarkiori@gmail.com> |
8 | +Massimo Biancalani <massimo.biancalani@gmail.com> |
9 | +Lorenzo Battistini <lorenzo.battistini@domsense.com> |
10 | |
11 | === added file 'account_invoice_tax_by_column/__init__.py' |
12 | --- account_invoice_tax_by_column/__init__.py 1970-01-01 00:00:00 +0000 |
13 | +++ account_invoice_tax_by_column/__init__.py 2011-08-20 10:12:24 +0000 |
14 | @@ -0,0 +1,24 @@ |
15 | +# -*- encoding: utf-8 -*- |
16 | +############################################################################## |
17 | +# |
18 | +# OpenERP, Open Source Management Solution |
19 | +# Copyright (C) 2011 |
20 | +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) |
21 | +# |
22 | +# This program is free software: you can redistribute it and/or modify |
23 | +# it under the terms of the GNU Affero General Public License as |
24 | +# published by the Free Software Foundation, either version 3 of the |
25 | +# License, or (at your option) any later version. |
26 | +# |
27 | +# This program is distributed in the hope that it will be useful, |
28 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
29 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
30 | +# GNU Affero General Public License for more details. |
31 | +# |
32 | +# You should have received a copy of the GNU Affero General Public License |
33 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
34 | +# |
35 | +############################################################################## |
36 | + |
37 | +import invoice |
38 | +import account |
39 | |
40 | === added file 'account_invoice_tax_by_column/__openerp__.py' |
41 | --- account_invoice_tax_by_column/__openerp__.py 1970-01-01 00:00:00 +0000 |
42 | +++ account_invoice_tax_by_column/__openerp__.py 2011-08-20 10:12:24 +0000 |
43 | @@ -0,0 +1,58 @@ |
44 | +# -*- encoding: utf-8 -*- |
45 | +############################################################################## |
46 | +# |
47 | +# OpenERP, Open Source Management Solution |
48 | +# Copyright (C) 2011 |
49 | +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) |
50 | +# |
51 | +# This program is free software: you can redistribute it and/or modify |
52 | +# it under the terms of the GNU Affero General Public License as |
53 | +# published by the Free Software Foundation, either version 3 of the |
54 | +# License, or (at your option) any later version. |
55 | +# |
56 | +# This program is distributed in the hope that it will be useful, |
57 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
58 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
59 | +# GNU Affero General Public License for more details. |
60 | +# |
61 | +# You should have received a copy of the GNU Affero General Public License |
62 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
63 | +# |
64 | +############################################################################## |
65 | +{ |
66 | + 'name': 'Account Invoice Tax - Computation By Column', |
67 | + 'version': '0.1', |
68 | + 'category': 'Generic Modules/Accounting', |
69 | + 'description': """ |
70 | + -Invoice taxes: |
71 | + legend: |
72 | + TA(l) TaxAmount for line l |
73 | + TBA(l) TaxBaseAmount for line l |
74 | + TA(t) TaxAmount for tax t |
75 | + TBA(t) TaxBaseAmount for tax t |
76 | + |
77 | + default behaviour: |
78 | + openerp by default calculates taxes line by line as a function of line tax base amount |
79 | + and then groups these amounts by tax. |
80 | + TA(l) = f(TBA(l) |
81 | + TA(t) = sum( round( TA(l) ) ) /sum on lines l to which tax t is applied |
82 | + this module behaviour: |
83 | + In Italy the correct way to compute taxes is to first compute the tax base amount TBA(t) |
84 | + and the compute TA as a function of TBA(t) |
85 | + TBA(t) = sum( TBA(t) ) /sum on lines l to which tax t is applied |
86 | + TA(t) = f( TBA(t) ) |
87 | + the result difference is small but important |
88 | + |
89 | + """, |
90 | + 'author': 'OpenERP Italian Community', |
91 | + 'website': 'http://www.openerp-italia.org', |
92 | + 'license': 'AGPL-3', |
93 | + "depends" : ['account', 'account_voucher'], |
94 | + "init_xml" : [], |
95 | + "update_xml" : [], |
96 | + "demo_xml" : [], |
97 | + "active": False, |
98 | + "installable": True |
99 | +} |
100 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
101 | + |
102 | |
103 | === added file 'account_invoice_tax_by_column/account.py' |
104 | --- account_invoice_tax_by_column/account.py 1970-01-01 00:00:00 +0000 |
105 | +++ account_invoice_tax_by_column/account.py 2011-08-20 10:12:24 +0000 |
106 | @@ -0,0 +1,55 @@ |
107 | +# -*- encoding: utf-8 -*- |
108 | +############################################################################## |
109 | +# |
110 | +# OpenERP, Open Source Management Solution |
111 | +# Copyright (C) 2010-2010 Camptocamp Austria (<http://www.camptocamp.at>) |
112 | +# Copyright (C) 2011 |
113 | +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) |
114 | +# |
115 | +# This program is free software: you can redistribute it and/or modify |
116 | +# it under the terms of the GNU Affero General Public License as |
117 | +# published by the Free Software Foundation, either version 3 of the |
118 | +# License, or (at your option) any later version. |
119 | +# |
120 | +# This program is distributed in the hope that it will be useful, |
121 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
122 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
123 | +# GNU Affero General Public License for more details. |
124 | +# |
125 | +# You should have received a copy of the GNU Affero General Public License |
126 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
127 | +# |
128 | +############################################################################## |
129 | + |
130 | +from osv import fields, osv |
131 | +import decimal_precision as dp |
132 | +from decimal import * |
133 | + |
134 | +class account_tax(osv.osv): |
135 | + |
136 | + _inherit = 'account.tax' |
137 | + |
138 | + _columns = { |
139 | + 'line_precision' : fields.boolean('Rounding Precision', help="Calculates floating point tax per line to simulate vertical calculation"), |
140 | + } |
141 | + |
142 | + _defaults = { |
143 | + 'line_precision': True |
144 | + } |
145 | + |
146 | + def _compute(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None): |
147 | + res = super(account_tax, self)._compute(cr, uid, taxes, price_unit, quantity, address_id, product, partner) |
148 | + tax_pool=self.pool.get('account.tax') |
149 | + total = 0.0 |
150 | + for r in res: |
151 | + tax = tax_pool.browse(cr, uid, r['id']) |
152 | + if tax.line_precision: |
153 | + if r.get('balance',False): |
154 | + r['amount'] = r.get('balance', 0.0) * quantity - total |
155 | + else: |
156 | + r['amount'] = r.get('amount', 0.0) * quantity |
157 | + total += r['amount'] |
158 | + return res |
159 | + |
160 | + |
161 | +account_tax() |
162 | |
163 | === added directory 'account_invoice_tax_by_column/i18n' |
164 | === added file 'account_invoice_tax_by_column/i18n/account_invoice_tax_by_column.pot' |
165 | --- account_invoice_tax_by_column/i18n/account_invoice_tax_by_column.pot 1970-01-01 00:00:00 +0000 |
166 | +++ account_invoice_tax_by_column/i18n/account_invoice_tax_by_column.pot 2011-08-20 10:12:24 +0000 |
167 | @@ -0,0 +1,72 @@ |
168 | +# Translation of OpenERP Server. |
169 | +# This file contains the translation of the following modules: |
170 | +# * account_invoice_tax_by_column |
171 | +# |
172 | +msgid "" |
173 | +msgstr "" |
174 | +"Project-Id-Version: OpenERP Server 6.0.2\n" |
175 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
176 | +"POT-Creation-Date: 2011-07-23 14:32+0000\n" |
177 | +"PO-Revision-Date: 2011-07-23 14:32+0000\n" |
178 | +"Last-Translator: <>\n" |
179 | +"Language-Team: \n" |
180 | +"MIME-Version: 1.0\n" |
181 | +"Content-Type: text/plain; charset=UTF-8\n" |
182 | +"Content-Transfer-Encoding: \n" |
183 | +"Plural-Forms: \n" |
184 | + |
185 | +#. module: account_invoice_tax_by_column |
186 | +#: model:ir.model,name:account_invoice_tax_by_column.model_account_invoice_tax |
187 | +msgid "Invoice Tax" |
188 | +msgstr "" |
189 | + |
190 | +#. module: account_invoice_tax_by_column |
191 | +#: model:ir.module.module,description:account_invoice_tax_by_column.module_meta_information |
192 | +msgid " \n" |
193 | +" -Invoice taxes: \n" |
194 | +" legend:\n" |
195 | +" TA(l) TaxAmount for line l\n" |
196 | +" TBA(l) TaxBaseAmount for line l\n" |
197 | +" TA(t) TaxAmount for tax t\n" |
198 | +" TBA(t) TaxBaseAmount for tax t\n" |
199 | +" \n" |
200 | +" default behaviour: \n" |
201 | +" openerp by default calculates taxes line by line as a function of line tax base amount \n" |
202 | +" and then groups these amounts by tax.\n" |
203 | +" TA(l) = f(TBA(l)\n" |
204 | +" TA(t) = sum( round( TA(l) ) ) /sum on lines l to which tax t is applied\n" |
205 | +" this module behaviour: \n" |
206 | +" In Italy the correct way to compute taxes is to first compute the tax base amount TBA(t) \n" |
207 | +" and the compute TA as a function of TBA(t)\n" |
208 | +" TBA(t) = sum( TBA(t) ) /sum on lines l to which tax t is applied\n" |
209 | +" TA(t) = f( TBA(t) )\n" |
210 | +" the result difference is small but important\n" |
211 | +"\n" |
212 | +" " |
213 | +msgstr "" |
214 | + |
215 | +#. module: account_invoice_tax_by_column |
216 | +#: help:account.tax,line_precision:0 |
217 | +msgid "Calculates floating point tax per line to simulate vertical calculation" |
218 | +msgstr "" |
219 | + |
220 | +#. module: account_invoice_tax_by_column |
221 | +#: field:account.tax,line_precision:0 |
222 | +msgid "Rounding Precision" |
223 | +msgstr "" |
224 | + |
225 | +#. module: account_invoice_tax_by_column |
226 | +#: model:ir.module.module,shortdesc:account_invoice_tax_by_column.module_meta_information |
227 | +msgid "Account Invoice Tax - Computation By Column" |
228 | +msgstr "" |
229 | + |
230 | +#. module: account_invoice_tax_by_column |
231 | +#: model:ir.model,name:account_invoice_tax_by_column.model_account_tax |
232 | +msgid "account.tax" |
233 | +msgstr "" |
234 | + |
235 | +#. module: account_invoice_tax_by_column |
236 | +#: sql_constraint:account.tax:0 |
237 | +msgid "The tax name must be unique!" |
238 | +msgstr "" |
239 | + |
240 | |
241 | === added file 'account_invoice_tax_by_column/i18n/it.po' |
242 | --- account_invoice_tax_by_column/i18n/it.po 1970-01-01 00:00:00 +0000 |
243 | +++ account_invoice_tax_by_column/i18n/it.po 2011-08-20 10:12:24 +0000 |
244 | @@ -0,0 +1,94 @@ |
245 | +# Translation of OpenERP Server. |
246 | +# This file contains the translation of the following modules: |
247 | +# * account_invoice_tax_by_column |
248 | +# |
249 | +msgid "" |
250 | +msgstr "" |
251 | +"Project-Id-Version: OpenERP Server 6.0.2\n" |
252 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
253 | +"POT-Creation-Date: 2011-07-23 14:32+0000\n" |
254 | +"PO-Revision-Date: 2011-07-23 16:35+0100\n" |
255 | +"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n" |
256 | +"Language-Team: \n" |
257 | +"MIME-Version: 1.0\n" |
258 | +"Content-Type: text/plain; charset=UTF-8\n" |
259 | +"Content-Transfer-Encoding: 8bit\n" |
260 | +"Plural-Forms: \n" |
261 | + |
262 | +#. module: account_invoice_tax_by_column |
263 | +#: model:ir.model,name:account_invoice_tax_by_column.model_account_invoice_tax |
264 | +msgid "Invoice Tax" |
265 | +msgstr "Imposta della fattura" |
266 | + |
267 | +#. module: account_invoice_tax_by_column |
268 | +#: model:ir.module.module,description:account_invoice_tax_by_column.module_meta_information |
269 | +msgid "" |
270 | +" \n" |
271 | +" -Invoice taxes: \n" |
272 | +" legend:\n" |
273 | +" TA(l) TaxAmount for line l\n" |
274 | +" TBA(l) TaxBaseAmount for line l\n" |
275 | +" TA(t) TaxAmount for tax t\n" |
276 | +" TBA(t) TaxBaseAmount for tax t\n" |
277 | +" \n" |
278 | +" default behaviour: \n" |
279 | +" openerp by default calculates taxes line by line as a function of line tax base amount \n" |
280 | +" and then groups these amounts by tax.\n" |
281 | +" TA(l) = f(TBA(l)\n" |
282 | +" TA(t) = sum( round( TA(l) ) ) /sum on lines l to which tax t is applied\n" |
283 | +" this module behaviour: \n" |
284 | +" In Italy the correct way to compute taxes is to first compute the tax base amount TBA(t) \n" |
285 | +" and the compute TA as a function of TBA(t)\n" |
286 | +" TBA(t) = sum( TBA(t) ) /sum on lines l to which tax t is applied\n" |
287 | +" TA(t) = f( TBA(t) )\n" |
288 | +" the result difference is small but important\n" |
289 | +"\n" |
290 | +" " |
291 | +msgstr "" |
292 | +" \n" |
293 | +" -Invoice taxes: \n" |
294 | +" legend:\n" |
295 | +" TA(l) TaxAmount for line l\n" |
296 | +" TBA(l) TaxBaseAmount for line l\n" |
297 | +" TA(t) TaxAmount for tax t\n" |
298 | +" TBA(t) TaxBaseAmount for tax t\n" |
299 | +" \n" |
300 | +" default behaviour: \n" |
301 | +" openerp by default calculates taxes line by line as a function of line tax base amount \n" |
302 | +" and then groups these amounts by tax.\n" |
303 | +" TA(l) = f(TBA(l)\n" |
304 | +" TA(t) = sum( round( TA(l) ) ) /sum on lines l to which tax t is applied\n" |
305 | +" this module behaviour: \n" |
306 | +" In Italy the correct way to compute taxes is to first compute the tax base amount TBA(t) \n" |
307 | +" and the compute TA as a function of TBA(t)\n" |
308 | +" TBA(t) = sum( TBA(t) ) /sum on lines l to which tax t is applied\n" |
309 | +" TA(t) = f( TBA(t) )\n" |
310 | +" the result difference is small but important\n" |
311 | +"\n" |
312 | +" " |
313 | + |
314 | +#. module: account_invoice_tax_by_column |
315 | +#: help:account.tax,line_precision:0 |
316 | +msgid "Calculates floating point tax per line to simulate vertical calculation" |
317 | +msgstr "Calculates floating point tax per line to simulate vertical calculation" |
318 | + |
319 | +#. module: account_invoice_tax_by_column |
320 | +#: field:account.tax,line_precision:0 |
321 | +msgid "Rounding Precision" |
322 | +msgstr "Precisione arrotondamento" |
323 | + |
324 | +#. module: account_invoice_tax_by_column |
325 | +#: model:ir.module.module,shortdesc:account_invoice_tax_by_column.module_meta_information |
326 | +msgid "Account Invoice Tax - Computation By Column" |
327 | +msgstr "Imposte fattura - Calcolo per colonna" |
328 | + |
329 | +#. module: account_invoice_tax_by_column |
330 | +#: model:ir.model,name:account_invoice_tax_by_column.model_account_tax |
331 | +msgid "account.tax" |
332 | +msgstr "account.tax" |
333 | + |
334 | +#. module: account_invoice_tax_by_column |
335 | +#: sql_constraint:account.tax:0 |
336 | +msgid "The tax name must be unique!" |
337 | +msgstr "Il nome della tasse deve essere unico" |
338 | + |
339 | |
340 | === added file 'account_invoice_tax_by_column/invoice.py' |
341 | --- account_invoice_tax_by_column/invoice.py 1970-01-01 00:00:00 +0000 |
342 | +++ account_invoice_tax_by_column/invoice.py 2011-08-20 10:12:24 +0000 |
343 | @@ -0,0 +1,79 @@ |
344 | +# -*- encoding: utf-8 -*- |
345 | +############################################################################## |
346 | +# |
347 | +# OpenERP, Open Source Management Solution |
348 | +# Copyright (C) 2011 |
349 | +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) |
350 | +# |
351 | +# This program is free software: you can redistribute it and/or modify |
352 | +# it under the terms of the GNU Affero General Public License as |
353 | +# published by the Free Software Foundation, either version 3 of the |
354 | +# License, or (at your option) any later version. |
355 | +# |
356 | +# This program is distributed in the hope that it will be useful, |
357 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
358 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
359 | +# GNU Affero General Public License for more details. |
360 | +# |
361 | +# You should have received a copy of the GNU Affero General Public License |
362 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
363 | +# |
364 | +############################################################################## |
365 | +import time |
366 | +from osv import fields, osv |
367 | + |
368 | + |
369 | +class account_invoice_tax(osv.osv): |
370 | + _inherit = "account.invoice.tax" |
371 | + |
372 | + def compute(self, cr, uid, invoice_id, context=None): |
373 | + tax_grouped = super(account_invoice_tax, self).compute(cr, uid, invoice_id, context) |
374 | + total_base = 0 |
375 | + total_tax = {} |
376 | + total_amount_of_taxes_horizontal = 0 |
377 | + number_deductible_account = 0 |
378 | + cur_obj = self.pool.get('res.currency') |
379 | + inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context) |
380 | + cur = inv.currency_id |
381 | + for line in inv.invoice_line: |
382 | + # workout of total amount of taxes |
383 | + for tax in line.invoice_line_tax_id: |
384 | + key = tax['amount'] |
385 | + if not key in total_tax: |
386 | + # Total_tax |
387 | + total_tax[key] = [0] |
388 | + total_tax[key][0] += (line.price_unit* (1-(line.discount or 0.0)/100.0)) * tax['amount'] |
389 | + |
390 | + index = 0 |
391 | + for t in tax_grouped.values(): |
392 | + if inv.type in ('in_invoice') and t['base_code_id'] == False: |
393 | + number_deductible_account += 1 |
394 | + total_amount_of_taxes_horizontal += t['tax_amount'] |
395 | + |
396 | + total_amount_of_taxes_vertical = 0 |
397 | + # round the total amount of taxes |
398 | + for t in total_tax.values(): |
399 | + t[0] = cur_obj.round(cr, uid, cur, t[0]) |
400 | + total_amount_of_taxes_vertical += t[0] |
401 | + total_amount_of_taxes_vertical = cur_obj.round(cr, uid, cur, total_amount_of_taxes_vertical) |
402 | + total_amount_of_taxes_horizontal = cur_obj.round(cr, uid, cur, total_amount_of_taxes_horizontal) |
403 | + if number_deductible_account != 0: |
404 | + quotient = (total_amount_of_taxes_vertical - total_amount_of_taxes_horizontal) / number_deductible_account |
405 | + quotient = cur_obj.round(cr, uid, cur, quotient) |
406 | + remainder = (total_amount_of_taxes_vertical - total_amount_of_taxes_horizontal) - number_deductible_account * quotient |
407 | + remainder = cur_obj.round(cr, uid, cur, remainder) |
408 | + # change at least a deductible tax amount to to make coincide total amount of taxes |
409 | + counter = 0 |
410 | + if inv.type in ('in_invoice') and total_amount_of_taxes_vertical != total_amount_of_taxes_horizontal: |
411 | + for t in tax_grouped.values(): |
412 | + if t['base_code_id'] == False: |
413 | + counter += 1 |
414 | + t['tax_amount'] = t['tax_amount'] + quotient |
415 | + t['amount'] = t['amount'] + quotient |
416 | + if counter == number_deductible_account: |
417 | + t['tax_amount'] = t['tax_amount'] + remainder |
418 | + t['amount'] = t['amount'] + remainder |
419 | + return tax_grouped |
420 | + |
421 | +account_invoice_tax() |
422 | + |
423 | |
424 | === added directory 'account_invoice_tax_by_column/tests' |
425 | === added file 'account_invoice_tax_by_column/tests/tests.txt' |
426 | --- account_invoice_tax_by_column/tests/tests.txt 1970-01-01 00:00:00 +0000 |
427 | +++ account_invoice_tax_by_column/tests/tests.txt 2011-08-20 10:12:24 +0000 |
428 | @@ -0,0 +1,107 @@ |
429 | +Manual tests on tax calculation (should write automated tests) |
430 | + |
431 | +1) arrotondamento IVA ordinaria 20% |
432 | +fattura VENDJ/2011/016 |
433 | +IVA20 12,29 2,46 |
434 | +IVA20 12,29 2,46 |
435 | +IVA20 12,29 2,46 |
436 | +IVA10 |
437 | + |
438 | +IVA10 |
439 | + |
440 | +IVA10 |
441 | + |
442 | +IVA10 |
443 | + |
444 | +IVA10 |
445 | + |
446 | +IVA10 |
447 | + |
448 | +IVA10 |
449 | + |
450 | +IVA10 |
451 | + |
452 | +IVA10 |
453 | + |
454 | +somma 36,87 7,38 |
455 | + |
456 | + |
457 | + |
458 | +IVA10 0 0 |
459 | +IVA20 36,87 7,37 |
460 | + |
461 | + |
462 | + |
463 | + |
464 | + 36,87 7,37 |
465 | +L'IVA corretta è 7,37, e cioè il 20% del totale imponibile al 20% |
466 | + |
467 | +2) arrotondamento IVA ordinaria e agevolata 4% |
468 | +fattura VENDJ/2011/018 |
469 | +IVA4 12,33 0,49 |
470 | +IVA20 12,29 2,46 |
471 | +IVA20 12,29 2,46 |
472 | +IVA20 12,29 2,46 |
473 | +IVA4 12,33 0,49 |
474 | +IVA4 12,33 0,49 |
475 | +IVA20 12,29 2,46 |
476 | +IVA20 12,29 2,46 |
477 | +IVA20 12,29 2,46 |
478 | +IVA20 |
479 | + |
480 | +IVA20 |
481 | + |
482 | +IVA20 |
483 | + |
484 | + |
485 | + |
486 | + |
487 | +somma 110,73 16,23 |
488 | + |
489 | + |
490 | + |
491 | +IVA4 36,99 1,48 |
492 | +IVA20 73,74 14,75 |
493 | + |
494 | + |
495 | + |
496 | +TOTALE IVA 110,73 16,23 |
497 | + |
498 | +l'IVA viene correttamente ripartita fra IVA 4 ed IVA 20 |
499 | + |
500 | +arrotondamento IVA ordinaria 20% ed agevolata 10% |
501 | + |
502 | +fattura VENDJ/2011/019 |
503 | +IVA20 12,29 2,46 |
504 | +IVA20 12,29 2,46 |
505 | +IVA20 12,29 2,46 |
506 | +IVA10 10,56 1,06 |
507 | +IVA10 10,56 1,06 |
508 | +IVA10 10,56 1,06 |
509 | +IVA10 |
510 | + |
511 | +IVA10 |
512 | + |
513 | +IVA10 |
514 | + |
515 | +IVA10 |
516 | + |
517 | +IVA10 |
518 | + |
519 | +IVA10 |
520 | + |
521 | + |
522 | + |
523 | + |
524 | +somma 68,55 10,56 |
525 | + |
526 | + |
527 | + |
528 | +IVA10 31,68 3,17 |
529 | +IVA20 36,87 7,37 |
530 | + |
531 | + |
532 | + |
533 | +TOTALE IVA 68,55 10,54 |
534 | + |
535 | +L'IVA viene correttamente calcolata ed indicata secondo le aliquote |
Non appena qualcuno conferma che il modulo 'l10n_it_ invoice_ tax' effettua correttamente il calcolo delle tasse sulle righe della fattura, possiamo approvare il merge sul repository ufficiale