~scigghia/openobject-italia/6.1-new-riba-report

« back to all changes in this revision

Viewing changes to l10n_it_abicab/abicab.py

  • Committer: Lorenzo Battistini
  • Date: 2012-10-22 09:31:25 UTC
  • mfrom: (203.1.7 add_abi_cab)
  • Revision ID: lorenzo.battistini@agilebg.com-20121022093125-zymz6tvu7oz2p9tr
[Add] Abi/Cab code
[Add] New fiscal Code Management
[Add] l10n_it_withholding_tax it translation

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    OpenERP, Open Source Management Solution
 
5
#    Copyright (C) 2012
 
6
#    Associazione OpenERP Italia (<http://www.openerp-italia.org>)
 
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
 
10
#    published by the Free Software Foundation, either version 3 of the
 
11
#    License, or (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 Affero 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 res_bank(osv.osv):
 
26
    _inherit = "res.bank"
 
27
    _columns = {
 
28
        'abi': fields.char('ABI', size=5),
 
29
        'cab': fields.char('CAB', size=5),
 
30
    }
 
31
 
 
32
class res_partner_bank(osv.osv):
 
33
    _inherit = "res.partner.bank"
 
34
    _columns = {
 
35
        'bank_abi': fields.char('ABI', size=5),
 
36
        'bank_cab': fields.char('CAB', size=5),
 
37
    }
 
38
 
 
39
    def onchange_bank_id(self, cr, uid, ids, bank_id, context=None):
 
40
        result = super(res_partner_bank, self).onchange_bank_id(cr, uid, ids, bank_id, context=context)
 
41
        if bank_id:
 
42
            bank = self.pool.get('res.bank').browse(cr, uid, bank_id, context=context)
 
43
            result['value']['bank_abi'] = bank.abi
 
44
            result['value']['bank_cab'] = bank.cab
 
45
        return result
 
46