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

Proposed by Lorenzo Battistini on 2013-04-17
Status: Merged
Merged at revision: 221
Proposed branch: lp:~elbati/openobject-italia/l10n_it_withholding_tax_7
Merge into: lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0
Diff against target: 679 lines (+635/-0)
8 files modified
l10n_it_withholding_tax/AUTHORS.txt (+2/-0)
l10n_it_withholding_tax/__init__.py (+24/-0)
l10n_it_withholding_tax/__openerp__.py (+60/-0)
l10n_it_withholding_tax/account.py (+204/-0)
l10n_it_withholding_tax/account_demo.xml (+19/-0)
l10n_it_withholding_tax/account_view.xml (+71/-0)
l10n_it_withholding_tax/i18n/it.po (+150/-0)
l10n_it_withholding_tax/test/purchase_payment.yml (+105/-0)
To merge this branch: bzr merge lp:~elbati/openobject-italia/l10n_it_withholding_tax_7
Reviewer Review Type Date Requested Status
Lorenzo Battistini Approve on 2013-07-22
Review via email: mp+159380@code.launchpad.net
To post a comment you must log in.
217. By Lorenzo Battistini on 2013-04-17

[add] tests first version

218. By Lorenzo Battistini on 2013-04-17

[imp] tests

219. By Lorenzo Battistini on 2013-04-17

[imp] tests

220. By Lorenzo Battistini on 2013-04-26

[ADD] field help

221. By Lorenzo Battistini on 2013-05-09

[fix] using right date and period when paying

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'l10n_it_withholding_tax'
2=== added file 'l10n_it_withholding_tax/AUTHORS.txt'
3--- l10n_it_withholding_tax/AUTHORS.txt 1970-01-01 00:00:00 +0000
4+++ l10n_it_withholding_tax/AUTHORS.txt 2013-05-09 14:32:26 +0000
5@@ -0,0 +1,2 @@
6+Lorenzo Battistini <lorenzo.battistini@agilebg.com>
7+Paolo Chiara <p.chiara@isa.it>
8
9=== added file 'l10n_it_withholding_tax/__init__.py'
10--- l10n_it_withholding_tax/__init__.py 1970-01-01 00:00:00 +0000
11+++ l10n_it_withholding_tax/__init__.py 2013-05-09 14:32:26 +0000
12@@ -0,0 +1,24 @@
13+# -*- coding: utf-8 -*-
14+##############################################################################
15+#
16+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
17+# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
18+# Copyright (C) 2012-2013 Associazione OpenERP Italia
19+# (<http://www.openerp-italia.org>).
20+#
21+# This program is free software: you can redistribute it and/or modify
22+# it under the terms of the GNU Affero General Public License as published by
23+# the Free Software Foundation, either version 3 of the License, or
24+# (at your option) any later version.
25+#
26+# This program is distributed in the hope that it will be useful,
27+# but WITHOUT ANY WARRANTY; without even the implied warranty of
28+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+# GNU Affero General Public License for more details.
30+#
31+# You should have received a copy of the GNU Affero General Public License
32+# along with this program. If not, see <http://www.gnu.org/licenses/>.
33+#
34+##############################################################################
35+
36+import account
37
38=== added file 'l10n_it_withholding_tax/__openerp__.py'
39--- l10n_it_withholding_tax/__openerp__.py 1970-01-01 00:00:00 +0000
40+++ l10n_it_withholding_tax/__openerp__.py 2013-05-09 14:32:26 +0000
41@@ -0,0 +1,60 @@
42+# -*- coding: utf-8 -*-
43+##############################################################################
44+#
45+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
46+# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
47+# Copyright (C) 2012-2013 Associazione OpenERP Italia
48+# (<http://www.openerp-italia.org>).
49+#
50+# This program is free software: you can redistribute it and/or modify
51+# it under the terms of the GNU Affero General Public License as published by
52+# the Free Software Foundation, either version 3 of the License, or
53+# (at your option) any later version.
54+#
55+# This program is distributed in the hope that it will be useful,
56+# but WITHOUT ANY WARRANTY; without even the implied warranty of
57+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58+# GNU Affero General Public License for more details.
59+#
60+# You should have received a copy of the GNU Affero General Public License
61+# along with this program. If not, see <http://www.gnu.org/licenses/>.
62+#
63+##############################################################################
64+{
65+ 'name': "Italian Localisation - Withholding tax",
66+ 'version': '0.2',
67+ 'category': 'Localisation/Italy',
68+ 'description': """
69+Ritenute d'acconto sulle fatture fornitore
70+==========================================
71+
72+Per utilizzare il modulo bisogna configurare i campi associati alla company:
73+ - Termine di pagamento della ritenuta
74+ - Conto di debito per le ritenute da versare
75+ - Sezionale che conterrà le registrazioni legate alla ritenuta
76+
77+Durante la compilazione di una fattura fornitore con ritenuta d'acconto, l'utente dovrà specificare l'importo della ritenuta.
78+
79+Requisiti
80+---------
81+http://wiki.openerp-italia.org/doku.php/area_utente/requisiti/ritenuta_d_acconto
82+
83+Howto
84+-----
85+http://planet.domsense.com/2012/06/come-registrare-in-openerp-le-fatture-fornitore-con-ritenuta-dacconto/
86+""",
87+ 'author': 'OpenERP Italian Community',
88+ 'website': 'http://www.openerp-italia.org',
89+ 'license': 'AGPL-3',
90+ "depends" : ['account_voucher_cash_basis'],
91+ "data" : [
92+ 'account_view.xml',],
93+ "demo" : [
94+ 'account_demo.xml',
95+ ],
96+ 'test' : [
97+ 'test/purchase_payment.yml',
98+ ],
99+ "active": False,
100+ "installable": True
101+}
102
103=== added file 'l10n_it_withholding_tax/account.py'
104--- l10n_it_withholding_tax/account.py 1970-01-01 00:00:00 +0000
105+++ l10n_it_withholding_tax/account.py 2013-05-09 14:32:26 +0000
106@@ -0,0 +1,204 @@
107+# -*- coding: utf-8 -*-
108+##############################################################################
109+#
110+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
111+# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
112+# Copyright (C) 2012-2013 Associazione OpenERP Italia
113+# (<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 published by
117+# the Free Software Foundation, either version 3 of the License, or
118+# (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 openerp.osv import fields, orm
131+from openerp.tools.translate import _
132+import decimal_precision as dp
133+
134+class res_company(orm.Model):
135+ _inherit = 'res.company'
136+ _columns = {
137+ 'withholding_payment_term_id': fields.many2one('account.payment.term',
138+ 'Withholding tax Payment Term',
139+ help="The withholding tax will have to be paid within this term"),
140+ 'withholding_account_id': fields.many2one('account.account','Withholding account',
141+ help='Payable account used for amount due to tax authority',
142+ domain=[('type', '=', 'payable')]),
143+ 'withholding_journal_id': fields.many2one('account.journal','Withholding journal',
144+ help="Journal used for registration of witholding amounts to be paid"),
145+ 'authority_partner_id': fields.many2one('res.partner', 'Tax Authority Partner'),
146+ }
147+
148+class account_config_settings(orm.TransientModel):
149+ _inherit = 'account.config.settings'
150+ _columns = {
151+ 'withholding_payment_term_id': fields.related(
152+ 'company_id', 'withholding_payment_term_id',
153+ type='many2one',
154+ relation="account.payment.term",
155+ string="Withholding tax Payment Term"),
156+ 'withholding_account_id': fields.related(
157+ 'company_id', 'withholding_account_id',
158+ type='many2one',
159+ relation="account.account",
160+ string="Withholding account",
161+ help='Payable account used for amount due to tax authority',
162+ domain=[('type', '=', 'payable')]),
163+ 'withholding_journal_id': fields.related(
164+ 'company_id', 'withholding_journal_id',
165+ type='many2one',
166+ relation="account.journal",
167+ string="Withholding journal",
168+ help='Journal used for registration of witholding amounts to be paid'),
169+ 'authority_partner_id': fields.related(
170+ 'company_id', 'authority_partner_id',
171+ type='many2one',
172+ relation="res.partner",
173+ string="Tax Authority Partner"),
174+ }
175+
176+ def onchange_company_id(self, cr, uid, ids, company_id, context=None):
177+ res = super(account_config_settings, self).onchange_company_id(cr, uid, ids, company_id, context=context)
178+ if company_id:
179+ company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
180+ res['value'].update({
181+ 'withholding_payment_term_id': (company.withholding_payment_term_id
182+ and company.withholding_payment_term_id.id or False),
183+ 'withholding_account_id': (company.withholding_account_id
184+ and company.withholding_account_id.id or False),
185+ 'withholding_journal_id': (company.withholding_journal_id
186+ and company.withholding_journal_id.id or False),
187+ 'authority_partner_id': (company.authority_partner_id
188+ and company.authority_partner_id.id or False),
189+ })
190+ else:
191+ res['value'].update({
192+ 'withholding_payment_term_id': False,
193+ 'withholding_account_id': False,
194+ 'withholding_journal_id': False,
195+ 'authority_partner_id': False,
196+ })
197+ return res
198+
199+class account_invoice(orm.Model):
200+
201+ def _net_pay(self, cr, uid, ids, field_name, arg, context=None):
202+ res = {}
203+ for invoice in self.browse(cr, uid, ids, context):
204+ res[invoice.id] = invoice.amount_total - invoice.withholding_amount
205+ return res
206+
207+ _inherit = "account.invoice"
208+
209+ _columns = {
210+ 'withholding_amount': fields.float('Withholding amount', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}),
211+ 'has_withholding': fields.boolean('With withholding tax', readonly=True, states={'draft':[('readonly',False)]}),
212+ 'net_pay': fields.function(_net_pay, string="Net Pay"),
213+ }
214+
215+class account_voucher(orm.Model):
216+ _inherit = "account.voucher"
217+
218+ _columns = {
219+ 'withholding_move_ids': fields.many2many('account.move', 'voucher_withholding_move_rel', 'voucher_id', 'move_id', 'Withholding Tax Entries', readonly=True),
220+ }
221+
222+ def reconcile_withholding_move(self, cr, uid, invoice, wh_move, context=None):
223+ line_pool=self.pool.get('account.move.line')
224+ rec_ids = []
225+ for inv_move_line in invoice.move_id.line_id:
226+ if inv_move_line.account_id.type == 'payable' and not inv_move_line.reconcile_id:
227+ rec_ids.append(inv_move_line.id)
228+ for wh_line in wh_move.line_id:
229+ if wh_line.account_id.type == 'payable' and invoice.company_id.withholding_account_id and invoice.company_id.withholding_account_id.id != wh_line.account_id.id and not wh_line.reconcile_id:
230+ rec_ids.append(wh_line.id)
231+ return line_pool.reconcile_partial(cr, uid, rec_ids, type='auto', context=context)
232+
233+ def action_move_line_create(self, cr, uid, ids, context=None):
234+ res = super(account_voucher,self).action_move_line_create(cr, uid, ids, context)
235+ inv_pool = self.pool.get('account.invoice')
236+ move_pool = self.pool.get('account.move')
237+ tax_pool = self.pool.get('account.tax')
238+ curr_pool = self.pool.get('res.currency')
239+ term_pool = self.pool.get('account.payment.term')
240+ priod_obj = self.pool.get('account.period')
241+ for voucher in self.browse(cr, uid, ids, context):
242+ amounts_by_invoice = super(account_voucher,self).allocated_amounts_grouped_by_invoice(cr, uid,voucher, context)
243+ for inv_id in amounts_by_invoice:
244+ invoice = inv_pool.browse(cr, uid, inv_id, context)
245+ if invoice.withholding_amount:
246+ # only for supplier payments
247+ if voucher.type != 'payment':
248+ raise orm.except_orm(_('Error'), _('Can\'t handle withholding tax with voucher of type other than payment'))
249+ if not invoice.company_id.withholding_account_id:
250+ raise orm.except_orm(_('Error'), _('The company does not have an associated Withholding account') )
251+ if not invoice.company_id.withholding_payment_term_id:
252+ raise orm.except_orm(_('Error'), _('The company does not have an associated Withholding Payment Term') )
253+ if not invoice.company_id.withholding_journal_id:
254+ raise orm.except_orm(_('Error'), _('The company does not have an associated Withholding journal') )
255+ if not invoice.company_id.authority_partner_id:
256+ raise orm.except_orm(_('Error'), _('The company does not have an associated Tax Authority partner') )
257+ # compute the new amount proportionally to paid amount
258+ new_line_amount = curr_pool.round(cr, uid, voucher.company_id.currency_id, ((amounts_by_invoice[invoice.id]['allocated'] + amounts_by_invoice[invoice.id]['write-off']) / invoice.net_pay) * invoice.withholding_amount)
259+
260+ # compute the due date
261+ due_list = term_pool.compute(
262+ cr, uid, invoice.company_id.withholding_payment_term_id.id, new_line_amount,
263+ date_ref=voucher.date or invoice.date_invoice, context=context)
264+ if len(due_list) > 1:
265+ raise orm.except_orm(_('Error'),
266+ _('The payment term %s has too many due dates')
267+ % invoice.company_id.withholding_payment_term_id.name)
268+ if len(due_list) == 0:
269+ raise orm.except_orm(_('Error'),
270+ _('The payment term %s does not have due dates')
271+ % invoice.company_id.withholding_payment_term_id.name)
272+
273+ period_ids = priod_obj.find(cr, uid, dt=voucher.date, context=context)
274+ new_move = {
275+ 'journal_id': invoice.company_id.withholding_journal_id.id,
276+ 'period_id': period_ids and period_ids[0] or False,
277+ 'date': voucher.date,
278+ 'line_id': [
279+ (0,0,{
280+ 'name': invoice.number,
281+ 'account_id': invoice.account_id.id,
282+ 'partner_id': invoice.partner_id.id,
283+ 'debit': new_line_amount,
284+ 'credit': 0.0,
285+ }),
286+ (0,0,{
287+ 'name': _('Payable withholding - ') + invoice.number,
288+ 'account_id': invoice.company_id.withholding_account_id.id,
289+ 'partner_id': invoice.company_id.authority_partner_id.id,
290+ 'debit': 0.0,
291+ 'credit': new_line_amount,
292+ 'date_maturity': due_list[0][0],
293+ }),
294+ ]
295+ }
296+ move_id = self.pool.get('account.move').create(cr, uid, new_move, context=context)
297+ self.reconcile_withholding_move(cr, uid, invoice, move_pool.browse(cr, uid, move_id, context), context)
298+ voucher.write({'withholding_move_ids': [(4, move_id)]})
299+ return res
300+
301+ def cancel_voucher(self, cr, uid, ids, context=None):
302+ res = super(account_voucher,self).cancel_voucher(cr, uid, ids, context)
303+ reconcile_pool = self.pool.get('account.move.reconcile')
304+ move_pool = self.pool.get('account.move')
305+ for voucher in self.browse(cr, uid, ids, context=context):
306+ recs = []
307+ for move in voucher.withholding_move_ids:
308+ move_pool.button_cancel(cr, uid, [move.id])
309+ move_pool.unlink(cr, uid, [move.id])
310+ return res
311
312=== added file 'l10n_it_withholding_tax/account_demo.xml'
313--- l10n_it_withholding_tax/account_demo.xml 1970-01-01 00:00:00 +0000
314+++ l10n_it_withholding_tax/account_demo.xml 2013-05-09 14:32:26 +0000
315@@ -0,0 +1,19 @@
316+<?xml version="1.0" encoding="utf-8"?>
317+<openerp>
318+ <data noupdate="1">
319+
320+ <record id="a_witholding" model="account.account">
321+ <field name="code">X1115</field>
322+ <field name="name">Withholding tax to pay</field>
323+ <field ref="account.cli" name="parent_id"/>
324+ <field name="type">payable</field>
325+ <field eval="True" name="reconcile"/>
326+ <field name="user_type" ref="account.data_account_type_payable"/>
327+ </record>
328+ <record id="tax_authority" model="res.partner">
329+ <field name="name">Tax authority</field>
330+ <field eval="1" name="supplier"/>
331+ </record>
332+
333+ </data>
334+</openerp>
335
336=== added file 'l10n_it_withholding_tax/account_view.xml'
337--- l10n_it_withholding_tax/account_view.xml 1970-01-01 00:00:00 +0000
338+++ l10n_it_withholding_tax/account_view.xml 2013-05-09 14:32:26 +0000
339@@ -0,0 +1,71 @@
340+<?xml version="1.0" encoding="utf-8"?>
341+<openerp>
342+ <data>
343+
344+<!-- company -->
345+
346+ <record id="view_account_config_settings" model="ir.ui.view">
347+ <field name="name">view_account_config_settings</field>
348+ <field name="model">account.config.settings</field>
349+ <field name="inherit_id" ref="account.view_account_config_settings"/>
350+ <field name="arch" type="xml">
351+ <xpath expr="/form/group[6]" position="after">
352+ <separator string="Witholding Tax"/>
353+ <group name="withholding_tax">
354+ <label for="id" string="Configuration"/>
355+ <div>
356+ <div>
357+ <label for="withholding_payment_term_id"/>
358+ <field name="withholding_payment_term_id" class="oe_inline"/>
359+ </div>
360+ <div>
361+ <label for="withholding_account_id"/>
362+ <field name="withholding_account_id" class="oe_inline"/>
363+ </div>
364+ <div>
365+ <label for="withholding_journal_id"/>
366+ <field name="withholding_journal_id" class="oe_inline"/>
367+ </div>
368+ <div>
369+ <label for="authority_partner_id"/>
370+ <field name="authority_partner_id" class="oe_inline"/>
371+ </div>
372+ </div>
373+ </group>
374+ </xpath>
375+ </field>
376+ </record>
377+
378+ <!-- invoice -->
379+
380+ <record id="invoice_supplier_form" model="ir.ui.view">
381+ <field name="name">account.invoice.supplier.form</field>
382+ <field name="model">account.invoice</field>
383+ <field name="inherit_id" ref="account.invoice_supplier_form"/>
384+ <field name="arch" type="xml">
385+ <field name="date_due" position="after">
386+ <field name="has_withholding"/>
387+ </field>
388+ <field name="amount_total" position="after">
389+ <field name="withholding_amount" attrs="{'invisible': [('has_withholding', '=', False)]}"/>
390+ <field name="net_pay" attrs="{'invisible': [('has_withholding', '=', False)]}"/>
391+ </field>
392+ </field>
393+ </record>
394+
395+ <!-- voucher -->
396+
397+ <record id="view_vendor_payment_form_wh_move" model="ir.ui.view">
398+ <field name="name">account.voucher.payment.form.wh.move</field>
399+ <field name="model">account.voucher</field>
400+ <field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
401+ <field name="arch" type="xml">
402+ <field name="move_ids" position="after">
403+ <separator string="Withholding tax entries" colspan="4"></separator>
404+ <field name="withholding_move_ids" colspan="4" nolabel="1"/>
405+ </field>
406+ </field>
407+ </record>
408+
409+ </data>
410+</openerp>
411
412=== added directory 'l10n_it_withholding_tax/i18n'
413=== added file 'l10n_it_withholding_tax/i18n/it.mo'
414Binary files l10n_it_withholding_tax/i18n/it.mo 1970-01-01 00:00:00 +0000 and l10n_it_withholding_tax/i18n/it.mo 2013-05-09 14:32:26 +0000 differ
415=== added file 'l10n_it_withholding_tax/i18n/it.po'
416--- l10n_it_withholding_tax/i18n/it.po 1970-01-01 00:00:00 +0000
417+++ l10n_it_withholding_tax/i18n/it.po 2013-05-09 14:32:26 +0000
418@@ -0,0 +1,150 @@
419+# Translation of OpenERP Server.
420+# This file contains the translation of the following modules:
421+# * l10n_it_withholding_tax
422+#
423+msgid ""
424+msgstr ""
425+"Project-Id-Version: OpenERP Server 6.1\n"
426+"Report-Msgid-Bugs-To: \n"
427+"POT-Creation-Date: 2012-10-12 15:54+0000\n"
428+"PO-Revision-Date: 2012-10-12 18:02+0100\n"
429+"Last-Translator: Franco Tampieri <info@francotampieri.com>\n"
430+"Language-Team: \n"
431+"MIME-Version: 1.0\n"
432+"Content-Type: text/plain; charset=UTF-8\n"
433+"Content-Transfer-Encoding: 8bit\n"
434+"Plural-Forms: \n"
435+
436+#. module: l10n_it_withholding_tax
437+#: code:addons/l10n_it_withholding_tax/account.py:90
438+#, python-format
439+msgid "The company does not have an associated Withholding Payment Term"
440+msgstr "L'Azienda non ha associato nessun Termine di pagamento per le Ritenute"
441+
442+#. module: l10n_it_withholding_tax
443+#: constraint:res.company:0
444+msgid "Error! You can not create recursive companies."
445+msgstr "Errore! Non è possibile creare aziende ricorsive."
446+
447+#. module: l10n_it_withholding_tax
448+#: code:addons/l10n_it_withholding_tax/account.py:106
449+#, python-format
450+msgid "The payment term %s does not have due dates"
451+msgstr "The payment term %s does not have due dates"
452+
453+#. module: l10n_it_withholding_tax
454+#: code:addons/l10n_it_withholding_tax/account.py:102
455+#, python-format
456+msgid "The payment term %s has too many due dates"
457+msgstr "The payment term %s has too many due dates"
458+
459+#. module: l10n_it_withholding_tax
460+#: view:account.voucher:0
461+msgid "Withholding tax entries"
462+msgstr "Voci Tasse Ritenute"
463+
464+#. module: l10n_it_withholding_tax
465+#: field:account.invoice,has_withholding:0
466+msgid "With withholding tax"
467+msgstr "Con tasse ritenute"
468+
469+#. module: l10n_it_withholding_tax
470+#: field:res.company,withholding_payment_term_id:0
471+msgid "Withholding tax Payment Term"
472+msgstr "Termini Pagamento Ritenute"
473+
474+#. module: l10n_it_withholding_tax
475+#: field:res.company,withholding_account_id:0
476+msgid "Withholding account"
477+msgstr "Conto Ritenute"
478+
479+#. module: l10n_it_withholding_tax
480+#: sql_constraint:res.company:0
481+msgid "The company name must be unique !"
482+msgstr "Il nome azienda deve essere unico!"
483+
484+#. module: l10n_it_withholding_tax
485+#: field:account.invoice,net_pay:0
486+msgid "Net Pay"
487+msgstr "Netto da Pagare"
488+
489+#. module: l10n_it_withholding_tax
490+#: model:ir.model,name:l10n_it_withholding_tax.model_res_company
491+msgid "Companies"
492+msgstr "Aziende"
493+
494+#. module: l10n_it_withholding_tax
495+#: code:addons/l10n_it_withholding_tax/account.py:92
496+#, python-format
497+msgid "The company does not have an associated Withholding journal"
498+msgstr "L'Azienda non ha un Sezionale associato per le Ritenute"
499+
500+#. module: l10n_it_withholding_tax
501+#: code:addons/l10n_it_withholding_tax/account.py:86
502+#: code:addons/l10n_it_withholding_tax/account.py:88
503+#: code:addons/l10n_it_withholding_tax/account.py:90
504+#: code:addons/l10n_it_withholding_tax/account.py:92
505+#: code:addons/l10n_it_withholding_tax/account.py:101
506+#: code:addons/l10n_it_withholding_tax/account.py:105
507+#, python-format
508+msgid "Error"
509+msgstr "Errore"
510+
511+#. module: l10n_it_withholding_tax
512+#: code:addons/l10n_it_withholding_tax/account.py:86
513+#, python-format
514+msgid "Can't handle withholding tax with voucher of type other than payment"
515+msgstr "Can't handle withholding tax with voucher of type other than payment"
516+
517+#. module: l10n_it_withholding_tax
518+#: help:res.company,withholding_account_id:0
519+msgid "Payable account used for amount due to tax authority"
520+msgstr "Payable account used for amount due to tax authority"
521+
522+#. module: l10n_it_withholding_tax
523+#: sql_constraint:account.invoice:0
524+msgid "Invoice Number must be unique per Company!"
525+msgstr "Nell'azienda il numero fattura dev'essere univoco!"
526+
527+#. module: l10n_it_withholding_tax
528+#: help:res.company,withholding_journal_id:0
529+msgid "Journal used for registration of witholding amounts to be paid"
530+msgstr "Journal used for registration of witholding amounts to be paid"
531+
532+#. module: l10n_it_withholding_tax
533+#: code:addons/l10n_it_withholding_tax/account.py:119
534+#, python-format
535+msgid "Payable withholding - "
536+msgstr "Ritenute Pagabili - "
537+
538+#. module: l10n_it_withholding_tax
539+#: model:ir.model,name:l10n_it_withholding_tax.model_account_voucher
540+msgid "Accounting Voucher"
541+msgstr "Voucher contabile"
542+
543+#. module: l10n_it_withholding_tax
544+#: field:account.invoice,withholding_amount:0
545+msgid "Withholding amount"
546+msgstr "Totale Ritenute"
547+
548+#. module: l10n_it_withholding_tax
549+#: model:ir.model,name:l10n_it_withholding_tax.model_account_invoice
550+msgid "Invoice"
551+msgstr "Fattura"
552+
553+#. module: l10n_it_withholding_tax
554+#: field:res.company,withholding_journal_id:0
555+msgid "Withholding journal"
556+msgstr "Sezionale Ritenute"
557+
558+#. module: l10n_it_withholding_tax
559+#: code:addons/l10n_it_withholding_tax/account.py:88
560+#, python-format
561+msgid "The company does not have an associated Withholding account"
562+msgstr "L'Azienda non ha un conto associato per le Ritenute"
563+
564+#. module: l10n_it_withholding_tax
565+#: field:account.voucher,withholding_move_ids:0
566+msgid "Withholding Tax Entries"
567+msgstr "Voci Tasse Ritenute"
568+
569
570=== added directory 'l10n_it_withholding_tax/test'
571=== added file 'l10n_it_withholding_tax/test/purchase_payment.yml'
572--- l10n_it_withholding_tax/test/purchase_payment.yml 1970-01-01 00:00:00 +0000
573+++ l10n_it_withholding_tax/test/purchase_payment.yml 2013-05-09 14:32:26 +0000
574@@ -0,0 +1,105 @@
575+-
576+ I configure the main company
577+-
578+ !record {model: res.company, id: base.main_company}:
579+ withholding_payment_term_id: account.account_payment_term
580+ withholding_account_id: a_witholding
581+ withholding_journal_id: account.miscellaneous_journal
582+ authority_partner_id: tax_authority
583+-
584+ In order to test account invoice I create a new supplier invoice
585+-
586+ I create a Tax Codes
587+-
588+ !record {model: account.tax.code, id: tax_case}:
589+ name: Tax_case
590+ company_id: base.main_company
591+ sign: 1
592+-
593+ I create a Tax
594+-
595+ !record {model: account.tax, id: tax10}:
596+ name: Tax 10.0
597+ amount: 10.0
598+ type: fixed
599+ sequence: 1
600+ company_id: base.main_company
601+ type_tax_use: all
602+ tax_code_id: tax_case
603+-
604+ I set the context
605+-
606+ !context
607+ 'type': 'in_invoice'
608+-
609+ I create a supplier invoice
610+-
611+ !record {model: account.invoice, id: account_invoice_supplier_0, view: invoice_supplier_form}:
612+ account_id: account.a_pay
613+ company_id: base.main_company
614+ currency_id: base.EUR
615+ invoice_line:
616+ - account_id: account.a_expense
617+ name: 'Lawyer service'
618+ price_unit: 100.0
619+ quantity: 1.0
620+ invoice_line_tax_id:
621+ - tax10
622+ journal_id: account.expenses_journal
623+ partner_id: base.res_partner_12
624+ has_withholding: True
625+ withholding_amount: 20.0
626+-
627+ I check that Initially supplier invoice state is "Draft"
628+-
629+ !assert {model: account.invoice, id: account_invoice_supplier_0}:
630+ - state == 'draft'
631+-
632+ I change the state of invoice to open by clicking Validate button
633+-
634+ !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier_0}
635+-
636+ I check that the invoice state is now "Open" and 'Net Pay' is 90
637+-
638+ !assert {model: account.invoice, id: account_invoice_supplier_0}:
639+ - state == 'open'
640+ - net_pay == 90.0
641+-
642+ I create the voucher of payment with 90
643+-
644+ !record {model: account.voucher, id: account_voucher_0, view: account_voucher.view_vendor_payment_form}:
645+ account_id: account.cash
646+ amount: 90.0
647+ company_id: base.main_company
648+ journal_id: account.bank_journal
649+ name: 'Payment: invoice 0'
650+ partner_id: base.res_partner_12
651+ period_id: account.period_3
652+ date: !eval time.strftime("%Y-03-10")
653+ type: 'payment'
654+-
655+ I check voucher state is draft
656+-
657+ !assert {model: account.voucher, id: account_voucher_0}:
658+ - state == 'draft'
659+-
660+ I confirm the voucher
661+-
662+ !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_0}
663+-
664+ I check the entries
665+-
666+ !python {model: account.voucher}: |
667+ import time
668+ voucher = self.browse(cr, uid, ref('account_voucher_0'))
669+ assert (voucher.state=='posted'), "Voucher is not in posted state: %s" % voucher.state
670+ assert (len(voucher.withholding_move_ids) == 1), "Withholding entry must be one, not %s" % len(voucher.withholding_move_ids)
671+ for move_line in voucher.withholding_move_ids[0].line_id:
672+ if move_line.account_id.id == ref('a_witholding'):
673+ assert (move_line.credit==20.0), "withholding move line credit must be 20 instead of %s" % move_line.credit
674+ assert (move_line.date_maturity==time.strftime("%Y-04-30")), "due date must be %s instead of %s" % (time.strftime("%Y-04-30"),move_line.date_maturity)
675+-
676+ Finally i will Confirm the state of the invoice is paid
677+-
678+ !assert {model: account.invoice, id: account_invoice_supplier_0}:
679+ - state == 'paid'

Subscribers

People subscribed via source and target branches