~nicolariolini/openobject-italia/save_fiscalcode_data

« back to all changes in this revision

Viewing changes to l10n_it_corrispettivi/installer.py

  • Committer: Davide Corio
  • Date: 2013-02-18 19:41:51 UTC
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: davide.corio@agilebg.com-20130218194151-ej8hs1vjj50ifuls
[ADD] l10n_it_corrispettivi

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
 
2
##############################################################################
 
3
#    
 
4
#    Copyright (C) 2011 Associazione OpenERP Italia
 
5
#    (<http://www.openerp-italia.org>). 
 
6
#
 
7
#    This program is free software: you can redistribute it and/or modify
 
8
#    it under the terms of the GNU Affero General Public License as published
 
9
#    by the Free Software Foundation, either version 3 of the License, or
 
10
#    (at your option) any later version.
 
11
#
 
12
#    This program is distributed in the hope that it will be useful,
 
13
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#    GNU General Public License for more details.
 
16
#
 
17
#    You should have received a copy of the GNU Affero General Public License
 
18
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
#
 
20
##############################################################################
 
21
 
 
22
from osv import fields, osv
 
23
 
 
24
class corrispettivi_config_data(osv.osv_memory):
 
25
    _name = 'corrispettivi.config.data'
 
26
    _inherit = 'res.config'
 
27
 
 
28
    _columns = {
 
29
        'default_credit_account_id': fields.many2one('account.account', 'Default credit account',
 
30
            domain=[('type','!=','view')], required=True, help='If doubtful, use income account'),
 
31
        'default_debit_account_id': fields.many2one('account.account', 'Default debit account',
 
32
            domain=[('type','!=','view')], required=True, help='If doubtful, use income account'),
 
33
        }
 
34
 
 
35
    def execute(self, cr, uid, ids, context=None):
 
36
        for o in self.browse(cr, uid, ids, context=context):
 
37
            seq_id = self.pool.get('ir.sequence').create(cr, uid, {
 
38
                'name': 'Sezionale Corrispettivi',
 
39
                'padding': 3,
 
40
                'prefix': 'COJ/%(year)s/',
 
41
                })
 
42
            journal_id = self.pool.get('account.journal').create(cr, uid, {
 
43
                'code': 'COJ',
 
44
                'name': 'Sezionale Corrispettivi',
 
45
                'type': 'sale',
 
46
                'corrispettivi': True,
 
47
                'sequence_id': seq_id,
 
48
                'default_credit_account_id': o.default_credit_account_id.id,
 
49
                'default_debit_account_id': o.default_debit_account_id.id,
 
50
                })
 
51
            partner_id = self.pool.get('res.partner').create(cr, uid, {
 
52
                'name': 'Corrispettivi',
 
53
                'ref': 'COJ',
 
54
                'customer': False,
 
55
                'supplier': False,
 
56
                'corrispettivi': True,
 
57
                })
 
58
 
 
59
corrispettivi_config_data()
 
60