~openobject-italia-core-devs/openobject-italia/italian-addons

« back to all changes in this revision

Viewing changes to l10n_it_corrispettivi/installer.py

  • Committer: Lorenzo Battistini
  • Date: 2012-10-27 10:55:31 UTC
  • Revision ID: lorenzo.battistini@agilebg.com-20121027105531-yot0td346m5f5zya
[DEL] every module, as they are developed for 6.1.
As soon as we port a module to 7.0, before 7.0 was released,
we'll put it here

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