1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# Copyright (C) 2011 Associazione OpenERP Italia
5
# (<http://www.openerp-italia.org>).
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.
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.
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/>.
20
##############################################################################
22
from osv import fields, osv
24
class corrispettivi_config_data(osv.osv_memory):
25
_name = 'corrispettivi.config.data'
26
_inherit = 'res.config'
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'),
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',
40
'prefix': 'COJ/%(year)s/',
42
journal_id = self.pool.get('account.journal').create(cr, uid, {
44
'name': 'Sezionale Corrispettivi',
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,
51
partner_id = self.pool.get('res.partner').create(cr, uid, {
52
'name': 'Corrispettivi',
56
'corrispettivi': True,
59
corrispettivi_config_data()