1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# Copyright (C) 2011 Associazione OpenERP Italia
5
# (<http://www.openerp-italia.org>).
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.
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.
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/>.
21
##############################################################################
23
from osv import fields, osv
25
class corrispettivi_config_data(osv.osv_memory):
26
_name = 'corrispettivi.config.data'
27
_inherit = 'res.config'
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),
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',
43
'prefix': 'COJ/%(year)s/',
45
journal_id = self.pool.get('account.journal').create(cr, uid, {
46
'view_id': o.journal_view_id.id,
48
'name': 'Corrispettivi Journal',
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,
55
partner_id = self.pool.get('res.partner').create(cr, uid, {
56
'name': 'Corrispettivi',
60
'corrispettivi': True,
62
address_id = self.pool.get('res.partner.address').create(cr, uid, {
63
'name': 'Corrispettivi',
64
'partner_id': partner_id,
67
corrispettivi_config_data()