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
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
Review via email: mp+159380@code.launchpad.net
To post a comment you must log in.
217. By Lorenzo Battistini

[add] tests first version

218. By Lorenzo Battistini

[imp] tests

219. By Lorenzo Battistini

[imp] tests

220. By Lorenzo Battistini

[ADD] field help

221. By Lorenzo Battistini

[fix] using right date and period when paying

Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'l10n_it_withholding_tax'
=== added file 'l10n_it_withholding_tax/AUTHORS.txt'
--- l10n_it_withholding_tax/AUTHORS.txt 1970-01-01 00:00:00 +0000
+++ l10n_it_withholding_tax/AUTHORS.txt 2013-05-09 14:32:26 +0000
@@ -0,0 +1,2 @@
1Lorenzo Battistini <lorenzo.battistini@agilebg.com>
2Paolo Chiara <p.chiara@isa.it>
03
=== added file 'l10n_it_withholding_tax/__init__.py'
--- l10n_it_withholding_tax/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_it_withholding_tax/__init__.py 2013-05-09 14:32:26 +0000
@@ -0,0 +1,24 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
5# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
6# Copyright (C) 2012-2013 Associazione OpenERP Italia
7# (<http://www.openerp-italia.org>).
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23
24import account
025
=== added file 'l10n_it_withholding_tax/__openerp__.py'
--- l10n_it_withholding_tax/__openerp__.py 1970-01-01 00:00:00 +0000
+++ l10n_it_withholding_tax/__openerp__.py 2013-05-09 14:32:26 +0000
@@ -0,0 +1,60 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
5# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
6# Copyright (C) 2012-2013 Associazione OpenERP Italia
7# (<http://www.openerp-italia.org>).
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23{
24 'name': "Italian Localisation - Withholding tax",
25 'version': '0.2',
26 'category': 'Localisation/Italy',
27 'description': """
28Ritenute d'acconto sulle fatture fornitore
29==========================================
30
31Per utilizzare il modulo bisogna configurare i campi associati alla company:
32 - Termine di pagamento della ritenuta
33 - Conto di debito per le ritenute da versare
34 - Sezionale che conterrà le registrazioni legate alla ritenuta
35
36Durante la compilazione di una fattura fornitore con ritenuta d'acconto, l'utente dovrà specificare l'importo della ritenuta.
37
38Requisiti
39---------
40http://wiki.openerp-italia.org/doku.php/area_utente/requisiti/ritenuta_d_acconto
41
42Howto
43-----
44http://planet.domsense.com/2012/06/come-registrare-in-openerp-le-fatture-fornitore-con-ritenuta-dacconto/
45""",
46 'author': 'OpenERP Italian Community',
47 'website': 'http://www.openerp-italia.org',
48 'license': 'AGPL-3',
49 "depends" : ['account_voucher_cash_basis'],
50 "data" : [
51 'account_view.xml',],
52 "demo" : [
53 'account_demo.xml',
54 ],
55 'test' : [
56 'test/purchase_payment.yml',
57 ],
58 "active": False,
59 "installable": True
60}
061
=== added file 'l10n_it_withholding_tax/account.py'
--- l10n_it_withholding_tax/account.py 1970-01-01 00:00:00 +0000
+++ l10n_it_withholding_tax/account.py 2013-05-09 14:32:26 +0000
@@ -0,0 +1,204 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
5# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
6# Copyright (C) 2012-2013 Associazione OpenERP Italia
7# (<http://www.openerp-italia.org>).
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23
24from openerp.osv import fields, orm
25from openerp.tools.translate import _
26import decimal_precision as dp
27
28class res_company(orm.Model):
29 _inherit = 'res.company'
30 _columns = {
31 'withholding_payment_term_id': fields.many2one('account.payment.term',
32 'Withholding tax Payment Term',
33 help="The withholding tax will have to be paid within this term"),
34 'withholding_account_id': fields.many2one('account.account','Withholding account',
35 help='Payable account used for amount due to tax authority',
36 domain=[('type', '=', 'payable')]),
37 'withholding_journal_id': fields.many2one('account.journal','Withholding journal',
38 help="Journal used for registration of witholding amounts to be paid"),
39 'authority_partner_id': fields.many2one('res.partner', 'Tax Authority Partner'),
40 }
41
42class account_config_settings(orm.TransientModel):
43 _inherit = 'account.config.settings'
44 _columns = {
45 'withholding_payment_term_id': fields.related(
46 'company_id', 'withholding_payment_term_id',
47 type='many2one',
48 relation="account.payment.term",
49 string="Withholding tax Payment Term"),
50 'withholding_account_id': fields.related(
51 'company_id', 'withholding_account_id',
52 type='many2one',
53 relation="account.account",
54 string="Withholding account",
55 help='Payable account used for amount due to tax authority',
56 domain=[('type', '=', 'payable')]),
57 'withholding_journal_id': fields.related(
58 'company_id', 'withholding_journal_id',
59 type='many2one',
60 relation="account.journal",
61 string="Withholding journal",
62 help='Journal used for registration of witholding amounts to be paid'),
63 'authority_partner_id': fields.related(
64 'company_id', 'authority_partner_id',
65 type='many2one',
66 relation="res.partner",
67 string="Tax Authority Partner"),
68 }
69
70 def onchange_company_id(self, cr, uid, ids, company_id, context=None):
71 res = super(account_config_settings, self).onchange_company_id(cr, uid, ids, company_id, context=context)
72 if company_id:
73 company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
74 res['value'].update({
75 'withholding_payment_term_id': (company.withholding_payment_term_id
76 and company.withholding_payment_term_id.id or False),
77 'withholding_account_id': (company.withholding_account_id
78 and company.withholding_account_id.id or False),
79 'withholding_journal_id': (company.withholding_journal_id
80 and company.withholding_journal_id.id or False),
81 'authority_partner_id': (company.authority_partner_id
82 and company.authority_partner_id.id or False),
83 })
84 else:
85 res['value'].update({
86 'withholding_payment_term_id': False,
87 'withholding_account_id': False,
88 'withholding_journal_id': False,
89 'authority_partner_id': False,
90 })
91 return res
92
93class account_invoice(orm.Model):
94
95 def _net_pay(self, cr, uid, ids, field_name, arg, context=None):
96 res = {}
97 for invoice in self.browse(cr, uid, ids, context):
98 res[invoice.id] = invoice.amount_total - invoice.withholding_amount
99 return res
100
101 _inherit = "account.invoice"
102
103 _columns = {
104 'withholding_amount': fields.float('Withholding amount', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}),
105 'has_withholding': fields.boolean('With withholding tax', readonly=True, states={'draft':[('readonly',False)]}),
106 'net_pay': fields.function(_net_pay, string="Net Pay"),
107 }
108
109class account_voucher(orm.Model):
110 _inherit = "account.voucher"
111
112 _columns = {
113 'withholding_move_ids': fields.many2many('account.move', 'voucher_withholding_move_rel', 'voucher_id', 'move_id', 'Withholding Tax Entries', readonly=True),
114 }
115
116 def reconcile_withholding_move(self, cr, uid, invoice, wh_move, context=None):
117 line_pool=self.pool.get('account.move.line')
118 rec_ids = []
119 for inv_move_line in invoice.move_id.line_id:
120 if inv_move_line.account_id.type == 'payable' and not inv_move_line.reconcile_id:
121 rec_ids.append(inv_move_line.id)
122 for wh_line in wh_move.line_id:
123 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:
124 rec_ids.append(wh_line.id)
125 return line_pool.reconcile_partial(cr, uid, rec_ids, type='auto', context=context)
126
127 def action_move_line_create(self, cr, uid, ids, context=None):
128 res = super(account_voucher,self).action_move_line_create(cr, uid, ids, context)
129 inv_pool = self.pool.get('account.invoice')
130 move_pool = self.pool.get('account.move')
131 tax_pool = self.pool.get('account.tax')
132 curr_pool = self.pool.get('res.currency')
133 term_pool = self.pool.get('account.payment.term')
134 priod_obj = self.pool.get('account.period')
135 for voucher in self.browse(cr, uid, ids, context):
136 amounts_by_invoice = super(account_voucher,self).allocated_amounts_grouped_by_invoice(cr, uid,voucher, context)
137 for inv_id in amounts_by_invoice:
138 invoice = inv_pool.browse(cr, uid, inv_id, context)
139 if invoice.withholding_amount:
140 # only for supplier payments
141 if voucher.type != 'payment':
142 raise orm.except_orm(_('Error'), _('Can\'t handle withholding tax with voucher of type other than payment'))
143 if not invoice.company_id.withholding_account_id:
144 raise orm.except_orm(_('Error'), _('The company does not have an associated Withholding account') )
145 if not invoice.company_id.withholding_payment_term_id:
146 raise orm.except_orm(_('Error'), _('The company does not have an associated Withholding Payment Term') )
147 if not invoice.company_id.withholding_journal_id:
148 raise orm.except_orm(_('Error'), _('The company does not have an associated Withholding journal') )
149 if not invoice.company_id.authority_partner_id:
150 raise orm.except_orm(_('Error'), _('The company does not have an associated Tax Authority partner') )
151 # compute the new amount proportionally to paid amount
152 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)
153
154 # compute the due date
155 due_list = term_pool.compute(
156 cr, uid, invoice.company_id.withholding_payment_term_id.id, new_line_amount,
157 date_ref=voucher.date or invoice.date_invoice, context=context)
158 if len(due_list) > 1:
159 raise orm.except_orm(_('Error'),
160 _('The payment term %s has too many due dates')
161 % invoice.company_id.withholding_payment_term_id.name)
162 if len(due_list) == 0:
163 raise orm.except_orm(_('Error'),
164 _('The payment term %s does not have due dates')
165 % invoice.company_id.withholding_payment_term_id.name)
166
167 period_ids = priod_obj.find(cr, uid, dt=voucher.date, context=context)
168 new_move = {
169 'journal_id': invoice.company_id.withholding_journal_id.id,
170 'period_id': period_ids and period_ids[0] or False,
171 'date': voucher.date,
172 'line_id': [
173 (0,0,{
174 'name': invoice.number,
175 'account_id': invoice.account_id.id,
176 'partner_id': invoice.partner_id.id,
177 'debit': new_line_amount,
178 'credit': 0.0,
179 }),
180 (0,0,{
181 'name': _('Payable withholding - ') + invoice.number,
182 'account_id': invoice.company_id.withholding_account_id.id,
183 'partner_id': invoice.company_id.authority_partner_id.id,
184 'debit': 0.0,
185 'credit': new_line_amount,
186 'date_maturity': due_list[0][0],
187 }),
188 ]
189 }
190 move_id = self.pool.get('account.move').create(cr, uid, new_move, context=context)
191 self.reconcile_withholding_move(cr, uid, invoice, move_pool.browse(cr, uid, move_id, context), context)
192 voucher.write({'withholding_move_ids': [(4, move_id)]})
193 return res
194
195 def cancel_voucher(self, cr, uid, ids, context=None):
196 res = super(account_voucher,self).cancel_voucher(cr, uid, ids, context)
197 reconcile_pool = self.pool.get('account.move.reconcile')
198 move_pool = self.pool.get('account.move')
199 for voucher in self.browse(cr, uid, ids, context=context):
200 recs = []
201 for move in voucher.withholding_move_ids:
202 move_pool.button_cancel(cr, uid, [move.id])
203 move_pool.unlink(cr, uid, [move.id])
204 return res
0205
=== added file 'l10n_it_withholding_tax/account_demo.xml'
--- l10n_it_withholding_tax/account_demo.xml 1970-01-01 00:00:00 +0000
+++ l10n_it_withholding_tax/account_demo.xml 2013-05-09 14:32:26 +0000
@@ -0,0 +1,19 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data noupdate="1">
4
5 <record id="a_witholding" model="account.account">
6 <field name="code">X1115</field>
7 <field name="name">Withholding tax to pay</field>
8 <field ref="account.cli" name="parent_id"/>
9 <field name="type">payable</field>
10 <field eval="True" name="reconcile"/>
11 <field name="user_type" ref="account.data_account_type_payable"/>
12 </record>
13 <record id="tax_authority" model="res.partner">
14 <field name="name">Tax authority</field>
15 <field eval="1" name="supplier"/>
16 </record>
17
18 </data>
19</openerp>
020
=== added file 'l10n_it_withholding_tax/account_view.xml'
--- l10n_it_withholding_tax/account_view.xml 1970-01-01 00:00:00 +0000
+++ l10n_it_withholding_tax/account_view.xml 2013-05-09 14:32:26 +0000
@@ -0,0 +1,71 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5<!-- company -->
6
7 <record id="view_account_config_settings" model="ir.ui.view">
8 <field name="name">view_account_config_settings</field>
9 <field name="model">account.config.settings</field>
10 <field name="inherit_id" ref="account.view_account_config_settings"/>
11 <field name="arch" type="xml">
12 <xpath expr="/form/group[6]" position="after">
13 <separator string="Witholding Tax"/>
14 <group name="withholding_tax">
15 <label for="id" string="Configuration"/>
16 <div>
17 <div>
18 <label for="withholding_payment_term_id"/>
19 <field name="withholding_payment_term_id" class="oe_inline"/>
20 </div>
21 <div>
22 <label for="withholding_account_id"/>
23 <field name="withholding_account_id" class="oe_inline"/>
24 </div>
25 <div>
26 <label for="withholding_journal_id"/>
27 <field name="withholding_journal_id" class="oe_inline"/>
28 </div>
29 <div>
30 <label for="authority_partner_id"/>
31 <field name="authority_partner_id" class="oe_inline"/>
32 </div>
33 </div>
34 </group>
35 </xpath>
36 </field>
37 </record>
38
39 <!-- invoice -->
40
41 <record id="invoice_supplier_form" model="ir.ui.view">
42 <field name="name">account.invoice.supplier.form</field>
43 <field name="model">account.invoice</field>
44 <field name="inherit_id" ref="account.invoice_supplier_form"/>
45 <field name="arch" type="xml">
46 <field name="date_due" position="after">
47 <field name="has_withholding"/>
48 </field>
49 <field name="amount_total" position="after">
50 <field name="withholding_amount" attrs="{'invisible': [('has_withholding', '=', False)]}"/>
51 <field name="net_pay" attrs="{'invisible': [('has_withholding', '=', False)]}"/>
52 </field>
53 </field>
54 </record>
55
56 <!-- voucher -->
57
58 <record id="view_vendor_payment_form_wh_move" model="ir.ui.view">
59 <field name="name">account.voucher.payment.form.wh.move</field>
60 <field name="model">account.voucher</field>
61 <field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
62 <field name="arch" type="xml">
63 <field name="move_ids" position="after">
64 <separator string="Withholding tax entries" colspan="4"></separator>
65 <field name="withholding_move_ids" colspan="4" nolabel="1"/>
66 </field>
67 </field>
68 </record>
69
70 </data>
71</openerp>
072
=== added directory 'l10n_it_withholding_tax/i18n'
=== added file 'l10n_it_withholding_tax/i18n/it.mo'
1Binary 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 differ73Binary 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
=== added file 'l10n_it_withholding_tax/i18n/it.po'
--- l10n_it_withholding_tax/i18n/it.po 1970-01-01 00:00:00 +0000
+++ l10n_it_withholding_tax/i18n/it.po 2013-05-09 14:32:26 +0000
@@ -0,0 +1,150 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * l10n_it_withholding_tax
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.1\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2012-10-12 15:54+0000\n"
10"PO-Revision-Date: 2012-10-12 18:02+0100\n"
11"Last-Translator: Franco Tampieri <info@francotampieri.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17
18#. module: l10n_it_withholding_tax
19#: code:addons/l10n_it_withholding_tax/account.py:90
20#, python-format
21msgid "The company does not have an associated Withholding Payment Term"
22msgstr "L'Azienda non ha associato nessun Termine di pagamento per le Ritenute"
23
24#. module: l10n_it_withholding_tax
25#: constraint:res.company:0
26msgid "Error! You can not create recursive companies."
27msgstr "Errore! Non è possibile creare aziende ricorsive."
28
29#. module: l10n_it_withholding_tax
30#: code:addons/l10n_it_withholding_tax/account.py:106
31#, python-format
32msgid "The payment term %s does not have due dates"
33msgstr "The payment term %s does not have due dates"
34
35#. module: l10n_it_withholding_tax
36#: code:addons/l10n_it_withholding_tax/account.py:102
37#, python-format
38msgid "The payment term %s has too many due dates"
39msgstr "The payment term %s has too many due dates"
40
41#. module: l10n_it_withholding_tax
42#: view:account.voucher:0
43msgid "Withholding tax entries"
44msgstr "Voci Tasse Ritenute"
45
46#. module: l10n_it_withholding_tax
47#: field:account.invoice,has_withholding:0
48msgid "With withholding tax"
49msgstr "Con tasse ritenute"
50
51#. module: l10n_it_withholding_tax
52#: field:res.company,withholding_payment_term_id:0
53msgid "Withholding tax Payment Term"
54msgstr "Termini Pagamento Ritenute"
55
56#. module: l10n_it_withholding_tax
57#: field:res.company,withholding_account_id:0
58msgid "Withholding account"
59msgstr "Conto Ritenute"
60
61#. module: l10n_it_withholding_tax
62#: sql_constraint:res.company:0
63msgid "The company name must be unique !"
64msgstr "Il nome azienda deve essere unico!"
65
66#. module: l10n_it_withholding_tax
67#: field:account.invoice,net_pay:0
68msgid "Net Pay"
69msgstr "Netto da Pagare"
70
71#. module: l10n_it_withholding_tax
72#: model:ir.model,name:l10n_it_withholding_tax.model_res_company
73msgid "Companies"
74msgstr "Aziende"
75
76#. module: l10n_it_withholding_tax
77#: code:addons/l10n_it_withholding_tax/account.py:92
78#, python-format
79msgid "The company does not have an associated Withholding journal"
80msgstr "L'Azienda non ha un Sezionale associato per le Ritenute"
81
82#. module: l10n_it_withholding_tax
83#: code:addons/l10n_it_withholding_tax/account.py:86
84#: code:addons/l10n_it_withholding_tax/account.py:88
85#: code:addons/l10n_it_withholding_tax/account.py:90
86#: code:addons/l10n_it_withholding_tax/account.py:92
87#: code:addons/l10n_it_withholding_tax/account.py:101
88#: code:addons/l10n_it_withholding_tax/account.py:105
89#, python-format
90msgid "Error"
91msgstr "Errore"
92
93#. module: l10n_it_withholding_tax
94#: code:addons/l10n_it_withholding_tax/account.py:86
95#, python-format
96msgid "Can't handle withholding tax with voucher of type other than payment"
97msgstr "Can't handle withholding tax with voucher of type other than payment"
98
99#. module: l10n_it_withholding_tax
100#: help:res.company,withholding_account_id:0
101msgid "Payable account used for amount due to tax authority"
102msgstr "Payable account used for amount due to tax authority"
103
104#. module: l10n_it_withholding_tax
105#: sql_constraint:account.invoice:0
106msgid "Invoice Number must be unique per Company!"
107msgstr "Nell'azienda il numero fattura dev'essere univoco!"
108
109#. module: l10n_it_withholding_tax
110#: help:res.company,withholding_journal_id:0
111msgid "Journal used for registration of witholding amounts to be paid"
112msgstr "Journal used for registration of witholding amounts to be paid"
113
114#. module: l10n_it_withholding_tax
115#: code:addons/l10n_it_withholding_tax/account.py:119
116#, python-format
117msgid "Payable withholding - "
118msgstr "Ritenute Pagabili - "
119
120#. module: l10n_it_withholding_tax
121#: model:ir.model,name:l10n_it_withholding_tax.model_account_voucher
122msgid "Accounting Voucher"
123msgstr "Voucher contabile"
124
125#. module: l10n_it_withholding_tax
126#: field:account.invoice,withholding_amount:0
127msgid "Withholding amount"
128msgstr "Totale Ritenute"
129
130#. module: l10n_it_withholding_tax
131#: model:ir.model,name:l10n_it_withholding_tax.model_account_invoice
132msgid "Invoice"
133msgstr "Fattura"
134
135#. module: l10n_it_withholding_tax
136#: field:res.company,withholding_journal_id:0
137msgid "Withholding journal"
138msgstr "Sezionale Ritenute"
139
140#. module: l10n_it_withholding_tax
141#: code:addons/l10n_it_withholding_tax/account.py:88
142#, python-format
143msgid "The company does not have an associated Withholding account"
144msgstr "L'Azienda non ha un conto associato per le Ritenute"
145
146#. module: l10n_it_withholding_tax
147#: field:account.voucher,withholding_move_ids:0
148msgid "Withholding Tax Entries"
149msgstr "Voci Tasse Ritenute"
150
0151
=== added directory 'l10n_it_withholding_tax/test'
=== added file 'l10n_it_withholding_tax/test/purchase_payment.yml'
--- l10n_it_withholding_tax/test/purchase_payment.yml 1970-01-01 00:00:00 +0000
+++ l10n_it_withholding_tax/test/purchase_payment.yml 2013-05-09 14:32:26 +0000
@@ -0,0 +1,105 @@
1-
2 I configure the main company
3-
4 !record {model: res.company, id: base.main_company}:
5 withholding_payment_term_id: account.account_payment_term
6 withholding_account_id: a_witholding
7 withholding_journal_id: account.miscellaneous_journal
8 authority_partner_id: tax_authority
9-
10 In order to test account invoice I create a new supplier invoice
11-
12 I create a Tax Codes
13-
14 !record {model: account.tax.code, id: tax_case}:
15 name: Tax_case
16 company_id: base.main_company
17 sign: 1
18-
19 I create a Tax
20-
21 !record {model: account.tax, id: tax10}:
22 name: Tax 10.0
23 amount: 10.0
24 type: fixed
25 sequence: 1
26 company_id: base.main_company
27 type_tax_use: all
28 tax_code_id: tax_case
29-
30 I set the context
31-
32 !context
33 'type': 'in_invoice'
34-
35 I create a supplier invoice
36-
37 !record {model: account.invoice, id: account_invoice_supplier_0, view: invoice_supplier_form}:
38 account_id: account.a_pay
39 company_id: base.main_company
40 currency_id: base.EUR
41 invoice_line:
42 - account_id: account.a_expense
43 name: 'Lawyer service'
44 price_unit: 100.0
45 quantity: 1.0
46 invoice_line_tax_id:
47 - tax10
48 journal_id: account.expenses_journal
49 partner_id: base.res_partner_12
50 has_withholding: True
51 withholding_amount: 20.0
52-
53 I check that Initially supplier invoice state is "Draft"
54-
55 !assert {model: account.invoice, id: account_invoice_supplier_0}:
56 - state == 'draft'
57-
58 I change the state of invoice to open by clicking Validate button
59-
60 !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier_0}
61-
62 I check that the invoice state is now "Open" and 'Net Pay' is 90
63-
64 !assert {model: account.invoice, id: account_invoice_supplier_0}:
65 - state == 'open'
66 - net_pay == 90.0
67-
68 I create the voucher of payment with 90
69-
70 !record {model: account.voucher, id: account_voucher_0, view: account_voucher.view_vendor_payment_form}:
71 account_id: account.cash
72 amount: 90.0
73 company_id: base.main_company
74 journal_id: account.bank_journal
75 name: 'Payment: invoice 0'
76 partner_id: base.res_partner_12
77 period_id: account.period_3
78 date: !eval time.strftime("%Y-03-10")
79 type: 'payment'
80-
81 I check voucher state is draft
82-
83 !assert {model: account.voucher, id: account_voucher_0}:
84 - state == 'draft'
85-
86 I confirm the voucher
87-
88 !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_0}
89-
90 I check the entries
91-
92 !python {model: account.voucher}: |
93 import time
94 voucher = self.browse(cr, uid, ref('account_voucher_0'))
95 assert (voucher.state=='posted'), "Voucher is not in posted state: %s" % voucher.state
96 assert (len(voucher.withholding_move_ids) == 1), "Withholding entry must be one, not %s" % len(voucher.withholding_move_ids)
97 for move_line in voucher.withholding_move_ids[0].line_id:
98 if move_line.account_id.id == ref('a_witholding'):
99 assert (move_line.credit==20.0), "withholding move line credit must be 20 instead of %s" % move_line.credit
100 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)
101-
102 Finally i will Confirm the state of the invoice is paid
103-
104 !assert {model: account.invoice, id: account_invoice_supplier_0}:
105 - state == 'paid'

Subscribers

People subscribed via source and target branches