← Back to team overview

openobject-italia-core-devs team mailing list archive

[Merge] lp:~icsergio/openobject-italia/adding_l10n_it_account into lp:openobject-italia/7.0

 

Sergio Corato has proposed merging lp:~icsergio/openobject-italia/adding_l10n_it_account into lp:openobject-italia/7.0.

Requested reviews:
  OpenERP Italia core devs (openobject-italia-core-devs)

For more details, see:
https://code.launchpad.net/~icsergio/openobject-italia/adding_l10n_it_account/+merge/142410
-- 
https://code.launchpad.net/~icsergio/openobject-italia/adding_l10n_it_account/+merge/142410
Your team OpenERP Italia core devs is requested to review the proposed merge of lp:~icsergio/openobject-italia/adding_l10n_it_account into lp:openobject-italia/7.0.
=== added directory 'l10n_it_account'
=== added file 'l10n_it_account/AUTHORS.txt'
--- l10n_it_account/AUTHORS.txt	1970-01-01 00:00:00 +0000
+++ l10n_it_account/AUTHORS.txt	2013-01-08 21:57:20 +0000
@@ -0,0 +1,9 @@
+Davide Corio <davide.corio@xxxxxxxxxxxx>
+Luca Subiaco <subluca@xxxxxxxxx>
+Simone Orsi <simone.orsi@xxxxxxxxxxxx>
+Mario Riva <mario.riva@xxxxxxxxxxxx>
+Mauro Soligo <mauro.soligo@xxxxxxxxxx>
+Giovanni Barzan <giovanni.barzan@xxxxxxxxx>
+Lorenzo Battistini <lorenzo.battistini@xxxxxxxxxxx>
+Roberto Onnis <onnis.roberto@xxxxxxxxx>
+

=== added file 'l10n_it_account/__init__.py'
--- l10n_it_account/__init__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_account/__init__.py	2013-01-08 21:57:20 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2010 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import account
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'l10n_it_account/__openerp__.py'
--- l10n_it_account/__openerp__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_account/__openerp__.py	2013-01-08 21:57:20 +0000
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2010-2012 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    'name': 'Italian Localisation - Account',
+    'version': '0.1',
+    'category': 'Localisation/Italy',
+    'description': """This module customizes OpenERP in order to fit italian laws and mores - Account version
+
+Functionalities:
+
+- Fiscal code computation for partner
+- Check invoice date consistency
+
+""",
+    'author': 'OpenERP Italian Community',
+    'website': 'http://www.openerp-italia.org',
+    'license': 'AGPL-3',
+    "depends" : ['account','base_vat','account_chart','base_iban', 'l10n_it_base'],
+    "init_xml" : ['account/partner_view.xml'],
+    "update_xml" : [],
+    "demo_xml" : [],
+    "active": False,
+    "installable": True
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added directory 'l10n_it_account/account'
=== added file 'l10n_it_account/account/__init__.py'
--- l10n_it_account/account/__init__.py	1970-01-01 00:00:00 +0000
+++ l10n_it_account/account/__init__.py	2013-01-08 21:57:20 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2010 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import account
+import invoice

=== added file 'l10n_it_account/account/account.py'
--- l10n_it_account/account/account.py	1970-01-01 00:00:00 +0000
+++ l10n_it_account/account/account.py	2013-01-08 21:57:20 +0000
@@ -0,0 +1,136 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2010-2012 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields, osv
+import datetime
+
+class res_partner(osv.osv):
+    _inherit = 'res.partner'
+
+    def check_fiscalcode(self, cr, uid, ids, context={}):
+        
+        for partner in self.browse(cr, uid, ids):
+            if not partner.fiscalcode:
+                return True
+            if len(partner.fiscalcode) != 16:
+                return False
+
+        return True
+
+    _columns = {
+        'fiscalcode': fields.char('Fiscal Code', size=16, help="Italian Fiscal Code"),
+        'fiscalcode_surname': fields.char('Surname', size=64),
+        'fiscalcode_firstname': fields.char('First name', size=64),
+        'birth_date': fields.date('Date of birth'),
+        'birth_city': fields.many2one('res.city', 'City of birth'),
+        'sex': fields.selection([
+            ('M','Male'),
+            ('F', 'Female'),
+            ], "Sex"),
+    }
+    #_constraints = [(check_fiscalcode, "The fiscal code doesn't seem to be correct.", ["fiscalcode"])]
+
+     
+    def _codicefiscale(self, cognome, nome, giornonascita, mesenascita, annonascita,
+                      sesso, cittanascita):
+
+        MESI = 'ABCDEHLMPRST'
+        CONSONANTI = 'BCDFGHJKLMNPQRSTVWXYZ'
+        VOCALI = 'AEIOU'
+        LETTERE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+        REGOLECONTROLLO = {
+            'A':(0,1),   'B':(1,0),   'C':(2,5),   'D':(3,7),   'E':(4,9),
+            'F':(5,13),  'G':(6,15),  'H':(7,17),  'I':(8,19),  'J':(9,21),
+            'K':(10,2),  'L':(11,4),  'M':(12,18), 'N':(13,20), 'O':(14,11),
+            'P':(15,3),  'Q':(16,6),  'R':(17,8),  'S':(18,12), 'T':(19,14),
+            'U':(20,16), 'V':(21,10), 'W':(22,22), 'X':(23,25), 'Y':(24,24),
+            'Z':(25,23),
+            '0':(0,1),   '1':(1,0),   '2':(2,5),   '3':(3,7),   '4':(4,9),
+            '5':(5,13),  '6':(6,15),  '7':(7,17),  '8':(8,19),  '9':(9,21)
+                          }
+        ###
+        # Funzioni
+        ##
+         
+        def _surname(stringa):
+            """Ricava, da stringa, 3 lettere in base alla convenzione dei CF."""
+            cons = [c for c in stringa if c in CONSONANTI]
+            voc = [c for c in stringa if c in VOCALI]
+            chars=cons+voc
+            if len(chars)<3:
+                chars+=['X', 'X']
+            return chars[:3]
+         
+        def _name(stringa):
+            """Ricava, da stringa, 3 lettere in base alla convenzione dei CF."""
+            cons = [c for c in stringa if c in CONSONANTI]
+            voc = [c for c in stringa if c in VOCALI]
+            if len(cons)>3:
+                cons = [cons[0]] +[cons[2]] + [cons[3]]
+            chars=cons+voc
+            if len(chars)<3:
+                chars+=['X', 'X']
+            return chars[:3]
+         
+        def _datan(giorno, mese, anno, sesso):
+            """Restituisce il campo data del CF."""
+            chars = (list(anno[-2:]) + [MESI[int(mese)-1]])
+            gn=int(giorno)
+            if sesso=='F':
+                gn+=40
+            chars += list("%02d" % gn)
+            return chars
+         
+        def _codicecontrollo(c):
+            """Restituisce il codice di controllo, l'ultimo carattere del CF."""
+            sommone = 0
+            for i, car in enumerate(c):
+                j = 1 - i % 2
+                sommone += REGOLECONTROLLO[car][j]
+            resto = sommone % 26
+            return [LETTERE[resto]]
+
+        """Restituisce il CF costruito sulla base degli argomenti."""
+        nome=nome.upper()
+        cognome=cognome.upper()
+        sesso=sesso.upper()
+        cittanascita = cittanascita.upper()
+        chars = (_surname(cognome) +
+                 _name(nome) +
+                 _datan(giornonascita, mesenascita, annonascita, sesso) +
+                 list(cittanascita))
+        chars += _codicecontrollo(chars)
+        return ''.join(chars)
+     
+    def compute_fiscal_code(self, cr, uid, ids, context):
+        partners = self.browse(cr, uid, ids, context)
+        for partner in partners:
+            if not partner.fiscalcode_surname or not partner.fiscalcode_firstname or not partner.birth_date or not partner.birth_city or not partner.sex:
+                raise osv.except_osv('Error', 'One or more fields are missing')
+            birth_date = datetime.datetime.strptime(partner.birth_date, "%Y-%m-%d")
+            CF = self._codicefiscale(partner.fiscalcode_surname, partner.fiscalcode_firstname, str(birth_date.day),
+                str(birth_date.month), str(birth_date.year), partner.sex,
+                partner.birth_city.cadaster_code)
+            self.write(cr, uid, partner.id, {'fiscalcode': CF})
+        return True
+    
+res_partner()

=== added file 'l10n_it_account/account/invoice.py'
--- l10n_it_account/account/invoice.py	1970-01-01 00:00:00 +0000
+++ l10n_it_account/account/invoice.py	2013-01-08 21:57:20 +0000
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2010 Associazione OpenERP Italia
+#    (<http://www.openerp-italia.org>). 
+#    All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import netsvc
+import pooler, tools
+
+from osv import fields, osv
+from tools.translate import _
+
+class account_invoice(osv.osv):
+    
+    _inherit = 'account.invoice'
+
+    def action_number(self, cr, uid, ids, context=None):
+        super(account_invoice, self).action_number(cr, uid, ids, context)
+        for obj_inv in self.browse(cr, uid, ids):
+            inv_type = obj_inv.type
+            if inv_type == 'in_invoice' or inv_type == 'in_refund':
+                return True
+            number = obj_inv.number
+            date_invoice = obj_inv.date_invoice
+            journal = obj_inv.journal_id.id
+            res = self.search(cr, uid, [('type','=',inv_type),('date_invoice','>',date_invoice), 
+                ('number', '<', number), ('journal_id','=',journal)])
+            if res:
+                raise osv.except_osv(_('Date Inconsistency'),
+                        _('Cannot create invoice! Post the invoice with a greater date'))
+        return True
+    
+account_invoice()
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'l10n_it_account/account/partner_view.xml'
--- l10n_it_account/account/partner_view.xml	1970-01-01 00:00:00 +0000
+++ l10n_it_account/account/partner_view.xml	2013-01-08 21:57:20 +0000
@@ -0,0 +1,27 @@
+<?xml version="1.0" ?>
+<openerp>
+	<data>
+
+        <record id="view_partner_form_fiscalcode_data" model="ir.ui.view">
+            <field name="name">res.partner.fiscalcode.data</field>
+            <field name="model">res.partner</field>
+            <field name="inherit_id" ref="base.view_partner_form"/>
+            <field name="arch" type="xml">
+                <page string="Internal Notes" position="after" >
+                    <page string="Fiscal Code" >
+                        <separator colspan="4"/>
+                        <field name="fiscalcode"/>
+                        <newline/>
+                        <separator string="Compute Fiscal Code" colspan="4"/>
+                        <field name="fiscalcode_surname"/>
+                        <field name="fiscalcode_firstname"/>
+                        <field name="birth_date"/>
+                        <field name="birth_city"/>
+                        <field name="sex"/>
+                        <button name="compute_fiscal_code" type="object" string="Compute"/>
+                    </page>
+                </page>
+            </field>
+    	</record>
+	</data>
+</openerp>

=== added directory 'l10n_it_account/i18n'
=== added file 'l10n_it_account/i18n/it.po'
--- l10n_it_account/i18n/it.po	1970-01-01 00:00:00 +0000
+++ l10n_it_account/i18n/it.po	2013-01-08 21:57:20 +0000
@@ -0,0 +1,123 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* l10n_it_account
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.2\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2011-05-05 16:45+0000\n"
+"PO-Revision-Date: 2011-05-05 16:45+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: l10n_it_account
+#: code:addons/l10n_it_account/account/invoice.py:45
+#, python-format
+msgid "Cannot create invoice! Post the invoice with a greater date"
+msgstr "Impossibile registrare la fattura in contabilità! Esistono fatture registrate con data successiva alla fattura corrente; inserisci una data superiore per il documento"
+
+#. module: l10n_it_account
+#: view:res.partner:0
+msgid "Compute"
+msgstr "Calcola"
+
+#. module: l10n_it_account
+#: model:ir.model,name:l10n_it_account.model_account_invoice
+msgid "Invoice"
+msgstr "Fattura"
+
+#. module: l10n_it_account
+#: field:res.partner,birth_date:0
+msgid "Date of birth"
+msgstr "Data di nascita"
+
+#. module: l10n_it_account
+#: view:res.partner:0
+msgid "Notes"
+msgstr "Note"
+
+#. module: l10n_it_account
+#: model:ir.module.module,description:l10n_it_account.module_meta_information
+msgid "This module customizes OpenERP in order to fit italian laws and mores - Account version\n"
+"\n"
+"Functionalities:\n"
+"\n"
+"- Fiscal code computation for partner\n"
+"- Check invoice date consistency\n"
+"\n"
+""
+msgstr "Questo modulo personalizza OpenERP al fine di rispettare le leggi e le usanze italiane - Versione contabilità\n"
+"Funzionalità:\n"
+"\n"
+"- Calcolo del codice fiscale sul partner\n"
+"- Controllo della consistenza delle date delle fatture\n"
+"\n"
+""
+
+#. module: l10n_it_account
+#: help:res.partner,fiscalcode:0
+msgid "Italian Fiscal Code"
+msgstr "Codice Fiscale Italiano"
+
+#. module: l10n_it_account
+#: field:res.partner,sex:0
+msgid "Sex"
+msgstr "Sesso"
+
+#. module: l10n_it_account
+#: field:res.partner,fiscalcode_surname:0
+msgid "Surname"
+msgstr "Cognome"
+
+#. module: l10n_it_account
+#: field:res.partner,fiscalcode_firstname:0
+msgid "First name"
+msgstr "Nome"
+
+#. module: l10n_it_account
+#: view:res.partner:0
+#: field:res.partner,fiscalcode:0
+msgid "Fiscal Code"
+msgstr "Codice fiscale"
+
+#. module: l10n_it_account
+#: model:ir.module.module,shortdesc:l10n_it_account.module_meta_information
+msgid "Italian Localisation - Account"
+msgstr "Localizzazione Italiana - Contabilità"
+
+#. module: l10n_it_account
+#: selection:res.partner,sex:0
+msgid "Female"
+msgstr "Femmina"
+
+#. module: l10n_it_account
+#: model:ir.model,name:l10n_it_account.model_res_partner
+msgid "Partner"
+msgstr "Partner"
+
+#. module: l10n_it_account
+#: view:res.partner:0
+msgid "Compute Fiscal Code"
+msgstr "Calcola codice fiscale"
+
+#. module: l10n_it_account
+#: selection:res.partner,sex:0
+msgid "Male"
+msgstr "Maschio"
+
+#. module: l10n_it_account
+#: code:addons/l10n_it_account/account/invoice.py:44
+#, python-format
+msgid "Date Inconsistency"
+msgstr "Inconsistenza nelle date"
+
+#. module: l10n_it_account
+#: field:res.partner,birth_city:0
+msgid "City of birth"
+msgstr "Città natale"
+

=== added file 'l10n_it_account/i18n/l10n_it_account.pot'
--- l10n_it_account/i18n/l10n_it_account.pot	1970-01-01 00:00:00 +0000
+++ l10n_it_account/i18n/l10n_it_account.pot	2013-01-08 21:57:20 +0000
@@ -0,0 +1,117 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* l10n_it_account
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.2\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2011-05-05 16:44+0000\n"
+"PO-Revision-Date: 2011-05-05 16:44+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: l10n_it_account
+#: code:addons/l10n_it_account/account/invoice.py:45
+#, python-format
+msgid "Cannot create invoice! Post the invoice with a greater date"
+msgstr ""
+
+#. module: l10n_it_account
+#: view:res.partner:0
+msgid "Compute"
+msgstr ""
+
+#. module: l10n_it_account
+#: model:ir.model,name:l10n_it_account.model_account_invoice
+msgid "Invoice"
+msgstr ""
+
+#. module: l10n_it_account
+#: field:res.partner,birth_date:0
+msgid "Date of birth"
+msgstr ""
+
+#. module: l10n_it_account
+#: view:res.partner:0
+msgid "Notes"
+msgstr ""
+
+#. module: l10n_it_account
+#: model:ir.module.module,description:l10n_it_account.module_meta_information
+msgid "This module customizes OpenERP in order to fit italian laws and mores - Account version\n"
+"\n"
+"Functionalities:\n"
+"\n"
+"- Fiscal code computation for partner\n"
+"- Check invoice date consistency\n"
+"\n"
+""
+msgstr ""
+
+#. module: l10n_it_account
+#: help:res.partner,fiscalcode:0
+msgid "Italian Fiscal Code"
+msgstr ""
+
+#. module: l10n_it_account
+#: field:res.partner,sex:0
+msgid "Sex"
+msgstr ""
+
+#. module: l10n_it_account
+#: field:res.partner,fiscalcode_surname:0
+msgid "Surname"
+msgstr ""
+
+#. module: l10n_it_account
+#: field:res.partner,fiscalcode_firstname:0
+msgid "First name"
+msgstr ""
+
+#. module: l10n_it_account
+#: view:res.partner:0
+#: field:res.partner,fiscalcode:0
+msgid "Fiscal Code"
+msgstr ""
+
+#. module: l10n_it_account
+#: model:ir.module.module,shortdesc:l10n_it_account.module_meta_information
+msgid "Italian Localisation - Account"
+msgstr ""
+
+#. module: l10n_it_account
+#: selection:res.partner,sex:0
+msgid "Female"
+msgstr ""
+
+#. module: l10n_it_account
+#: model:ir.model,name:l10n_it_account.model_res_partner
+msgid "Partner"
+msgstr ""
+
+#. module: l10n_it_account
+#: view:res.partner:0
+msgid "Compute Fiscal Code"
+msgstr ""
+
+#. module: l10n_it_account
+#: selection:res.partner,sex:0
+msgid "Male"
+msgstr ""
+
+#. module: l10n_it_account
+#: code:addons/l10n_it_account/account/invoice.py:44
+#, python-format
+msgid "Date Inconsistency"
+msgstr ""
+
+#. module: l10n_it_account
+#: field:res.partner,birth_city:0
+msgid "City of birth"
+msgstr ""
+


Follow ups