Merge lp:~scigghia/openobject-italia/add_fiscalcode into lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0
- add_fiscalcode
- Merge into italian-addons-7.0
Status: | Merged |
---|---|
Merged at revision: | 197 |
Proposed branch: | lp:~scigghia/openobject-italia/add_fiscalcode |
Merge into: | lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0 |
Diff against target: |
688 lines (+628/-0) 11 files modified
l10n_it_fiscalcode/AUTHORS.txt (+10/-0) l10n_it_fiscalcode/__init__.py (+24/-0) l10n_it_fiscalcode/__openerp__.py (+48/-0) l10n_it_fiscalcode/fiscalcode.py (+51/-0) l10n_it_fiscalcode/fiscalcode_view.xml (+19/-0) l10n_it_fiscalcode/i18n/it.po (+131/-0) l10n_it_fiscalcode/i18n/l10n_it_account.pot (+117/-0) l10n_it_fiscalcode/test/fiscalcode.yml (+28/-0) l10n_it_fiscalcode/wizard/__init__.py (+23/-0) l10n_it_fiscalcode/wizard/compute_fc.py (+127/-0) l10n_it_fiscalcode/wizard/compute_fc_view.xml (+50/-0) |
To merge this branch: | bzr merge lp:~scigghia/openobject-italia/add_fiscalcode |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lorenzo Battistini | Needs Information | ||
Review via email: mp+146667@code.launchpad.net |
Commit message
Description of the change
Lorenzo Battistini (elbati) wrote : | # |
Lorenzo Battistini (elbati) wrote : | # |
A proposito di far dipendere o meno l10n_it_fiscalcode da account, c'è da considerare che possono capitare installazioni in cui il CF serve solo come dato anagrafico e nessuna funzionalità di contabilità è richiesta, quindi account sarebbe superfluo (ed è il motivo per cui ora l10n_it_fiscalcode dipende solo da l10n_it_base).
Qual è il problema dell'attuale posizione del campo? Troppo in primo piano?
Vogliamo metterlo in un tab con solamente il CF?
Andrea Cometa (scigghia) wrote : | # |
prendiamo in considerazione le seguenti modifiche:
- chiamare l'addon l10n_it_
- spostare il campo subito sotto il campo email oppure creare un tab dedicato
- renderlo indipendente da account
le applicherei in breve termine e poi la parte legata alle funzionalità contabili si sposterebbero in l10n_it_account.
che dite?
Lorenzo Battistini (elbati) wrote : | # |
On 02/06/2013 04:20 PM, Andrea Cometa wrote:
> prendiamo in considerazione le seguenti modifiche:
> - chiamare l'addon l10n_it_
Modificando il nome del modulo, potrebbero diventare noiose le
migrazioni da 6 a 7: bisognerebbe fare dei test per assicurarci di non
perdere dati.
> - spostare il campo subito sotto il campo email oppure creare un tab dedicato
Per me va bene anche nei pressi dell'email.
> - renderlo indipendente da account
>
> le applicherei in breve termine e poi la parte legata alle funzionalità contabili si sposterebbero in l10n_it_account.
>
Ok
Andrea Cometa (scigghia) wrote : | # |
ok allora lasciamo l10n_it_fiscalcode, sposto i campi sotto email e successivamente aggiorno il merge proposal
Franco Tampieri (dr.dran) wrote : | # |
Scusate se mi intrometto, ma per quanto riguara il codice fiscale sarebbe +
consono inserirlo sotto o sopra il campo vat?
2013/2/7 Andrea Cometa <email address hidden>
> ok allora lasciamo l10n_it_fiscalcode, sposto i campi sotto email e
> successivamente aggiorno il merge proposal
> --
>
> https:/
> Your team OpenERP Italia core devs is subscribed to branch
> lp:openobject-italia/7.0.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
marcomarkiori (marcomarkiori) wrote : | # |
il codice fiscale ce l'hanno tutti, la partita iva solo imprese e professionisti
la partita iva va sempre usata nelle transazioni commerciali fra
imprese/
riportarlo
quindi dipende se ci sono constraints
2013/2/7 Franco Tampieri - Agile BG - Domsense <email address hidden>:
> Scusate se mi intrometto, ma per quanto riguara il codice fiscale sarebbe +
> consono inserirlo sotto o sopra il campo vat?
>
>
> 2013/2/7 Andrea Cometa <email address hidden>
>
>> ok allora lasciamo l10n_it_fiscalcode, sposto i campi sotto email e
>> successivamente aggiorno il merge proposal
>> --
>>
>> https:/
>> Your team OpenERP Italia core devs is subscribed to branch
>> lp:openobject-italia/7.0.
>>
>> _______
>> Mailing list: https:/
>> Post to : <email address hidden>
>> Unsubscribe : https:/
>> More help : https:/
>>
>
> --
> https:/
> Your team OpenERP Italia core devs is subscribed to branch lp:openobject-italia/7.0.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
Andrea Cometa (scigghia) wrote : | # |
Ho aggiornato il branch, spostando il campo subito sotto il campo email
possiamo verificare ora, se va bene?
massimo.rc (massimo-dallanora) wrote : | # |
Secondo me ottimo!
Solamente un'osservazione: nella stampa della fattura il codice fiscale non viene stampato: questo è un grosso problema in quanto se fatturo a persona fisica nella fattura devo vedere il codice fiscale.
Comunque grazie del lavoro che state facendo.
Davide Corio (enlightx-deactivatedaccount) wrote : | # |
I dati presenti sulla stampa non dipendono da questo modulo, bensì da quello del report.
Quello "standard" di OpenERP non può essere esteso con i dati mancanti.
Francesco Apruzzese (opencode) wrote : | # |
Il problema è che in tal caso non va utilizzata la stampa standard ma bisogna crearne una ad-hoc per l'utente nella quale si può tranquillamente riportare il codice fiscale del cliente.
Davide Corio (enlightx-deactivatedaccount) wrote : | # |
Per quanto riguarda il posizionamento del C.F., mi viene in mente che gli utenti si troverebbero il campo C.F. in bella vista mentre dovrebbero addentrarsi nei tabs per trovare ad esempio la P.IVA.
Questo potrebbe voler dire che qualcuno potrebbe credere che il campo C.F. è da usare anche per la P.IVA.
Cmq è un problema di usabilità non da poco, siccome significherebbe dover spostare anche il campo P.IVA. nella schermata generale.
Davide Corio (enlightx-deactivatedaccount) wrote : | # |
PS: "individual" penso si potrebbe tradurre con "natural person" siccome è la traduzione corretta per "persona fisica"
Preview Diff
1 | === added directory 'l10n_it_fiscalcode' |
2 | === added file 'l10n_it_fiscalcode/AUTHORS.txt' |
3 | --- l10n_it_fiscalcode/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
4 | +++ l10n_it_fiscalcode/AUTHORS.txt 2013-02-05 16:24:41 +0000 |
5 | @@ -0,0 +1,10 @@ |
6 | +Davide Corio <davide.corio@domsense.com> |
7 | +Luca Subiaco <subluca@gmail.com> |
8 | +Simone Orsi <simone.orsi@domsense.com> |
9 | +Mario Riva <mario.riva@domsense.com> |
10 | +Mauro Soligo <mauro.soligo@katodo.com> |
11 | +Giovanni Barzan <giovanni.barzan@gmail.com> |
12 | +Lorenzo Battistini <lorenzo.battistini@albatos.com> |
13 | +Roberto Onnis <onnis.roberto@gmail.com> |
14 | +Franco Tampieri <franco.tampieri@agilebg.com> |
15 | +Andrea Cometa <info@andreacometa.it> |
16 | |
17 | === added file 'l10n_it_fiscalcode/__init__.py' |
18 | --- l10n_it_fiscalcode/__init__.py 1970-01-01 00:00:00 +0000 |
19 | +++ l10n_it_fiscalcode/__init__.py 2013-02-05 16:24:41 +0000 |
20 | @@ -0,0 +1,24 @@ |
21 | +# -*- coding: utf-8 -*- |
22 | +############################################################################## |
23 | +# |
24 | +# Copyright (C) 2012 Associazione OpenERP Italia |
25 | +# (<http://www.openerp-italia.org>). |
26 | +# |
27 | +# This program is free software: you can redistribute it and/or modify |
28 | +# it under the terms of the GNU Affero General Public License as published by |
29 | +# the Free Software Foundation, either version 3 of the License, or |
30 | +# (at your option) any later version. |
31 | +# |
32 | +# This program is distributed in the hope that it will be useful, |
33 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
34 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
35 | +# GNU General Public License for more details. |
36 | +# |
37 | +# You should have received a copy of the GNU Affero General Public License |
38 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
39 | +# |
40 | +############################################################################## |
41 | + |
42 | +import fiscalcode |
43 | +import wizard |
44 | + |
45 | |
46 | === added file 'l10n_it_fiscalcode/__openerp__.py' |
47 | --- l10n_it_fiscalcode/__openerp__.py 1970-01-01 00:00:00 +0000 |
48 | +++ l10n_it_fiscalcode/__openerp__.py 2013-02-05 16:24:41 +0000 |
49 | @@ -0,0 +1,48 @@ |
50 | +# -*- coding: utf-8 -*- |
51 | +############################################################################## |
52 | +# |
53 | +# Copyright (C) 2010-2012 Associazione OpenERP Italia |
54 | +# (<http://www.openerp-italia.org>). |
55 | +# |
56 | +# This program is free software: you can redistribute it and/or modify |
57 | +# it under the terms of the GNU Affero General Public License as published |
58 | +# by the Free Software Foundation, either version 3 of the License, or |
59 | +# (at your option) any later version. |
60 | +# |
61 | +# This program is distributed in the hope that it will be useful, |
62 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
63 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
64 | +# GNU General Public License for more details. |
65 | +# |
66 | +# You should have received a copy of the GNU Affero General Public License |
67 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
68 | +# |
69 | +############################################################################## |
70 | +{ |
71 | + 'name': 'Italian Localisation - Fiscal Code', |
72 | + 'version': '0.1', |
73 | + 'category': 'Localisation/Italy', |
74 | + 'description': """ |
75 | +This module customizes OpenERP in order to fit italian laws and mores - Account version |
76 | + |
77 | +Functionalities: |
78 | + |
79 | +- Fiscal code computation for partner |
80 | + |
81 | +""", |
82 | + 'author': 'OpenERP Italian Community', |
83 | + 'website': 'http://www.openerp-italia.org', |
84 | + 'license': 'AGPL-3', |
85 | + "depends" : ['base', 'l10n_it_base'], |
86 | + "init_xml" : [ |
87 | + 'fiscalcode_view.xml', |
88 | + 'wizard/compute_fc_view.xml' |
89 | + ], |
90 | + "update_xml" : [], |
91 | + "demo_xml" : [], |
92 | + 'test': [ |
93 | + 'test/fiscalcode.yml', |
94 | + ], |
95 | + "active": False, |
96 | + "installable": True |
97 | +} |
98 | |
99 | === added file 'l10n_it_fiscalcode/fiscalcode.py' |
100 | --- l10n_it_fiscalcode/fiscalcode.py 1970-01-01 00:00:00 +0000 |
101 | +++ l10n_it_fiscalcode/fiscalcode.py 2013-02-05 16:24:41 +0000 |
102 | @@ -0,0 +1,51 @@ |
103 | +# -*- coding: utf-8 -*- |
104 | +############################################################################## |
105 | +# |
106 | +# Copyright (C) 2010-2012 Associazione OpenERP Italia |
107 | +# (<http://www.openerp-italia.org>). |
108 | +# |
109 | +# This program is free software: you can redistribute it and/or modify |
110 | +# it under the terms of the GNU Affero General Public License as published by |
111 | +# the Free Software Foundation, either version 3 of the License, or |
112 | +# (at your option) any later version. |
113 | +# |
114 | +# This program is distributed in the hope that it will be useful, |
115 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
116 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
117 | +# GNU General Public License for more details. |
118 | +# |
119 | +# You should have received a copy of the GNU Affero General Public License |
120 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
121 | +# |
122 | +############################################################################## |
123 | + |
124 | +from osv import fields, osv |
125 | +import tools |
126 | +import pooler |
127 | +from tools.translate import _ |
128 | +import datetime |
129 | + |
130 | +class res_partner(osv.osv): |
131 | + _inherit = 'res.partner' |
132 | + |
133 | + def check_fiscalcode(self, cr, uid, ids, context={}): |
134 | + |
135 | + for partner in self.browse(cr, uid, ids): |
136 | + if not partner.fiscalcode: |
137 | + return True |
138 | + elif len(partner.fiscalcode) != 16 and partner.individual: |
139 | + return False |
140 | + else: |
141 | + return True |
142 | + |
143 | + _columns = { |
144 | + 'fiscalcode': fields.char('Fiscal Code', size=16, help="Italian Fiscal Code"), |
145 | + 'individual': fields.boolean('Individual', help="If checked the C.F. is referred to a Individual Person"), |
146 | + } |
147 | + _defaults = { |
148 | + 'individual': False, |
149 | + } |
150 | + _constraints = [(check_fiscalcode, "The fiscal code doesn't seem to be correct.", ["fiscalcode"])] |
151 | + _sql_constraints = [ |
152 | + ('fiscalcode_uniq', 'unique (fiscalcode, company_id)', 'The fiscal code must be unique per company !'), |
153 | + ] |
154 | |
155 | === added file 'l10n_it_fiscalcode/fiscalcode_view.xml' |
156 | --- l10n_it_fiscalcode/fiscalcode_view.xml 1970-01-01 00:00:00 +0000 |
157 | +++ l10n_it_fiscalcode/fiscalcode_view.xml 2013-02-05 16:24:41 +0000 |
158 | @@ -0,0 +1,19 @@ |
159 | +<?xml version="1.0" ?> |
160 | +<openerp> |
161 | + <data> |
162 | + |
163 | + <record id="view_partner_form_fiscalcode_data" model="ir.ui.view"> |
164 | + <field name="name">res.partner.fiscalcode.data</field> |
165 | + <field name="model">res.partner</field> |
166 | + <field name="inherit_id" ref="base.view_partner_form"/> |
167 | + <field name="arch" type="xml"> |
168 | + <field name="lang" position="after"> |
169 | + <separator string="Fiscal Data" colspan="6"/> |
170 | + <field name="fiscalcode"/> |
171 | + <field name="individual" colspan="1" groups="base.group_extended" /> |
172 | + </field> |
173 | + </field> |
174 | + </record> |
175 | + |
176 | + </data> |
177 | +</openerp> |
178 | |
179 | === added directory 'l10n_it_fiscalcode/i18n' |
180 | === added file 'l10n_it_fiscalcode/i18n/it.mo' |
181 | Binary files l10n_it_fiscalcode/i18n/it.mo 1970-01-01 00:00:00 +0000 and l10n_it_fiscalcode/i18n/it.mo 2013-02-05 16:24:41 +0000 differ |
182 | === added file 'l10n_it_fiscalcode/i18n/it.po' |
183 | --- l10n_it_fiscalcode/i18n/it.po 1970-01-01 00:00:00 +0000 |
184 | +++ l10n_it_fiscalcode/i18n/it.po 2013-02-05 16:24:41 +0000 |
185 | @@ -0,0 +1,131 @@ |
186 | +# Translation of OpenERP Server. |
187 | +# This file contains the translation of the following modules: |
188 | +# * l10n_it_fiscalcode |
189 | +# |
190 | +msgid "" |
191 | +msgstr "" |
192 | +"Project-Id-Version: OpenERP Server 6.1\n" |
193 | +"Report-Msgid-Bugs-To: \n" |
194 | +"POT-Creation-Date: 2012-12-05 10:00+0000\n" |
195 | +"PO-Revision-Date: 2012-12-05 11:02+0100\n" |
196 | +"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n" |
197 | +"Language-Team: \n" |
198 | +"MIME-Version: 1.0\n" |
199 | +"Content-Type: text/plain; charset=UTF-8\n" |
200 | +"Content-Transfer-Encoding: 8bit\n" |
201 | +"Plural-Forms: \n" |
202 | + |
203 | +#. module: l10n_it_fiscalcode |
204 | +#: help:res.partner,individual:0 |
205 | +msgid "If checked the C.F. is referred to a Individual Person" |
206 | +msgstr "Se selezionato il Cofice Fiscale farà riferimento a quello di una Persona Fisica" |
207 | + |
208 | +#. module: l10n_it_fiscalcode |
209 | +#: field:wizard.compute.fc,birth_date:0 |
210 | +msgid "Date of birth" |
211 | +msgstr "Data di nascita" |
212 | + |
213 | +#. module: l10n_it_fiscalcode |
214 | +#: field:res.partner,fiscalcode:0 |
215 | +#: view:wizard.compute.fc:0 |
216 | +msgid "Fiscal Code" |
217 | +msgstr "Codice Fiscale" |
218 | + |
219 | +#. module: l10n_it_fiscalcode |
220 | +#: model:ir.actions.act_window,name:l10n_it_fiscalcode.action_compute_fc |
221 | +#: model:ir.model,name:l10n_it_fiscalcode.model_wizard_compute_fc |
222 | +msgid "Compute Fiscal Code" |
223 | +msgstr "Calcola il Codice Fiscale" |
224 | + |
225 | +#. module: l10n_it_fiscalcode |
226 | +#: field:wizard.compute.fc,fiscalcode_firstname:0 |
227 | +msgid "First name" |
228 | +msgstr "Nome" |
229 | + |
230 | +#. module: l10n_it_fiscalcode |
231 | +#: view:wizard.compute.fc:0 |
232 | +msgid "Individual Data" |
233 | +msgstr "Dati Persona Fisica" |
234 | + |
235 | +#. module: l10n_it_fiscalcode |
236 | +#: view:res.partner:0 |
237 | +msgid "Fiscal Data" |
238 | +msgstr "Dati Fiscali" |
239 | + |
240 | +#. module: l10n_it_fiscalcode |
241 | +#: field:wizard.compute.fc,birth_city:0 |
242 | +msgid "City of birth" |
243 | +msgstr "Città di Nascita" |
244 | + |
245 | +#. module: l10n_it_fiscalcode |
246 | +#: view:wizard.compute.fc:0 |
247 | +msgid "Compute" |
248 | +msgstr "Calcola" |
249 | + |
250 | +#. module: l10n_it_fiscalcode |
251 | +#: constraint:res.partner:0 |
252 | +msgid "The fiscal code doesn't seem to be correct." |
253 | +msgstr "Il Codice Fiscale non sembra corretto per una Persona Fisica." |
254 | + |
255 | +#. module: l10n_it_fiscalcode |
256 | +#: sql_constraint:res.partner:0 |
257 | +msgid "The fiscal code must be unique per company !" |
258 | +msgstr "Il codice fiscale deve essere unico!" |
259 | + |
260 | +#. module: l10n_it_fiscalcode |
261 | +#: code:addons/l10n_it_fiscalcode/wizard/compute_fc.py:126 |
262 | +#, python-format |
263 | +msgid "Error" |
264 | +msgstr "Errore" |
265 | + |
266 | +#. module: l10n_it_fiscalcode |
267 | +#: selection:wizard.compute.fc,sex:0 |
268 | +msgid "Male" |
269 | +msgstr "Maschio" |
270 | + |
271 | +#. module: l10n_it_fiscalcode |
272 | +#: code:addons/l10n_it_fiscalcode/wizard/compute_fc.py:126 |
273 | +#, python-format |
274 | +msgid "Existing fiscal code %s is different from the computed one (%s). If you want to use the computed one, remove the existing one" |
275 | +msgstr "Il codice fiscale sistente %s è diverso da quello calcolato (%s). Se si vuole usare quello calcolato, rimuovere quello esistente." |
276 | + |
277 | +#. module: l10n_it_fiscalcode |
278 | +#: field:wizard.compute.fc,fiscalcode_surname:0 |
279 | +msgid "Surname" |
280 | +msgstr "Cognome" |
281 | + |
282 | +#. module: l10n_it_fiscalcode |
283 | +#: field:wizard.compute.fc,sex:0 |
284 | +msgid "Sex" |
285 | +msgstr "Sesso" |
286 | + |
287 | +#. module: l10n_it_fiscalcode |
288 | +#: help:res.partner,fiscalcode:0 |
289 | +msgid "Italian Fiscal Code" |
290 | +msgstr "Codice fiscale Italiano" |
291 | + |
292 | +#. module: l10n_it_fiscalcode |
293 | +#: field:res.partner,individual:0 |
294 | +msgid "Individual" |
295 | +msgstr "Persona Fisica" |
296 | + |
297 | +#. module: l10n_it_fiscalcode |
298 | +#: selection:wizard.compute.fc,sex:0 |
299 | +msgid "Female" |
300 | +msgstr "Femmina" |
301 | + |
302 | +#. module: l10n_it_fiscalcode |
303 | +#: view:wizard.compute.fc:0 |
304 | +msgid "Cancel" |
305 | +msgstr "Annulla" |
306 | + |
307 | +#. module: l10n_it_fiscalcode |
308 | +#: model:ir.model,name:l10n_it_fiscalcode.model_res_partner |
309 | +msgid "Partner" |
310 | +msgstr "Partner" |
311 | + |
312 | +#. module: l10n_it_fiscalcode |
313 | +#: view:res.partner:0 |
314 | +msgid "Compute F.C." |
315 | +msgstr "Calcola C.F." |
316 | + |
317 | |
318 | === added file 'l10n_it_fiscalcode/i18n/l10n_it_account.pot' |
319 | --- l10n_it_fiscalcode/i18n/l10n_it_account.pot 1970-01-01 00:00:00 +0000 |
320 | +++ l10n_it_fiscalcode/i18n/l10n_it_account.pot 2013-02-05 16:24:41 +0000 |
321 | @@ -0,0 +1,117 @@ |
322 | +# Translation of OpenERP Server. |
323 | +# This file contains the translation of the following modules: |
324 | +# * l10n_it_account |
325 | +# |
326 | +msgid "" |
327 | +msgstr "" |
328 | +"Project-Id-Version: OpenERP Server 6.0.2\n" |
329 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
330 | +"POT-Creation-Date: 2011-05-05 16:44+0000\n" |
331 | +"PO-Revision-Date: 2011-05-05 16:44+0000\n" |
332 | +"Last-Translator: <>\n" |
333 | +"Language-Team: \n" |
334 | +"MIME-Version: 1.0\n" |
335 | +"Content-Type: text/plain; charset=UTF-8\n" |
336 | +"Content-Transfer-Encoding: \n" |
337 | +"Plural-Forms: \n" |
338 | + |
339 | +#. module: l10n_it_account |
340 | +#: code:addons/l10n_it_account/account/invoice.py:45 |
341 | +#, python-format |
342 | +msgid "Cannot create invoice! Post the invoice with a greater date" |
343 | +msgstr "" |
344 | + |
345 | +#. module: l10n_it_account |
346 | +#: view:res.partner:0 |
347 | +msgid "Compute" |
348 | +msgstr "" |
349 | + |
350 | +#. module: l10n_it_account |
351 | +#: model:ir.model,name:l10n_it_account.model_account_invoice |
352 | +msgid "Invoice" |
353 | +msgstr "" |
354 | + |
355 | +#. module: l10n_it_account |
356 | +#: field:res.partner,birth_date:0 |
357 | +msgid "Date of birth" |
358 | +msgstr "" |
359 | + |
360 | +#. module: l10n_it_account |
361 | +#: view:res.partner:0 |
362 | +msgid "Notes" |
363 | +msgstr "" |
364 | + |
365 | +#. module: l10n_it_account |
366 | +#: model:ir.module.module,description:l10n_it_account.module_meta_information |
367 | +msgid "This module customizes OpenERP in order to fit italian laws and mores - Account version\n" |
368 | +"\n" |
369 | +"Functionalities:\n" |
370 | +"\n" |
371 | +"- Fiscal code computation for partner\n" |
372 | +"- Check invoice date consistency\n" |
373 | +"\n" |
374 | +"" |
375 | +msgstr "" |
376 | + |
377 | +#. module: l10n_it_account |
378 | +#: help:res.partner,fiscalcode:0 |
379 | +msgid "Italian Fiscal Code" |
380 | +msgstr "" |
381 | + |
382 | +#. module: l10n_it_account |
383 | +#: field:res.partner,sex:0 |
384 | +msgid "Sex" |
385 | +msgstr "" |
386 | + |
387 | +#. module: l10n_it_account |
388 | +#: field:res.partner,fiscalcode_surname:0 |
389 | +msgid "Surname" |
390 | +msgstr "" |
391 | + |
392 | +#. module: l10n_it_account |
393 | +#: field:res.partner,fiscalcode_firstname:0 |
394 | +msgid "First name" |
395 | +msgstr "" |
396 | + |
397 | +#. module: l10n_it_account |
398 | +#: view:res.partner:0 |
399 | +#: field:res.partner,fiscalcode:0 |
400 | +msgid "Fiscal Code" |
401 | +msgstr "" |
402 | + |
403 | +#. module: l10n_it_account |
404 | +#: model:ir.module.module,shortdesc:l10n_it_account.module_meta_information |
405 | +msgid "Italian Localisation - Account" |
406 | +msgstr "" |
407 | + |
408 | +#. module: l10n_it_account |
409 | +#: selection:res.partner,sex:0 |
410 | +msgid "Female" |
411 | +msgstr "" |
412 | + |
413 | +#. module: l10n_it_account |
414 | +#: model:ir.model,name:l10n_it_account.model_res_partner |
415 | +msgid "Partner" |
416 | +msgstr "" |
417 | + |
418 | +#. module: l10n_it_account |
419 | +#: view:res.partner:0 |
420 | +msgid "Compute Fiscal Code" |
421 | +msgstr "" |
422 | + |
423 | +#. module: l10n_it_account |
424 | +#: selection:res.partner,sex:0 |
425 | +msgid "Male" |
426 | +msgstr "" |
427 | + |
428 | +#. module: l10n_it_account |
429 | +#: code:addons/l10n_it_account/account/invoice.py:44 |
430 | +#, python-format |
431 | +msgid "Date Inconsistency" |
432 | +msgstr "" |
433 | + |
434 | +#. module: l10n_it_account |
435 | +#: field:res.partner,birth_city:0 |
436 | +msgid "City of birth" |
437 | +msgstr "" |
438 | + |
439 | |
440 | === added directory 'l10n_it_fiscalcode/test' |
441 | === added file 'l10n_it_fiscalcode/test/fiscalcode.yml' |
442 | --- l10n_it_fiscalcode/test/fiscalcode.yml 1970-01-01 00:00:00 +0000 |
443 | +++ l10n_it_fiscalcode/test/fiscalcode.yml 2013-02-05 16:24:41 +0000 |
444 | @@ -0,0 +1,28 @@ |
445 | +- |
446 | + I create the wizard record |
447 | +- |
448 | + !record {model: wizard.compute.fc, id: wizard_fc_1}: |
449 | + fiscalcode_surname: 'Tampieri' |
450 | + fiscalcode_firstname: 'Franco' |
451 | + birth_date: '1976-07-04' |
452 | + birth_city: l10n_it_base.4059 |
453 | + sex: 'M' |
454 | + |
455 | +- |
456 | + I run the wizard |
457 | +- |
458 | + !python {model: wizard.compute.fc}: | |
459 | + self.view_init(cr, uid, [ref("wizard_fc_1")], {"lang": 'en_US', |
460 | + "active_model": "res.partner", "tz": False, "active_ids": |
461 | + [ref("base.res_partner_c2c")], "active_id": ref("base.res_partner_c2c"), |
462 | + }) |
463 | + self.compute_fc(cr, uid, [ref("wizard_fc_1")], {"lang": 'en_US', |
464 | + "active_model": "res.partner", "tz": False, "active_ids": |
465 | + [ref("base.res_partner_c2c")], "active_id": ref("base.res_partner_c2c"), |
466 | + }) |
467 | + |
468 | +- |
469 | + I check the fiscal code |
470 | +- |
471 | + !assert {model: res.partner, id: base.res_partner_c2c}: |
472 | + - fiscalcode == 'TMPFNC76L04E289A' |
473 | |
474 | === added directory 'l10n_it_fiscalcode/wizard' |
475 | === added file 'l10n_it_fiscalcode/wizard/__init__.py' |
476 | --- l10n_it_fiscalcode/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
477 | +++ l10n_it_fiscalcode/wizard/__init__.py 2013-02-05 16:24:41 +0000 |
478 | @@ -0,0 +1,23 @@ |
479 | +# -*- coding: utf-8 -*- |
480 | +############################################################################## |
481 | +# |
482 | +# Copyright (C) 2012 Associazione OpenERP Italia |
483 | +# (<http://www.openerp-italia.org>). |
484 | +# |
485 | +# This program is free software: you can redistribute it and/or modify |
486 | +# it under the terms of the GNU Affero General Public License as published by |
487 | +# the Free Software Foundation, either version 3 of the License, or |
488 | +# (at your option) any later version. |
489 | +# |
490 | +# This program is distributed in the hope that it will be useful, |
491 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
492 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
493 | +# GNU General Public License for more details. |
494 | +# |
495 | +# You should have received a copy of the GNU Affero General Public License |
496 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
497 | +# |
498 | +############################################################################## |
499 | + |
500 | +import compute_fc |
501 | + |
502 | |
503 | === added file 'l10n_it_fiscalcode/wizard/compute_fc.py' |
504 | --- l10n_it_fiscalcode/wizard/compute_fc.py 1970-01-01 00:00:00 +0000 |
505 | +++ l10n_it_fiscalcode/wizard/compute_fc.py 2013-02-05 16:24:41 +0000 |
506 | @@ -0,0 +1,127 @@ |
507 | +# -*- coding: utf-8 -*- |
508 | +############################################################################## |
509 | +# |
510 | +# Copyright (C) 2010-2012 Associazione OpenERP Italia |
511 | +# (<http://www.openerp-italia.org>). |
512 | +# |
513 | +# This program is free software: you can redistribute it and/or modify |
514 | +# it under the terms of the GNU Affero General Public License as published by |
515 | +# the Free Software Foundation, either version 3 of the License, or |
516 | +# (at your option) any later version. |
517 | +# |
518 | +# This program is distributed in the hope that it will be useful, |
519 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
520 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
521 | +# GNU General Public License for more details. |
522 | +# |
523 | +# You should have received a copy of the GNU Affero General Public License |
524 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
525 | +# |
526 | +############################################################################## |
527 | + |
528 | +from osv import fields, osv |
529 | +import tools |
530 | +import pooler |
531 | +from tools.translate import _ |
532 | + |
533 | +import datetime |
534 | + |
535 | +class wizard_compute_fc(osv.osv_memory): |
536 | + |
537 | + _name = "wizard.compute.fc" |
538 | + _description = "Compute Fiscal Code" |
539 | + _columns = { |
540 | + 'fiscalcode_surname': fields.char('Surname', size=64), |
541 | + 'fiscalcode_firstname': fields.char('First name', size=64), |
542 | + 'birth_date': fields.date('Date of birth'), |
543 | + 'birth_city': fields.many2one('res.city', 'City of birth'), |
544 | + 'sex': fields.selection([('M','Male'), |
545 | + ('F', 'Female'), |
546 | + ], "Sex"), |
547 | + } |
548 | + |
549 | + |
550 | + def _codicefiscale(self, cognome, nome, giornonascita, mesenascita, annonascita, sesso, cittanascita): |
551 | + |
552 | + MESI = 'ABCDEHLMPRST' |
553 | + CONSONANTI = 'BCDFGHJKLMNPQRSTVWXYZ' |
554 | + VOCALI = 'AEIOU' |
555 | + LETTERE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
556 | + |
557 | + REGOLECONTROLLO = { |
558 | + 'A':(0,1), 'B':(1,0), 'C':(2,5), 'D':(3,7), 'E':(4,9), |
559 | + 'F':(5,13), 'G':(6,15), 'H':(7,17), 'I':(8,19), 'J':(9,21), |
560 | + 'K':(10,2), 'L':(11,4), 'M':(12,18), 'N':(13,20), 'O':(14,11), |
561 | + 'P':(15,3), 'Q':(16,6), 'R':(17,8), 'S':(18,12), 'T':(19,14), |
562 | + 'U':(20,16), 'V':(21,10), 'W':(22,22), 'X':(23,25), 'Y':(24,24), |
563 | + 'Z':(25,23), |
564 | + '0':(0,1), '1':(1,0), '2':(2,5), '3':(3,7), '4':(4,9), |
565 | + '5':(5,13), '6':(6,15), '7':(7,17), '8':(8,19), '9':(9,21) |
566 | + } |
567 | + |
568 | + """Funzioni per il calcolo del C.F.""" |
569 | + def _surname(stringa): |
570 | + """Ricava, da stringa, 3 lettere in base alla convenzione dei C.F.""" |
571 | + cons = [c for c in stringa if c in CONSONANTI] |
572 | + voc = [c for c in stringa if c in VOCALI] |
573 | + chars=cons+voc |
574 | + if len(chars)<3: |
575 | + chars+=['X', 'X'] |
576 | + return chars[:3] |
577 | + |
578 | + def _name(stringa): |
579 | + """Ricava, da stringa, 3 lettere in base alla convenzione dei C.F.""" |
580 | + cons = [c for c in stringa if c in CONSONANTI] |
581 | + voc = [c for c in stringa if c in VOCALI] |
582 | + if len(cons)>3: |
583 | + cons = [cons[0]] +[cons[2]] + [cons[3]] |
584 | + chars=cons+voc |
585 | + if len(chars)<3: |
586 | + chars+=['X', 'X'] |
587 | + return chars[:3] |
588 | + |
589 | + def _datan(giorno, mese, anno, sesso): |
590 | + """Restituisce il campo data del CF.""" |
591 | + chars = (list(anno[-2:]) + [MESI[int(mese)-1]]) |
592 | + gn=int(giorno) |
593 | + if sesso=='F': |
594 | + gn+=40 |
595 | + chars += list("%02d" % gn) |
596 | + return chars |
597 | + |
598 | + def _codicecontrollo(c): |
599 | + """Restituisce il codice di controllo, l'ultimo carattere del C.F.""" |
600 | + sommone = 0 |
601 | + for i, car in enumerate(c): |
602 | + j = 1 - i % 2 |
603 | + sommone += REGOLECONTROLLO[car][j] |
604 | + resto = sommone % 26 |
605 | + return [LETTERE[resto]] |
606 | + |
607 | + """Restituisce il C.F costruito sulla base degli argomenti.""" |
608 | + nome=nome.upper() |
609 | + cognome=cognome.upper() |
610 | + sesso=sesso.upper() |
611 | + cittanascita = cittanascita.upper() |
612 | + chars = (_surname(cognome) + |
613 | + _name(nome) + |
614 | + _datan(giornonascita, mesenascita, annonascita, sesso) + |
615 | + list(cittanascita)) |
616 | + chars += _codicecontrollo(chars) |
617 | + return ''.join(chars) |
618 | + |
619 | + def compute_fc(self, cr, uid, ids, context): |
620 | + active_id = context.get('active_id', []) |
621 | + partner = self.pool.get('res.partner').browse(cr, uid, active_id, context) |
622 | + form_obj = self.browse(cr, uid, ids, context) |
623 | + for fields in form_obj: |
624 | + if not fields.fiscalcode_surname or not fields.fiscalcode_firstname or not fields.birth_date or not fields.birth_city or not fields.sex: |
625 | + raise osv.except_osv('Error', 'One or more fields are missing') |
626 | + birth_date = datetime.datetime.strptime(fields.birth_date, "%Y-%m-%d") |
627 | + CF = self._codicefiscale(fields.fiscalcode_surname, fields.fiscalcode_firstname, str(birth_date.day), |
628 | + str(birth_date.month), str(birth_date.year), fields.sex, |
629 | + fields.birth_city.cadaster_code) |
630 | + if partner.fiscalcode and partner.fiscalcode != CF: |
631 | + raise osv.except_osv(_('Error'), _('Existing fiscal code %s is different from the computed one (%s). If you want to use the computed one, remove the existing one') % (partner.fiscalcode, CF)) |
632 | + self.pool.get('res.partner').write(cr, uid, active_id, {'fiscalcode': CF, 'individual': True}) |
633 | + return {} |
634 | |
635 | === added file 'l10n_it_fiscalcode/wizard/compute_fc_view.xml' |
636 | --- l10n_it_fiscalcode/wizard/compute_fc_view.xml 1970-01-01 00:00:00 +0000 |
637 | +++ l10n_it_fiscalcode/wizard/compute_fc_view.xml 2013-02-05 16:24:41 +0000 |
638 | @@ -0,0 +1,50 @@ |
639 | +<?xml version="1.0" ?> |
640 | +<openerp> |
641 | + <data> |
642 | + |
643 | + <record id="wizard_compute_fc_form" model="ir.ui.view"> |
644 | + <field name="name">wizard.compute.fc.form</field> |
645 | + <field name="model">wizard.compute.fc</field> |
646 | + <field name="type">form</field> |
647 | + <field name="arch" type="xml"> |
648 | + <form string="Fiscal Code"> |
649 | + <group col="2" width="250"> |
650 | + <group string="Individual Data"> |
651 | + <field name="fiscalcode_surname" colspan="2" default_focus="1"/> |
652 | + <field name="fiscalcode_firstname" colspan="2"/> |
653 | + <field name="sex" colspan="2"/> |
654 | + <field name="birth_date" colspan="2"/> |
655 | + <field name="birth_city" colspan="2"/> |
656 | + </group> |
657 | + <newline/> |
658 | + <group col="2"> |
659 | + <button string="Cancel" special="cancel" icon="gtk-cancel" colspan="1"/> |
660 | + <button name="compute_fc" type="object" string="Compute" colspan="1"/> |
661 | + </group> |
662 | + </group> |
663 | + </form> |
664 | + </field> |
665 | + </record> |
666 | + |
667 | + <record id="action_compute_fc" model="ir.actions.act_window"> |
668 | + <field name="name">Compute Fiscal Code</field> |
669 | + <field name="type">ir.actions.act_window</field> |
670 | + <field name="res_model">wizard.compute.fc</field> |
671 | + <field name="view_type">form</field> |
672 | + <field name="view_mode">form</field> |
673 | + <field name="target">new</field> |
674 | + </record> |
675 | + |
676 | + <record id="view_partner_form_fiscalcode_button" model="ir.ui.view"> |
677 | + <field name="name">res.partner.fiscalcode.button</field> |
678 | + <field name="model">res.partner</field> |
679 | + <field name="inherit_id" ref="l10n_it_fiscalcode.view_partner_form_fiscalcode_data"/> |
680 | + <field name="arch" type="xml"> |
681 | + <field name="fiscalcode" position="after"> |
682 | + <button name="%(l10n_it_fiscalcode.action_compute_fc)d" string="Compute F.C." type="action" icon="gtk-execute" colspan="2"/> |
683 | + </field> |
684 | + </field> |
685 | + </record> |
686 | + |
687 | + </data> |
688 | +</openerp> |
http:// www.openerp- italia. org/index. php?option= com_kunena& Itemid= 81&func= view&catid= 5&id=9257& limit=6& limitstart= 30#10401