Merge lp:~openobject-italia-core-devs/openobject-italia/add_abi_cab into lp:~openobject-italia-core-devs/openobject-italia/italian-addons-6.1
- add_abi_cab
- Merge into italian-addons-6.1
Proposed by
Franco Tampieri
Status: | Superseded |
---|---|
Proposed branch: | lp:~openobject-italia-core-devs/openobject-italia/add_abi_cab |
Merge into: | lp:~openobject-italia-core-devs/openobject-italia/italian-addons-6.1 |
Diff against target: |
1310 lines (+941/-182) 25 files modified
l10n_it_abicab/AUTHORS.txt (+1/-0) l10n_it_abicab/__init__.py (+24/-0) l10n_it_abicab/__openerp__.py (+37/-0) l10n_it_abicab/abicab.py (+46/-0) l10n_it_abicab/abicab_view.xml (+46/-0) l10n_it_abicab/i18n/it.po (+37/-0) l10n_it_account/AUTHORS.txt (+1/-0) l10n_it_account/__init__.py (+2/-3) l10n_it_account/__openerp__.py (+4/-4) l10n_it_account/account/__init__.py (+2/-3) l10n_it_account/account/account.py (+0/-136) l10n_it_account/account/partner_view.xml (+0/-27) l10n_it_fiscalcode/AUTHORS.txt (+10/-0) l10n_it_fiscalcode/__init__.py (+25/-0) l10n_it_fiscalcode/__openerp__.py (+46/-0) l10n_it_fiscalcode/fiscalcode.py (+49/-0) l10n_it_fiscalcode/fiscalcode_view.xml (+24/-0) l10n_it_fiscalcode/i18n/it.po (+113/-0) l10n_it_fiscalcode/i18n/l10n_it_account.pot (+117/-0) l10n_it_fiscalcode/wizard/__init__.py (+24/-0) l10n_it_fiscalcode/wizard/compute_fc.py (+125/-0) l10n_it_fiscalcode/wizard/compute_fc_view.xml (+50/-0) l10n_it_sale/AUTHORS.txt (+1/-1) l10n_it_sale/partner/partner_view.xml (+7/-8) l10n_it_withholding_tax/i18n/it.po (+150/-0) |
To merge this branch: | bzr merge lp:~openobject-italia-core-devs/openobject-italia/add_abi_cab |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lorenzo Battistini | Disapprove | ||
Review via email:
|
This proposal supersedes a proposal from 2012-10-11.
This proposal has been superseded by a proposal from 2012-10-13.
Commit message
Description of the change
[Add] Abi/Cab code
[Add] New fiscal Code Management
[Add] l10n_it_
[Mod] l10n_it_account removed the fiscal code management.
To post a comment you must log in.
- 207. By Franco Tampieri
-
[Fix] Add some usability improvement
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Lorenzo Battistini (elbati) wrote : Posted in a previous version of this proposal | # |
review:
Disapprove
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Lorenzo Battistini (elbati) wrote : | # |
review:
Disapprove
- 208. By Lorenzo Battistini
-
[fix] reverting l10n_it_account to 6.1 version
- 209. By Lorenzo Battistini
-
[fix] l10n_it_account reverted
- 210. By Lorenzo Battistini
-
[FIX] l10n_it_fiscalcode - view
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'l10n_it_abicab' |
2 | === added file 'l10n_it_abicab/AUTHORS.txt' |
3 | --- l10n_it_abicab/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
4 | +++ l10n_it_abicab/AUTHORS.txt 2012-10-13 22:49:20 +0000 |
5 | @@ -0,0 +1,1 @@ |
6 | +Franco Tampieri <franco.tampieri@agilebg.com> |
7 | |
8 | === added file 'l10n_it_abicab/__init__.py' |
9 | --- l10n_it_abicab/__init__.py 1970-01-01 00:00:00 +0000 |
10 | +++ l10n_it_abicab/__init__.py 2012-10-13 22:49:20 +0000 |
11 | @@ -0,0 +1,24 @@ |
12 | +# -*- encoding: utf-8 -*- |
13 | +############################################################################## |
14 | +# |
15 | +# OpenERP, Open Source Management Solution |
16 | +# Copyright (C) 2012 |
17 | +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) |
18 | +# |
19 | +# This program is free software: you can redistribute it and/or modify |
20 | +# it under the terms of the GNU Affero General Public License as |
21 | +# published by the Free Software Foundation, either version 3 of the |
22 | +# License, or (at your option) any later version. |
23 | +# |
24 | +# This program is distributed in the hope that it will be useful, |
25 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
26 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
27 | +# GNU Affero General Public License for more details. |
28 | +# |
29 | +# You should have received a copy of the GNU Affero General Public License |
30 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
31 | +# |
32 | +############################################################################# |
33 | + |
34 | +import abicab |
35 | + |
36 | |
37 | === added file 'l10n_it_abicab/__openerp__.py' |
38 | --- l10n_it_abicab/__openerp__.py 1970-01-01 00:00:00 +0000 |
39 | +++ l10n_it_abicab/__openerp__.py 2012-10-13 22:49:20 +0000 |
40 | @@ -0,0 +1,37 @@ |
41 | +# -*- encoding: utf-8 -*- |
42 | +############################################################################## |
43 | +# |
44 | +# OpenERP, Open Source Management Solution |
45 | +# Copyright (C) 2012 |
46 | +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) |
47 | +# |
48 | +# This program is free software: you can redistribute it and/or modify |
49 | +# it under the terms of the GNU Affero General Public License as |
50 | +# published by the Free Software Foundation, either version 3 of the |
51 | +# License, or (at your option) any later version. |
52 | +# |
53 | +# This program is distributed in the hope that it will be useful, |
54 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
55 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
56 | +# GNU Affero General Public License for more details. |
57 | +# |
58 | +# You should have received a copy of the GNU Affero General Public License |
59 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
60 | +# |
61 | +############################################################################# |
62 | + |
63 | +{ |
64 | + 'name': 'Italian Localisation - Base Bank ABI/CAB codes', |
65 | + 'version': '1.0', |
66 | + 'category': 'Localisation/Italy', |
67 | + 'description': """ |
68 | + Insert in the res.bank model the proprieties of the ABI/CAB |
69 | + """, |
70 | + 'author': 'OpenERP Italian Community', |
71 | + 'depends': ['base'], |
72 | + 'website': 'http://www.openerp-italia.org/', |
73 | + 'update_xml': ['abicab_view.xml'], |
74 | + 'installable': True, |
75 | + 'active': False, |
76 | + 'certificate': '', |
77 | +} |
78 | \ No newline at end of file |
79 | |
80 | === added file 'l10n_it_abicab/abicab.py' |
81 | --- l10n_it_abicab/abicab.py 1970-01-01 00:00:00 +0000 |
82 | +++ l10n_it_abicab/abicab.py 2012-10-13 22:49:20 +0000 |
83 | @@ -0,0 +1,46 @@ |
84 | +# -*- encoding: utf-8 -*- |
85 | +############################################################################## |
86 | +# |
87 | +# OpenERP, Open Source Management Solution |
88 | +# Copyright (C) 2012 |
89 | +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) |
90 | +# |
91 | +# This program is free software: you can redistribute it and/or modify |
92 | +# it under the terms of the GNU Affero General Public License as |
93 | +# published by the Free Software Foundation, either version 3 of the |
94 | +# License, or (at your option) any later version. |
95 | +# |
96 | +# This program is distributed in the hope that it will be useful, |
97 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
98 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
99 | +# GNU Affero General Public License for more details. |
100 | +# |
101 | +# You should have received a copy of the GNU Affero General Public License |
102 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
103 | +# |
104 | +############################################################################# |
105 | + |
106 | +from osv import fields, osv |
107 | + |
108 | +class res_bank(osv.osv): |
109 | + _inherit = "res.bank" |
110 | + _columns = { |
111 | + 'abi': fields.char('ABI', size=5), |
112 | + 'cab': fields.char('CAB', size=5), |
113 | + } |
114 | + |
115 | +class res_partner_bank(osv.osv): |
116 | + _inherit = "res.partner.bank" |
117 | + _columns = { |
118 | + 'bank_abi': fields.char('ABI', size=5), |
119 | + 'bank_cab': fields.char('CAB', size=5), |
120 | + } |
121 | + |
122 | + def onchange_bank_id(self, cr, uid, ids, bank_id, context=None): |
123 | + result = super(res_partner_bank, self).onchange_bank_id(cr, uid, ids, bank_id, context=context) |
124 | + if bank_id: |
125 | + bank = self.pool.get('res.bank').browse(cr, uid, bank_id, context=context) |
126 | + result['value']['bank_abi'] = bank.abi |
127 | + result['value']['bank_cab'] = bank.cab |
128 | + return result |
129 | + |
130 | |
131 | === added file 'l10n_it_abicab/abicab_view.xml' |
132 | --- l10n_it_abicab/abicab_view.xml 1970-01-01 00:00:00 +0000 |
133 | +++ l10n_it_abicab/abicab_view.xml 2012-10-13 22:49:20 +0000 |
134 | @@ -0,0 +1,46 @@ |
135 | +<?xml version="1.0" ?> |
136 | +<openerp> |
137 | + <data> |
138 | + |
139 | + <record id="view_bank_tree_abicab" model="ir.ui.view"> |
140 | + <field name="name">res.bank.tree.abicab</field> |
141 | + <field name="model">res.bank</field> |
142 | + <field name="inherit_id" ref="base.view_res_bank_tree"/> |
143 | + <field name="arch" type="xml"> |
144 | + <field name="name" position="after"> |
145 | + <field name="abi"/> |
146 | + <field name="cab"/> |
147 | + </field> |
148 | + </field> |
149 | + </record> |
150 | + |
151 | + <record id="view_bank_form_abicab" model="ir.ui.view"> |
152 | + <field name="name">res.bank.form.abicab</field> |
153 | + <field name="model">res.bank</field> |
154 | + <field name="inherit_id" ref="base.view_res_bank_form"/> |
155 | + <field name="arch" type="xml"> |
156 | + <field name="name" position="after"> |
157 | + <newline/> |
158 | + <separator string="Bank Details" colspan="6"/> |
159 | + <group colspan="6" col="6"> |
160 | + <field name="abi"/> |
161 | + <field name="cab"/> |
162 | + </group> |
163 | + </field> |
164 | + </field> |
165 | + </record> |
166 | + |
167 | + <record id="view_partner_bank_form_abicab" model="ir.ui.view"> |
168 | + <field name="name">res.partner.bank.form</field> |
169 | + <field name="model">res.partner</field> |
170 | + <field name="inherit_id" ref="base.view_partner_form"/> |
171 | + <field name="arch" type="xml"> |
172 | + <field name="bank_name" position="after"> |
173 | + <field name="bank_abi"/> |
174 | + <field name="bank_cab"/> |
175 | + </field> |
176 | + </field> |
177 | + </record> |
178 | + |
179 | + </data> |
180 | +</openerp> |
181 | \ No newline at end of file |
182 | |
183 | === added directory 'l10n_it_abicab/i18n' |
184 | === added file 'l10n_it_abicab/i18n/it.mo' |
185 | Binary files l10n_it_abicab/i18n/it.mo 1970-01-01 00:00:00 +0000 and l10n_it_abicab/i18n/it.mo 2012-10-13 22:49:20 +0000 differ |
186 | === added file 'l10n_it_abicab/i18n/it.po' |
187 | --- l10n_it_abicab/i18n/it.po 1970-01-01 00:00:00 +0000 |
188 | +++ l10n_it_abicab/i18n/it.po 2012-10-13 22:49:20 +0000 |
189 | @@ -0,0 +1,37 @@ |
190 | +# Translation of OpenERP Server. |
191 | +# This file contains the translation of the following modules: |
192 | +# * l10n_it_abicab |
193 | +# |
194 | +msgid "" |
195 | +msgstr "" |
196 | +"Project-Id-Version: OpenERP Server 6.0.3\n" |
197 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
198 | +"POT-Creation-Date: 2011-12-29 13:07+0000\n" |
199 | +"PO-Revision-Date: 2011-12-29 14:08+0100\n" |
200 | +"Last-Translator: Franco Tampieri <info@titdata.it>\n" |
201 | +"Language-Team: \n" |
202 | +"MIME-Version: 1.0\n" |
203 | +"Content-Type: text/plain; charset=UTF-8\n" |
204 | +"Content-Transfer-Encoding: 8bit\n" |
205 | +"Plural-Forms: \n" |
206 | + |
207 | +#. module: l10n_it_abicab |
208 | +#: field:res.bank,abi:0 |
209 | +msgid "ABI" |
210 | +msgstr "ABI" |
211 | + |
212 | +#. module: l10n_it_abicab |
213 | +#: view:res.bank:0 |
214 | +msgid "Bank Details" |
215 | +msgstr "Dettagli Banca" |
216 | + |
217 | +#. module: l10n_it_abicab |
218 | +#: model:ir.model,name:l10n_it_abicab.model_res_bank |
219 | +msgid "Bank" |
220 | +msgstr "Banca" |
221 | + |
222 | +#. module: l10n_it_abicab |
223 | +#: field:res.bank,cab:0 |
224 | +msgid "CAB" |
225 | +msgstr "CAB" |
226 | + |
227 | |
228 | === modified file 'l10n_it_account/AUTHORS.txt' |
229 | --- l10n_it_account/AUTHORS.txt 2010-09-22 13:43:42 +0000 |
230 | +++ l10n_it_account/AUTHORS.txt 2012-10-13 22:49:20 +0000 |
231 | @@ -6,4 +6,5 @@ |
232 | Giovanni Barzan <giovanni.barzan@gmail.com> |
233 | Lorenzo Battistini <lorenzo.battistini@albatos.com> |
234 | Roberto Onnis <onnis.roberto@gmail.com> |
235 | +Franco Tampieri <franco.tampieri@agilebg.com> |
236 | |
237 | |
238 | === modified file 'l10n_it_account/__init__.py' |
239 | --- l10n_it_account/__init__.py 2012-03-09 08:52:48 +0000 |
240 | +++ l10n_it_account/__init__.py 2012-10-13 22:49:20 +0000 |
241 | @@ -1,8 +1,8 @@ |
242 | # -*- coding: utf-8 -*- |
243 | ############################################################################## |
244 | -# |
245 | +# |
246 | # Copyright (C) 2010 Associazione OpenERP Italia |
247 | -# (<http://www.openerp-italia.org>). |
248 | +# (<http://www.openerp-italia.org>). |
249 | # All Rights Reserved |
250 | # |
251 | # This program is free software: you can redistribute it and/or modify |
252 | @@ -21,5 +21,4 @@ |
253 | ############################################################################## |
254 | |
255 | import account |
256 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
257 | |
258 | |
259 | === modified file 'l10n_it_account/__openerp__.py' |
260 | --- l10n_it_account/__openerp__.py 2012-03-09 08:52:48 +0000 |
261 | +++ l10n_it_account/__openerp__.py 2012-10-13 22:49:20 +0000 |
262 | @@ -1,8 +1,8 @@ |
263 | # -*- coding: utf-8 -*- |
264 | ############################################################################## |
265 | -# |
266 | +# |
267 | # Copyright (C) 2010-2012 Associazione OpenERP Italia |
268 | -# (<http://www.openerp-italia.org>). |
269 | +# (<http://www.openerp-italia.org>). |
270 | # All Rights Reserved |
271 | # |
272 | # This program is free software: you can redistribute it and/or modify |
273 | @@ -34,8 +34,8 @@ |
274 | 'author': 'OpenERP Italian Community', |
275 | 'website': 'http://www.openerp-italia.org', |
276 | 'license': 'AGPL-3', |
277 | - "depends" : ['account','base_vat','account_chart','base_iban', 'l10n_it_base'], |
278 | - "init_xml" : ['account/partner_view.xml'], |
279 | + "depends" : ['account','base_vat','account_chart','base_iban'], |
280 | + "init_xml" : [], |
281 | "update_xml" : [], |
282 | "demo_xml" : [], |
283 | "active": False, |
284 | |
285 | === modified file 'l10n_it_account/account/__init__.py' |
286 | --- l10n_it_account/account/__init__.py 2012-03-09 08:52:48 +0000 |
287 | +++ l10n_it_account/account/__init__.py 2012-10-13 22:49:20 +0000 |
288 | @@ -1,8 +1,8 @@ |
289 | # -*- coding: utf-8 -*- |
290 | ############################################################################## |
291 | -# |
292 | +# |
293 | # Copyright (C) 2010 Associazione OpenERP Italia |
294 | -# (<http://www.openerp-italia.org>). |
295 | +# (<http://www.openerp-italia.org>). |
296 | # All Rights Reserved |
297 | # |
298 | # This program is free software: you can redistribute it and/or modify |
299 | @@ -20,5 +20,4 @@ |
300 | # |
301 | ############################################################################## |
302 | |
303 | -import account |
304 | import invoice |
305 | |
306 | === removed file 'l10n_it_account/account/account.py' |
307 | --- l10n_it_account/account/account.py 2012-03-09 08:52:48 +0000 |
308 | +++ l10n_it_account/account/account.py 1970-01-01 00:00:00 +0000 |
309 | @@ -1,136 +0,0 @@ |
310 | -# -*- coding: utf-8 -*- |
311 | -############################################################################## |
312 | -# |
313 | -# Copyright (C) 2010-2012 Associazione OpenERP Italia |
314 | -# (<http://www.openerp-italia.org>). |
315 | -# All Rights Reserved |
316 | -# |
317 | -# This program is free software: you can redistribute it and/or modify |
318 | -# it under the terms of the GNU Affero General Public License as published by |
319 | -# the Free Software Foundation, either version 3 of the License, or |
320 | -# (at your option) any later version. |
321 | -# |
322 | -# This program is distributed in the hope that it will be useful, |
323 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
324 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
325 | -# GNU General Public License for more details. |
326 | -# |
327 | -# You should have received a copy of the GNU Affero General Public License |
328 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
329 | -# |
330 | -############################################################################## |
331 | - |
332 | -from osv import fields, osv |
333 | -import datetime |
334 | - |
335 | -class res_partner(osv.osv): |
336 | - _inherit = 'res.partner' |
337 | - |
338 | - def check_fiscalcode(self, cr, uid, ids, context={}): |
339 | - |
340 | - for partner in self.browse(cr, uid, ids): |
341 | - if not partner.fiscalcode: |
342 | - return True |
343 | - if len(partner.fiscalcode) != 16: |
344 | - return False |
345 | - |
346 | - return True |
347 | - |
348 | - _columns = { |
349 | - 'fiscalcode': fields.char('Fiscal Code', size=16, help="Italian Fiscal Code"), |
350 | - 'fiscalcode_surname': fields.char('Surname', size=64), |
351 | - 'fiscalcode_firstname': fields.char('First name', size=64), |
352 | - 'birth_date': fields.date('Date of birth'), |
353 | - 'birth_city': fields.many2one('res.city', 'City of birth'), |
354 | - 'sex': fields.selection([ |
355 | - ('M','Male'), |
356 | - ('F', 'Female'), |
357 | - ], "Sex"), |
358 | - } |
359 | - #_constraints = [(check_fiscalcode, "The fiscal code doesn't seem to be correct.", ["fiscalcode"])] |
360 | - |
361 | - |
362 | - def _codicefiscale(self, cognome, nome, giornonascita, mesenascita, annonascita, |
363 | - sesso, cittanascita): |
364 | - |
365 | - MESI = 'ABCDEHLMPRST' |
366 | - CONSONANTI = 'BCDFGHJKLMNPQRSTVWXYZ' |
367 | - VOCALI = 'AEIOU' |
368 | - LETTERE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
369 | - REGOLECONTROLLO = { |
370 | - 'A':(0,1), 'B':(1,0), 'C':(2,5), 'D':(3,7), 'E':(4,9), |
371 | - 'F':(5,13), 'G':(6,15), 'H':(7,17), 'I':(8,19), 'J':(9,21), |
372 | - 'K':(10,2), 'L':(11,4), 'M':(12,18), 'N':(13,20), 'O':(14,11), |
373 | - 'P':(15,3), 'Q':(16,6), 'R':(17,8), 'S':(18,12), 'T':(19,14), |
374 | - 'U':(20,16), 'V':(21,10), 'W':(22,22), 'X':(23,25), 'Y':(24,24), |
375 | - 'Z':(25,23), |
376 | - '0':(0,1), '1':(1,0), '2':(2,5), '3':(3,7), '4':(4,9), |
377 | - '5':(5,13), '6':(6,15), '7':(7,17), '8':(8,19), '9':(9,21) |
378 | - } |
379 | - ### |
380 | - # Funzioni |
381 | - ## |
382 | - |
383 | - def _surname(stringa): |
384 | - """Ricava, da stringa, 3 lettere in base alla convenzione dei CF.""" |
385 | - cons = [c for c in stringa if c in CONSONANTI] |
386 | - voc = [c for c in stringa if c in VOCALI] |
387 | - chars=cons+voc |
388 | - if len(chars)<3: |
389 | - chars+=['X', 'X'] |
390 | - return chars[:3] |
391 | - |
392 | - def _name(stringa): |
393 | - """Ricava, da stringa, 3 lettere in base alla convenzione dei CF.""" |
394 | - cons = [c for c in stringa if c in CONSONANTI] |
395 | - voc = [c for c in stringa if c in VOCALI] |
396 | - if len(cons)>3: |
397 | - cons = [cons[0]] +[cons[2]] + [cons[3]] |
398 | - chars=cons+voc |
399 | - if len(chars)<3: |
400 | - chars+=['X', 'X'] |
401 | - return chars[:3] |
402 | - |
403 | - def _datan(giorno, mese, anno, sesso): |
404 | - """Restituisce il campo data del CF.""" |
405 | - chars = (list(anno[-2:]) + [MESI[int(mese)-1]]) |
406 | - gn=int(giorno) |
407 | - if sesso=='F': |
408 | - gn+=40 |
409 | - chars += list("%02d" % gn) |
410 | - return chars |
411 | - |
412 | - def _codicecontrollo(c): |
413 | - """Restituisce il codice di controllo, l'ultimo carattere del CF.""" |
414 | - sommone = 0 |
415 | - for i, car in enumerate(c): |
416 | - j = 1 - i % 2 |
417 | - sommone += REGOLECONTROLLO[car][j] |
418 | - resto = sommone % 26 |
419 | - return [LETTERE[resto]] |
420 | - |
421 | - """Restituisce il CF costruito sulla base degli argomenti.""" |
422 | - nome=nome.upper() |
423 | - cognome=cognome.upper() |
424 | - sesso=sesso.upper() |
425 | - cittanascita = cittanascita.upper() |
426 | - chars = (_surname(cognome) + |
427 | - _name(nome) + |
428 | - _datan(giornonascita, mesenascita, annonascita, sesso) + |
429 | - list(cittanascita)) |
430 | - chars += _codicecontrollo(chars) |
431 | - return ''.join(chars) |
432 | - |
433 | - def compute_fiscal_code(self, cr, uid, ids, context): |
434 | - partners = self.browse(cr, uid, ids, context) |
435 | - for partner in partners: |
436 | - if not partner.fiscalcode_surname or not partner.fiscalcode_firstname or not partner.birth_date or not partner.birth_city or not partner.sex: |
437 | - raise osv.except_osv('Error', 'One or more fields are missing') |
438 | - birth_date = datetime.datetime.strptime(partner.birth_date, "%Y-%m-%d") |
439 | - CF = self._codicefiscale(partner.fiscalcode_surname, partner.fiscalcode_firstname, str(birth_date.day), |
440 | - str(birth_date.month), str(birth_date.year), partner.sex, |
441 | - partner.birth_city.cadaster_code) |
442 | - self.write(cr, uid, partner.id, {'fiscalcode': CF}) |
443 | - return True |
444 | - |
445 | -res_partner() |
446 | |
447 | === removed file 'l10n_it_account/account/partner_view.xml' |
448 | --- l10n_it_account/account/partner_view.xml 2010-10-28 16:05:31 +0000 |
449 | +++ l10n_it_account/account/partner_view.xml 1970-01-01 00:00:00 +0000 |
450 | @@ -1,27 +0,0 @@ |
451 | -<?xml version="1.0" ?> |
452 | -<openerp> |
453 | - <data> |
454 | - |
455 | - <record id="view_partner_form_fiscalcode_data" model="ir.ui.view"> |
456 | - <field name="name">res.partner.fiscalcode.data</field> |
457 | - <field name="model">res.partner</field> |
458 | - <field name="inherit_id" ref="base.view_partner_form"/> |
459 | - <field name="arch" type="xml"> |
460 | - <page string="Notes" position="after" > |
461 | - <page string="Fiscal Code" > |
462 | - <separator colspan="4"/> |
463 | - <field name="fiscalcode"/> |
464 | - <newline/> |
465 | - <separator string="Compute Fiscal Code" colspan="4"/> |
466 | - <field name="fiscalcode_surname"/> |
467 | - <field name="fiscalcode_firstname"/> |
468 | - <field name="birth_date"/> |
469 | - <field name="birth_city"/> |
470 | - <field name="sex"/> |
471 | - <button name="compute_fiscal_code" type="object" string="Compute"/> |
472 | - </page> |
473 | - </page> |
474 | - </field> |
475 | - </record> |
476 | - </data> |
477 | -</openerp> |
478 | |
479 | === added directory 'l10n_it_fiscalcode' |
480 | === added file 'l10n_it_fiscalcode/AUTHORS.txt' |
481 | --- l10n_it_fiscalcode/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
482 | +++ l10n_it_fiscalcode/AUTHORS.txt 2012-10-13 22:49:20 +0000 |
483 | @@ -0,0 +1,10 @@ |
484 | +Davide Corio <davide.corio@domsense.com> |
485 | +Luca Subiaco <subluca@gmail.com> |
486 | +Simone Orsi <simone.orsi@domsense.com> |
487 | +Mario Riva <mario.riva@domsense.com> |
488 | +Mauro Soligo <mauro.soligo@katodo.com> |
489 | +Giovanni Barzan <giovanni.barzan@gmail.com> |
490 | +Lorenzo Battistini <lorenzo.battistini@albatos.com> |
491 | +Roberto Onnis <onnis.roberto@gmail.com> |
492 | +Franco Tampieri <franco.tampieri@agilebg.com> |
493 | + |
494 | |
495 | === added file 'l10n_it_fiscalcode/__init__.py' |
496 | --- l10n_it_fiscalcode/__init__.py 1970-01-01 00:00:00 +0000 |
497 | +++ l10n_it_fiscalcode/__init__.py 2012-10-13 22:49:20 +0000 |
498 | @@ -0,0 +1,25 @@ |
499 | +# -*- coding: utf-8 -*- |
500 | +############################################################################## |
501 | +# |
502 | +# Copyright (C) 2012 Associazione OpenERP Italia |
503 | +# (<http://www.openerp-italia.org>). |
504 | +# All Rights Reserved |
505 | +# |
506 | +# This program is free software: you can redistribute it and/or modify |
507 | +# it under the terms of the GNU Affero General Public License as published by |
508 | +# the Free Software Foundation, either version 3 of the License, or |
509 | +# (at your option) any later version. |
510 | +# |
511 | +# This program is distributed in the hope that it will be useful, |
512 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
513 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
514 | +# GNU General Public License for more details. |
515 | +# |
516 | +# You should have received a copy of the GNU Affero General Public License |
517 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
518 | +# |
519 | +############################################################################## |
520 | + |
521 | +import fiscalcode |
522 | +import wizard |
523 | + |
524 | |
525 | === added file 'l10n_it_fiscalcode/__openerp__.py' |
526 | --- l10n_it_fiscalcode/__openerp__.py 1970-01-01 00:00:00 +0000 |
527 | +++ l10n_it_fiscalcode/__openerp__.py 2012-10-13 22:49:20 +0000 |
528 | @@ -0,0 +1,46 @@ |
529 | +# -*- coding: utf-8 -*- |
530 | +############################################################################## |
531 | +# |
532 | +# Copyright (C) 2010-2012 Associazione OpenERP Italia |
533 | +# (<http://www.openerp-italia.org>). |
534 | +# All Rights Reserved |
535 | +# |
536 | +# This program is free software: you can redistribute it and/or modify |
537 | +# it under the terms of the GNU Affero General Public License as published |
538 | +# by the Free Software Foundation, either version 3 of the License, or |
539 | +# (at your option) any later version. |
540 | +# |
541 | +# This program is distributed in the hope that it will be useful, |
542 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
543 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
544 | +# GNU General Public License for more details. |
545 | +# |
546 | +# You should have received a copy of the GNU Affero General Public License |
547 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
548 | +# |
549 | +############################################################################## |
550 | +{ |
551 | + 'name': 'Italian Localisation - Fiscal Code', |
552 | + 'version': '0.1', |
553 | + 'category': 'Localisation/Italy', |
554 | + 'description': """ |
555 | +This module customizes OpenERP in order to fit italian laws and mores - Account version |
556 | + |
557 | +Functionalities: |
558 | + |
559 | +- Fiscal code computation for partner |
560 | + |
561 | +""", |
562 | + 'author': 'OpenERP Italian Community', |
563 | + 'website': 'http://www.openerp-italia.org', |
564 | + 'license': 'AGPL-3', |
565 | + "depends" : ['base', 'l10n_it_base'], |
566 | + "init_xml" : [ |
567 | + 'fiscalcode_view.xml', |
568 | + 'wizard/compute_fc_view.xml' |
569 | + ], |
570 | + "update_xml" : [], |
571 | + "demo_xml" : [], |
572 | + "active": False, |
573 | + "installable": True |
574 | +} |
575 | |
576 | === added file 'l10n_it_fiscalcode/fiscalcode.py' |
577 | --- l10n_it_fiscalcode/fiscalcode.py 1970-01-01 00:00:00 +0000 |
578 | +++ l10n_it_fiscalcode/fiscalcode.py 2012-10-13 22:49:20 +0000 |
579 | @@ -0,0 +1,49 @@ |
580 | +# -*- coding: utf-8 -*- |
581 | +############################################################################## |
582 | +# |
583 | +# Copyright (C) 2010-2012 Associazione OpenERP Italia |
584 | +# (<http://www.openerp-italia.org>). |
585 | +# All Rights Reserved |
586 | +# |
587 | +# This program is free software: you can redistribute it and/or modify |
588 | +# it under the terms of the GNU Affero General Public License as published by |
589 | +# the Free Software Foundation, either version 3 of the License, or |
590 | +# (at your option) any later version. |
591 | +# |
592 | +# This program is distributed in the hope that it will be useful, |
593 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
594 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
595 | +# GNU General Public License for more details. |
596 | +# |
597 | +# You should have received a copy of the GNU Affero General Public License |
598 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
599 | +# |
600 | +############################################################################## |
601 | + |
602 | +from osv import fields, osv |
603 | +import tools |
604 | +import pooler |
605 | +from tools.translate import _ |
606 | +import datetime |
607 | + |
608 | +class res_partner(osv.osv): |
609 | + _inherit = 'res.partner' |
610 | + |
611 | + def check_fiscalcode(self, cr, uid, ids, context={}): |
612 | + |
613 | + for partner in self.browse(cr, uid, ids): |
614 | + if not partner.fiscalcode: |
615 | + return True |
616 | + elif len(partner.fiscalcode) != 16 and partner.individual: |
617 | + return False |
618 | + else: |
619 | + return True |
620 | + |
621 | + _columns = { |
622 | + 'fiscalcode': fields.char('Fiscal Code', size=16, help="Italian Fiscal Code"), |
623 | + 'individual': fields.boolean('Individual', help="If checked the C.F. is referred to a Individual Person"), |
624 | + } |
625 | + _defaults = { |
626 | + 'individual': False, |
627 | + } |
628 | + _constraints = [(check_fiscalcode, "The fiscal code doesn't seem to be correct.", ["fiscalcode"])] |
629 | \ No newline at end of file |
630 | |
631 | === added file 'l10n_it_fiscalcode/fiscalcode_view.xml' |
632 | --- l10n_it_fiscalcode/fiscalcode_view.xml 1970-01-01 00:00:00 +0000 |
633 | +++ l10n_it_fiscalcode/fiscalcode_view.xml 2012-10-13 22:49:20 +0000 |
634 | @@ -0,0 +1,24 @@ |
635 | +<?xml version="1.0" ?> |
636 | +<openerp> |
637 | + <data> |
638 | + |
639 | + <record id="view_partner_form_fiscalcode_data" model="ir.ui.view"> |
640 | + <field name="name">res.partner.fiscalcode.data</field> |
641 | + <field name="model">res.partner</field> |
642 | + <field name="inherit_id" ref="base.view_partner_form"/> |
643 | + <field name="arch" type="xml"> |
644 | + <field name="property_account_payable" position="after"> |
645 | + <separator string="Fiscal Data" colspan="2"/> |
646 | + <group colspan="2" col="6"> |
647 | + <field name="fiscalcode"/> |
648 | + <field name="individual" colspan="1" groups="base.group_extended" /> |
649 | + </group> |
650 | + </field> |
651 | + <field name="property_account_position" position="before"> |
652 | + <separator string="Payment Mode" colspan="2"/> |
653 | + </field> |
654 | + </field> |
655 | + </record> |
656 | + |
657 | + </data> |
658 | +</openerp> |
659 | |
660 | === added directory 'l10n_it_fiscalcode/i18n' |
661 | === added file 'l10n_it_fiscalcode/i18n/it.mo' |
662 | Binary files l10n_it_fiscalcode/i18n/it.mo 1970-01-01 00:00:00 +0000 and l10n_it_fiscalcode/i18n/it.mo 2012-10-13 22:49:20 +0000 differ |
663 | === added file 'l10n_it_fiscalcode/i18n/it.po' |
664 | --- l10n_it_fiscalcode/i18n/it.po 1970-01-01 00:00:00 +0000 |
665 | +++ l10n_it_fiscalcode/i18n/it.po 2012-10-13 22:49:20 +0000 |
666 | @@ -0,0 +1,113 @@ |
667 | +# Translation of OpenERP Server. |
668 | +# This file contains the translation of the following modules: |
669 | +# * l10n_it_fiscalcode |
670 | +# |
671 | +msgid "" |
672 | +msgstr "" |
673 | +"Project-Id-Version: OpenERP Server 6.1\n" |
674 | +"Report-Msgid-Bugs-To: \n" |
675 | +"POT-Creation-Date: 2012-10-13 21:44+0000\n" |
676 | +"PO-Revision-Date: 2012-10-13 23:49+0100\n" |
677 | +"Last-Translator: Franco Tampieri <info@francotampieri.com>\n" |
678 | +"Language-Team: \n" |
679 | +"MIME-Version: 1.0\n" |
680 | +"Content-Type: text/plain; charset=UTF-8\n" |
681 | +"Content-Transfer-Encoding: 8bit\n" |
682 | +"Plural-Forms: \n" |
683 | + |
684 | +#. module: l10n_it_fiscalcode |
685 | +#: field:wizard.compute.fc,fiscalcode_surname:0 |
686 | +msgid "Surname" |
687 | +msgstr "Cognome" |
688 | + |
689 | +#. module: l10n_it_fiscalcode |
690 | +#: model:ir.model,name:l10n_it_fiscalcode.model_res_partner |
691 | +msgid "Partner" |
692 | +msgstr "Cliente" |
693 | + |
694 | +#. module: l10n_it_fiscalcode |
695 | +#: help:res.partner,individual:0 |
696 | +msgid "If checked the C.F. is referred to a Individual Person" |
697 | +msgstr "Se selezionato il Cofice Fiscale farร riferimento a quello di una Persona Fisica" |
698 | + |
699 | +#. module: l10n_it_fiscalcode |
700 | +#: view:wizard.compute.fc:0 |
701 | +msgid "Compute" |
702 | +msgstr "Calcola" |
703 | + |
704 | +#. module: l10n_it_fiscalcode |
705 | +#: field:wizard.compute.fc,birth_date:0 |
706 | +msgid "Date of birth" |
707 | +msgstr "Data di nascita" |
708 | + |
709 | +#. module: l10n_it_fiscalcode |
710 | +#: view:res.partner:0 |
711 | +msgid "Payment Mode" |
712 | +msgstr "Modalitร di Pagamento" |
713 | + |
714 | +#. module: l10n_it_fiscalcode |
715 | +#: field:wizard.compute.fc,sex:0 |
716 | +msgid "Sex" |
717 | +msgstr "Sesso" |
718 | + |
719 | +#. module: l10n_it_fiscalcode |
720 | +#: field:wizard.compute.fc,fiscalcode_firstname:0 |
721 | +msgid "First name" |
722 | +msgstr "Nome" |
723 | + |
724 | +#. module: l10n_it_fiscalcode |
725 | +#: view:wizard.compute.fc:0 |
726 | +msgid "Fiscal Code" |
727 | +msgstr "Codice Fiscale" |
728 | + |
729 | +#. module: l10n_it_fiscalcode |
730 | +#: field:res.partner,individual:0 |
731 | +msgid "Individual" |
732 | +msgstr "Persona Fisica" |
733 | + |
734 | +#. module: l10n_it_fiscalcode |
735 | +#: view:wizard.compute.fc:0 |
736 | +msgid "Individual Data" |
737 | +msgstr "Dati Persona Fisica" |
738 | + |
739 | +#. module: l10n_it_fiscalcode |
740 | +#: selection:wizard.compute.fc,sex:0 |
741 | +msgid "Female" |
742 | +msgstr "Femmina" |
743 | + |
744 | +#. module: l10n_it_fiscalcode |
745 | +#: view:res.partner:0 |
746 | +msgid "Fiscal Data" |
747 | +msgstr "Dati Fiscali" |
748 | + |
749 | +#. module: l10n_it_fiscalcode |
750 | +#: view:wizard.compute.fc:0 |
751 | +msgid "Cancel" |
752 | +msgstr "Annulla" |
753 | + |
754 | +#. module: l10n_it_fiscalcode |
755 | +#: model:ir.actions.act_window,name:l10n_it_fiscalcode.action_compute_fc |
756 | +#: model:ir.model,name:l10n_it_fiscalcode.model_wizard_compute_fc |
757 | +msgid "Compute Fiscal Code" |
758 | +msgstr "Calcola il Codice Fiscale" |
759 | + |
760 | +#. module: l10n_it_fiscalcode |
761 | +#: view:res.partner:0 |
762 | +msgid "Compute F.C." |
763 | +msgstr "Calcola C.F." |
764 | + |
765 | +#. module: l10n_it_fiscalcode |
766 | +#: selection:wizard.compute.fc,sex:0 |
767 | +msgid "Male" |
768 | +msgstr "Maschio" |
769 | + |
770 | +#. module: l10n_it_fiscalcode |
771 | +#: field:wizard.compute.fc,birth_city:0 |
772 | +msgid "City of birth" |
773 | +msgstr "Cittร di Nascita" |
774 | + |
775 | +#. module: l10n_it_fiscalcode |
776 | +#: constraint:res.partner:0 |
777 | +msgid "The fiscal code doesn't seem to be correct." |
778 | +msgstr "Il Codice Fiscale non sembra corretto per una Persona Fisica." |
779 | + |
780 | |
781 | === added file 'l10n_it_fiscalcode/i18n/l10n_it_account.pot' |
782 | --- l10n_it_fiscalcode/i18n/l10n_it_account.pot 1970-01-01 00:00:00 +0000 |
783 | +++ l10n_it_fiscalcode/i18n/l10n_it_account.pot 2012-10-13 22:49:20 +0000 |
784 | @@ -0,0 +1,117 @@ |
785 | +# Translation of OpenERP Server. |
786 | +# This file contains the translation of the following modules: |
787 | +# * l10n_it_account |
788 | +# |
789 | +msgid "" |
790 | +msgstr "" |
791 | +"Project-Id-Version: OpenERP Server 6.0.2\n" |
792 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
793 | +"POT-Creation-Date: 2011-05-05 16:44+0000\n" |
794 | +"PO-Revision-Date: 2011-05-05 16:44+0000\n" |
795 | +"Last-Translator: <>\n" |
796 | +"Language-Team: \n" |
797 | +"MIME-Version: 1.0\n" |
798 | +"Content-Type: text/plain; charset=UTF-8\n" |
799 | +"Content-Transfer-Encoding: \n" |
800 | +"Plural-Forms: \n" |
801 | + |
802 | +#. module: l10n_it_account |
803 | +#: code:addons/l10n_it_account/account/invoice.py:45 |
804 | +#, python-format |
805 | +msgid "Cannot create invoice! Post the invoice with a greater date" |
806 | +msgstr "" |
807 | + |
808 | +#. module: l10n_it_account |
809 | +#: view:res.partner:0 |
810 | +msgid "Compute" |
811 | +msgstr "" |
812 | + |
813 | +#. module: l10n_it_account |
814 | +#: model:ir.model,name:l10n_it_account.model_account_invoice |
815 | +msgid "Invoice" |
816 | +msgstr "" |
817 | + |
818 | +#. module: l10n_it_account |
819 | +#: field:res.partner,birth_date:0 |
820 | +msgid "Date of birth" |
821 | +msgstr "" |
822 | + |
823 | +#. module: l10n_it_account |
824 | +#: view:res.partner:0 |
825 | +msgid "Notes" |
826 | +msgstr "" |
827 | + |
828 | +#. module: l10n_it_account |
829 | +#: model:ir.module.module,description:l10n_it_account.module_meta_information |
830 | +msgid "This module customizes OpenERP in order to fit italian laws and mores - Account version\n" |
831 | +"\n" |
832 | +"Functionalities:\n" |
833 | +"\n" |
834 | +"- Fiscal code computation for partner\n" |
835 | +"- Check invoice date consistency\n" |
836 | +"\n" |
837 | +"" |
838 | +msgstr "" |
839 | + |
840 | +#. module: l10n_it_account |
841 | +#: help:res.partner,fiscalcode:0 |
842 | +msgid "Italian Fiscal Code" |
843 | +msgstr "" |
844 | + |
845 | +#. module: l10n_it_account |
846 | +#: field:res.partner,sex:0 |
847 | +msgid "Sex" |
848 | +msgstr "" |
849 | + |
850 | +#. module: l10n_it_account |
851 | +#: field:res.partner,fiscalcode_surname:0 |
852 | +msgid "Surname" |
853 | +msgstr "" |
854 | + |
855 | +#. module: l10n_it_account |
856 | +#: field:res.partner,fiscalcode_firstname:0 |
857 | +msgid "First name" |
858 | +msgstr "" |
859 | + |
860 | +#. module: l10n_it_account |
861 | +#: view:res.partner:0 |
862 | +#: field:res.partner,fiscalcode:0 |
863 | +msgid "Fiscal Code" |
864 | +msgstr "" |
865 | + |
866 | +#. module: l10n_it_account |
867 | +#: model:ir.module.module,shortdesc:l10n_it_account.module_meta_information |
868 | +msgid "Italian Localisation - Account" |
869 | +msgstr "" |
870 | + |
871 | +#. module: l10n_it_account |
872 | +#: selection:res.partner,sex:0 |
873 | +msgid "Female" |
874 | +msgstr "" |
875 | + |
876 | +#. module: l10n_it_account |
877 | +#: model:ir.model,name:l10n_it_account.model_res_partner |
878 | +msgid "Partner" |
879 | +msgstr "" |
880 | + |
881 | +#. module: l10n_it_account |
882 | +#: view:res.partner:0 |
883 | +msgid "Compute Fiscal Code" |
884 | +msgstr "" |
885 | + |
886 | +#. module: l10n_it_account |
887 | +#: selection:res.partner,sex:0 |
888 | +msgid "Male" |
889 | +msgstr "" |
890 | + |
891 | +#. module: l10n_it_account |
892 | +#: code:addons/l10n_it_account/account/invoice.py:44 |
893 | +#, python-format |
894 | +msgid "Date Inconsistency" |
895 | +msgstr "" |
896 | + |
897 | +#. module: l10n_it_account |
898 | +#: field:res.partner,birth_city:0 |
899 | +msgid "City of birth" |
900 | +msgstr "" |
901 | + |
902 | |
903 | === added directory 'l10n_it_fiscalcode/wizard' |
904 | === added file 'l10n_it_fiscalcode/wizard/__init__.py' |
905 | --- l10n_it_fiscalcode/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
906 | +++ l10n_it_fiscalcode/wizard/__init__.py 2012-10-13 22:49:20 +0000 |
907 | @@ -0,0 +1,24 @@ |
908 | +# -*- coding: utf-8 -*- |
909 | +############################################################################## |
910 | +# |
911 | +# Copyright (C) 2012 Associazione OpenERP Italia |
912 | +# (<http://www.openerp-italia.org>). |
913 | +# All Rights Reserved |
914 | +# |
915 | +# This program is free software: you can redistribute it and/or modify |
916 | +# it under the terms of the GNU Affero General Public License as published by |
917 | +# the Free Software Foundation, either version 3 of the License, or |
918 | +# (at your option) any later version. |
919 | +# |
920 | +# This program is distributed in the hope that it will be useful, |
921 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
922 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
923 | +# GNU General Public License for more details. |
924 | +# |
925 | +# You should have received a copy of the GNU Affero General Public License |
926 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
927 | +# |
928 | +############################################################################## |
929 | + |
930 | +import compute_fc |
931 | + |
932 | |
933 | === added file 'l10n_it_fiscalcode/wizard/compute_fc.py' |
934 | --- l10n_it_fiscalcode/wizard/compute_fc.py 1970-01-01 00:00:00 +0000 |
935 | +++ l10n_it_fiscalcode/wizard/compute_fc.py 2012-10-13 22:49:20 +0000 |
936 | @@ -0,0 +1,125 @@ |
937 | +# -*- coding: utf-8 -*- |
938 | +############################################################################## |
939 | +# |
940 | +# Copyright (C) 2010-2012 Associazione OpenERP Italia |
941 | +# (<http://www.openerp-italia.org>). |
942 | +# All Rights Reserved |
943 | +# |
944 | +# This program is free software: you can redistribute it and/or modify |
945 | +# it under the terms of the GNU Affero General Public License as published by |
946 | +# the Free Software Foundation, either version 3 of the License, or |
947 | +# (at your option) any later version. |
948 | +# |
949 | +# This program is distributed in the hope that it will be useful, |
950 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
951 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
952 | +# GNU General Public License for more details. |
953 | +# |
954 | +# You should have received a copy of the GNU Affero General Public License |
955 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
956 | +# |
957 | +############################################################################## |
958 | + |
959 | +from osv import fields, osv |
960 | +import tools |
961 | +import pooler |
962 | +from tools.translate import _ |
963 | + |
964 | +import datetime |
965 | + |
966 | +class wizard_compute_fc(osv.osv_memory): |
967 | + |
968 | + _name = "wizard.compute.fc" |
969 | + _description = "Compute Fiscal Code" |
970 | + _columns = { |
971 | + 'fiscalcode_surname': fields.char('Surname', size=64), |
972 | + 'fiscalcode_firstname': fields.char('First name', size=64), |
973 | + 'birth_date': fields.date('Date of birth'), |
974 | + 'birth_city': fields.many2one('res.city', 'City of birth'), |
975 | + 'sex': fields.selection([('M','Male'), |
976 | + ('F', 'Female'), |
977 | + ], "Sex"), |
978 | + } |
979 | + |
980 | + |
981 | + def _codicefiscale(self, cognome, nome, giornonascita, mesenascita, annonascita, sesso, cittanascita): |
982 | + |
983 | + MESI = 'ABCDEHLMPRST' |
984 | + CONSONANTI = 'BCDFGHJKLMNPQRSTVWXYZ' |
985 | + VOCALI = 'AEIOU' |
986 | + LETTERE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
987 | + |
988 | + REGOLECONTROLLO = { |
989 | + 'A':(0,1), 'B':(1,0), 'C':(2,5), 'D':(3,7), 'E':(4,9), |
990 | + 'F':(5,13), 'G':(6,15), 'H':(7,17), 'I':(8,19), 'J':(9,21), |
991 | + 'K':(10,2), 'L':(11,4), 'M':(12,18), 'N':(13,20), 'O':(14,11), |
992 | + 'P':(15,3), 'Q':(16,6), 'R':(17,8), 'S':(18,12), 'T':(19,14), |
993 | + 'U':(20,16), 'V':(21,10), 'W':(22,22), 'X':(23,25), 'Y':(24,24), |
994 | + 'Z':(25,23), |
995 | + '0':(0,1), '1':(1,0), '2':(2,5), '3':(3,7), '4':(4,9), |
996 | + '5':(5,13), '6':(6,15), '7':(7,17), '8':(8,19), '9':(9,21) |
997 | + } |
998 | + |
999 | + """Funzioni per il calcolo del C.F.""" |
1000 | + def _surname(stringa): |
1001 | + """Ricava, da stringa, 3 lettere in base alla convenzione dei C.F.""" |
1002 | + cons = [c for c in stringa if c in CONSONANTI] |
1003 | + voc = [c for c in stringa if c in VOCALI] |
1004 | + chars=cons+voc |
1005 | + if len(chars)<3: |
1006 | + chars+=['X', 'X'] |
1007 | + return chars[:3] |
1008 | + |
1009 | + def _name(stringa): |
1010 | + """Ricava, da stringa, 3 lettere in base alla convenzione dei C.F.""" |
1011 | + cons = [c for c in stringa if c in CONSONANTI] |
1012 | + voc = [c for c in stringa if c in VOCALI] |
1013 | + if len(cons)>3: |
1014 | + cons = [cons[0]] +[cons[2]] + [cons[3]] |
1015 | + chars=cons+voc |
1016 | + if len(chars)<3: |
1017 | + chars+=['X', 'X'] |
1018 | + return chars[:3] |
1019 | + |
1020 | + def _datan(giorno, mese, anno, sesso): |
1021 | + """Restituisce il campo data del CF.""" |
1022 | + chars = (list(anno[-2:]) + [MESI[int(mese)-1]]) |
1023 | + gn=int(giorno) |
1024 | + if sesso=='F': |
1025 | + gn+=40 |
1026 | + chars += list("%02d" % gn) |
1027 | + return chars |
1028 | + |
1029 | + def _codicecontrollo(c): |
1030 | + """Restituisce il codice di controllo, l'ultimo carattere del C.F.""" |
1031 | + sommone = 0 |
1032 | + for i, car in enumerate(c): |
1033 | + j = 1 - i % 2 |
1034 | + sommone += REGOLECONTROLLO[car][j] |
1035 | + resto = sommone % 26 |
1036 | + return [LETTERE[resto]] |
1037 | + |
1038 | + """Restituisce il C.F costruito sulla base degli argomenti.""" |
1039 | + nome=nome.upper() |
1040 | + cognome=cognome.upper() |
1041 | + sesso=sesso.upper() |
1042 | + cittanascita = cittanascita.upper() |
1043 | + chars = (_surname(cognome) + |
1044 | + _name(nome) + |
1045 | + _datan(giornonascita, mesenascita, annonascita, sesso) + |
1046 | + list(cittanascita)) |
1047 | + chars += _codicecontrollo(chars) |
1048 | + return ''.join(chars) |
1049 | + |
1050 | + def compute_fc(self, cr, uid, ids, context): |
1051 | + active_id = context.get('active_id', []) |
1052 | + form_obj = self.browse(cr, uid, ids, context) |
1053 | + for fields in form_obj: |
1054 | + if not fields.fiscalcode_surname or not fields.fiscalcode_firstname or not fields.birth_date or not fields.birth_city or not fields.sex: |
1055 | + raise osv.except_osv('Error', 'One or more fields are missing') |
1056 | + birth_date = datetime.datetime.strptime(fields.birth_date, "%Y-%m-%d") |
1057 | + CF = self._codicefiscale(fields.fiscalcode_surname, fields.fiscalcode_firstname, str(birth_date.day), |
1058 | + str(birth_date.month), str(birth_date.year), fields.sex, |
1059 | + fields.birth_city.cadaster_code) |
1060 | + self.pool.get('res.partner').write(cr, uid, active_id, {'fiscalcode': CF, 'individual': True}) |
1061 | + return {} |
1062 | \ No newline at end of file |
1063 | |
1064 | === added file 'l10n_it_fiscalcode/wizard/compute_fc_view.xml' |
1065 | --- l10n_it_fiscalcode/wizard/compute_fc_view.xml 1970-01-01 00:00:00 +0000 |
1066 | +++ l10n_it_fiscalcode/wizard/compute_fc_view.xml 2012-10-13 22:49:20 +0000 |
1067 | @@ -0,0 +1,50 @@ |
1068 | +<?xml version="1.0" ?> |
1069 | +<openerp> |
1070 | + <data> |
1071 | + |
1072 | + <record id="wizard_compute_fc_form" model="ir.ui.view"> |
1073 | + <field name="name">wizard.compute.fc.form</field> |
1074 | + <field name="model">wizard.compute.fc</field> |
1075 | + <field name="type">form</field> |
1076 | + <field name="arch" type="xml"> |
1077 | + <form string="Fiscal Code"> |
1078 | + <group col="2" width="250"> |
1079 | + <group string="Individual Data"> |
1080 | + <field name="fiscalcode_surname" colspan="2" default_focus="1"/> |
1081 | + <field name="fiscalcode_firstname" colspan="2"/> |
1082 | + <field name="sex" colspan="2"/> |
1083 | + <field name="birth_date" colspan="2"/> |
1084 | + <field name="birth_city" colspan="2"/> |
1085 | + </group> |
1086 | + <newline/> |
1087 | + <group col="2"> |
1088 | + <button string="Cancel" special="cancel" icon="gtk-cancel" colspan="1"/> |
1089 | + <button name="compute_fc" type="object" string="Compute" colspan="1"/> |
1090 | + </group> |
1091 | + </group> |
1092 | + </form> |
1093 | + </field> |
1094 | + </record> |
1095 | + |
1096 | + <record id="action_compute_fc" model="ir.actions.act_window"> |
1097 | + <field name="name">Compute Fiscal Code</field> |
1098 | + <field name="type">ir.actions.act_window</field> |
1099 | + <field name="res_model">wizard.compute.fc</field> |
1100 | + <field name="view_type">form</field> |
1101 | + <field name="view_mode">form</field> |
1102 | + <field name="target">new</field> |
1103 | + </record> |
1104 | + |
1105 | + <record id="view_partner_form_fiscalcode_button" model="ir.ui.view"> |
1106 | + <field name="name">res.partner.fiscalcode.button</field> |
1107 | + <field name="model">res.partner</field> |
1108 | + <field name="inherit_id" ref="l10n_it_fiscalcode.view_partner_form_fiscalcode_data"/> |
1109 | + <field name="arch" type="xml"> |
1110 | + <field name="fiscalcode" position="after"> |
1111 | + <button name="%(l10n_it_fiscalcode.action_compute_fc)d" string="Compute F.C." type="action" icon="gtk-execute"/> |
1112 | + </field> |
1113 | + </field> |
1114 | + </record> |
1115 | + |
1116 | + </data> |
1117 | +</openerp> |
1118 | |
1119 | === modified file 'l10n_it_sale/AUTHORS.txt' |
1120 | --- l10n_it_sale/AUTHORS.txt 2010-09-22 13:43:42 +0000 |
1121 | +++ l10n_it_sale/AUTHORS.txt 2012-10-13 22:49:20 +0000 |
1122 | @@ -6,4 +6,4 @@ |
1123 | Giovanni Barzan <giovanni.barzan@gmail.com> |
1124 | Lorenzo Battistini <lorenzo.battistini@albatos.com> |
1125 | Roberto Onnis <onnis.roberto@gmail.com> |
1126 | - |
1127 | +Franco Tampieri <franco.tampieri@agilebg.com> |
1128 | |
1129 | === modified file 'l10n_it_sale/partner/partner_view.xml' |
1130 | --- l10n_it_sale/partner/partner_view.xml 2010-10-10 12:42:33 +0000 |
1131 | +++ l10n_it_sale/partner/partner_view.xml 2012-10-13 22:49:20 +0000 |
1132 | @@ -7,14 +7,13 @@ |
1133 | <field name="inherit_id" ref="base.view_partner_form"/> |
1134 | <field name="type">form</field> |
1135 | <field name="arch" type="xml"> |
1136 | - <page string="Notes" position="after"> |
1137 | - <page string="Default shipping conditions"> |
1138 | - <field name="carriage_condition_id"/> |
1139 | - <newline/> |
1140 | - <field name="goods_description_id"/> |
1141 | - <newline/> |
1142 | - <field name="transportation_reason_id"/> |
1143 | - </page> |
1144 | + <page string="Sales & Purchases" position="inside"> |
1145 | + <group colspan="2" col="2" groups="base.group_extended"> |
1146 | + <separator string="Default shipping conditions" colspan="2"/> |
1147 | + <field name="carriage_condition_id" groups="base.group_extended"/> |
1148 | + <field name="goods_description_id" groups="base.group_extended"/> |
1149 | + <field name="transportation_reason_id" groups="base.group_extended"/> |
1150 | + </group> |
1151 | </page> |
1152 | </field> |
1153 | </record> |
1154 | |
1155 | === added file 'l10n_it_withholding_tax/i18n/it.mo' |
1156 | Binary files l10n_it_withholding_tax/i18n/it.mo 1970-01-01 00:00:00 +0000 and l10n_it_withholding_tax/i18n/it.mo 2012-10-13 22:49:20 +0000 differ |
1157 | === added file 'l10n_it_withholding_tax/i18n/it.po' |
1158 | --- l10n_it_withholding_tax/i18n/it.po 1970-01-01 00:00:00 +0000 |
1159 | +++ l10n_it_withholding_tax/i18n/it.po 2012-10-13 22:49:20 +0000 |
1160 | @@ -0,0 +1,150 @@ |
1161 | +# Translation of OpenERP Server. |
1162 | +# This file contains the translation of the following modules: |
1163 | +# * l10n_it_withholding_tax |
1164 | +# |
1165 | +msgid "" |
1166 | +msgstr "" |
1167 | +"Project-Id-Version: OpenERP Server 6.1\n" |
1168 | +"Report-Msgid-Bugs-To: \n" |
1169 | +"POT-Creation-Date: 2012-10-12 15:54+0000\n" |
1170 | +"PO-Revision-Date: 2012-10-12 18:02+0100\n" |
1171 | +"Last-Translator: Franco Tampieri <info@francotampieri.com>\n" |
1172 | +"Language-Team: \n" |
1173 | +"MIME-Version: 1.0\n" |
1174 | +"Content-Type: text/plain; charset=UTF-8\n" |
1175 | +"Content-Transfer-Encoding: 8bit\n" |
1176 | +"Plural-Forms: \n" |
1177 | + |
1178 | +#. module: l10n_it_withholding_tax |
1179 | +#: code:addons/l10n_it_withholding_tax/account.py:90 |
1180 | +#, python-format |
1181 | +msgid "The company does not have an associated Withholding Payment Term" |
1182 | +msgstr "L'Azienda non ha associato nessun Termine di pagamento per le Ritenute" |
1183 | + |
1184 | +#. module: l10n_it_withholding_tax |
1185 | +#: constraint:res.company:0 |
1186 | +msgid "Error! You can not create recursive companies." |
1187 | +msgstr "Errore! Non รจ possibile creare aziende ricorsive." |
1188 | + |
1189 | +#. module: l10n_it_withholding_tax |
1190 | +#: code:addons/l10n_it_withholding_tax/account.py:106 |
1191 | +#, python-format |
1192 | +msgid "The payment term %s does not have due dates" |
1193 | +msgstr "The payment term %s does not have due dates" |
1194 | + |
1195 | +#. module: l10n_it_withholding_tax |
1196 | +#: code:addons/l10n_it_withholding_tax/account.py:102 |
1197 | +#, python-format |
1198 | +msgid "The payment term %s has too many due dates" |
1199 | +msgstr "The payment term %s has too many due dates" |
1200 | + |
1201 | +#. module: l10n_it_withholding_tax |
1202 | +#: view:account.voucher:0 |
1203 | +msgid "Withholding tax entries" |
1204 | +msgstr "Voci Tasse Ritenute" |
1205 | + |
1206 | +#. module: l10n_it_withholding_tax |
1207 | +#: field:account.invoice,has_withholding:0 |
1208 | +msgid "With withholding tax" |
1209 | +msgstr "Con tasse ritenute" |
1210 | + |
1211 | +#. module: l10n_it_withholding_tax |
1212 | +#: field:res.company,withholding_payment_term_id:0 |
1213 | +msgid "Withholding tax Payment Term" |
1214 | +msgstr "Termini Pagamento Ritenute" |
1215 | + |
1216 | +#. module: l10n_it_withholding_tax |
1217 | +#: field:res.company,withholding_account_id:0 |
1218 | +msgid "Withholding account" |
1219 | +msgstr "Conto Ritenute" |
1220 | + |
1221 | +#. module: l10n_it_withholding_tax |
1222 | +#: sql_constraint:res.company:0 |
1223 | +msgid "The company name must be unique !" |
1224 | +msgstr "Il nome azienda deve essere unico!" |
1225 | + |
1226 | +#. module: l10n_it_withholding_tax |
1227 | +#: field:account.invoice,net_pay:0 |
1228 | +msgid "Net Pay" |
1229 | +msgstr "Netto da Pagare" |
1230 | + |
1231 | +#. module: l10n_it_withholding_tax |
1232 | +#: model:ir.model,name:l10n_it_withholding_tax.model_res_company |
1233 | +msgid "Companies" |
1234 | +msgstr "Aziende" |
1235 | + |
1236 | +#. module: l10n_it_withholding_tax |
1237 | +#: code:addons/l10n_it_withholding_tax/account.py:92 |
1238 | +#, python-format |
1239 | +msgid "The company does not have an associated Withholding journal" |
1240 | +msgstr "L'Azienda non ha un Sezionale associato per le Ritenute" |
1241 | + |
1242 | +#. module: l10n_it_withholding_tax |
1243 | +#: code:addons/l10n_it_withholding_tax/account.py:86 |
1244 | +#: code:addons/l10n_it_withholding_tax/account.py:88 |
1245 | +#: code:addons/l10n_it_withholding_tax/account.py:90 |
1246 | +#: code:addons/l10n_it_withholding_tax/account.py:92 |
1247 | +#: code:addons/l10n_it_withholding_tax/account.py:101 |
1248 | +#: code:addons/l10n_it_withholding_tax/account.py:105 |
1249 | +#, python-format |
1250 | +msgid "Error" |
1251 | +msgstr "Errore" |
1252 | + |
1253 | +#. module: l10n_it_withholding_tax |
1254 | +#: code:addons/l10n_it_withholding_tax/account.py:86 |
1255 | +#, python-format |
1256 | +msgid "Can't handle withholding tax with voucher of type other than payment" |
1257 | +msgstr "Can't handle withholding tax with voucher of type other than payment" |
1258 | + |
1259 | +#. module: l10n_it_withholding_tax |
1260 | +#: help:res.company,withholding_account_id:0 |
1261 | +msgid "Payable account used for amount due to tax authority" |
1262 | +msgstr "Payable account used for amount due to tax authority" |
1263 | + |
1264 | +#. module: l10n_it_withholding_tax |
1265 | +#: sql_constraint:account.invoice:0 |
1266 | +msgid "Invoice Number must be unique per Company!" |
1267 | +msgstr "Nell'azienda il numero fattura dev'essere univoco!" |
1268 | + |
1269 | +#. module: l10n_it_withholding_tax |
1270 | +#: help:res.company,withholding_journal_id:0 |
1271 | +msgid "Journal used for registration of witholding amounts to be paid" |
1272 | +msgstr "Journal used for registration of witholding amounts to be paid" |
1273 | + |
1274 | +#. module: l10n_it_withholding_tax |
1275 | +#: code:addons/l10n_it_withholding_tax/account.py:119 |
1276 | +#, python-format |
1277 | +msgid "Payable withholding - " |
1278 | +msgstr "Ritenute Pagabili - " |
1279 | + |
1280 | +#. module: l10n_it_withholding_tax |
1281 | +#: model:ir.model,name:l10n_it_withholding_tax.model_account_voucher |
1282 | +msgid "Accounting Voucher" |
1283 | +msgstr "Voucher contabile" |
1284 | + |
1285 | +#. module: l10n_it_withholding_tax |
1286 | +#: field:account.invoice,withholding_amount:0 |
1287 | +msgid "Withholding amount" |
1288 | +msgstr "Totale Ritenute" |
1289 | + |
1290 | +#. module: l10n_it_withholding_tax |
1291 | +#: model:ir.model,name:l10n_it_withholding_tax.model_account_invoice |
1292 | +msgid "Invoice" |
1293 | +msgstr "Fattura" |
1294 | + |
1295 | +#. module: l10n_it_withholding_tax |
1296 | +#: field:res.company,withholding_journal_id:0 |
1297 | +msgid "Withholding journal" |
1298 | +msgstr "Sezionale Ritenute" |
1299 | + |
1300 | +#. module: l10n_it_withholding_tax |
1301 | +#: code:addons/l10n_it_withholding_tax/account.py:88 |
1302 | +#, python-format |
1303 | +msgid "The company does not have an associated Withholding account" |
1304 | +msgstr "L'Azienda non ha un conto associato per le Ritenute" |
1305 | + |
1306 | +#. module: l10n_it_withholding_tax |
1307 | +#: field:account.voucher,withholding_move_ids:0 |
1308 | +msgid "Withholding Tax Entries" |
1309 | +msgstr "Voci Tasse Ritenute" |
1310 | + |
https:/ /code.launchpad .net/~dr. dran/openobject -italia/ add_abi_ cab/+merge/ 129576/ comments/ 279093