~openerp-commiter/openobject-addons/extra-6.0

« back to all changes in this revision

Viewing changes to account_fiscal_position_name/account_tax.py

  • Committer: Sebastien LANGE
  • Date: 2011-04-03 08:56:39 UTC
  • mto: (5345.10.2 addons-extra)
  • mto: This revision was merged to the branch mainline in revision 5355.
  • Revision ID: sebastien.lange@syleam.fr-20110403085639-4hft13osx6t9cvgv
[ADD] account_fiscal_position_name : migrate to version 6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    account_fiscal_position_name module for OpenERP, Show name instead of description
 
5
#    Copyright (C) 2011 SYLEAM Info Services (<http://www.Syleam.fr/>) 
 
6
#              Sebastien LANGE <sebastien.lange@syleam.fr>
 
7
#
 
8
#    This file is a part of account_fiscal_position_name
 
9
#
 
10
#    account_fiscal_position_name is free software: you can redistribute it and/or modify
 
11
#    it under the terms of the GNU General Public License as published by
 
12
#    the Free Software Foundation, either version 3 of the License, or
 
13
#    (at your option) any later version.
 
14
#
 
15
#    account_fiscal_position_name is distributed in the hope that it will be useful,
 
16
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
#    GNU Affero General Public License for more details.
 
19
#
 
20
#    You should have received a copy of the GNU Affero General Public License
 
21
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
22
#
 
23
##############################################################################
 
24
 
 
25
from osv import osv
 
26
 
 
27
class account_tax(osv.osv):
 
28
    _inherit = 'account.tax'
 
29
 
 
30
    def name_get(self, cr, uid, ids, context=None):
 
31
        """ Get name of account_tax"""
 
32
        if not context:
 
33
            context = {}
 
34
        if not len(ids):
 
35
            return []
 
36
        res = []
 
37
        for record in self.read(cr, uid, ids, ['description','name'], context):
 
38
            name = record['name'] or record['description']
 
39
            res.append((record['id'],name ))
 
40
        return res
 
41
 
 
42
account_tax()
 
43
 
 
44
class account_tax_template(osv.osv):
 
45
    _inherit = 'account.tax.template'
 
46
 
 
47
    def name_get(self, cr, uid, ids, context=None):
 
48
        """ Get name of account_tax_template"""
 
49
        if not context:
 
50
            context = {}
 
51
        if not len(ids):
 
52
            return []
 
53
        res = []
 
54
        for record in self.read(cr, uid, ids, ['description','name'], context):
 
55
            name = record['name'] or record['description']
 
56
            res.append((record['id'],name ))
 
57
        return res
 
58
 
 
59
account_tax_template()
 
60
 
 
61
 
 
62
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: