1 # -*- encoding: utf-8 -*-
2 #################################################################################
4 # Copyright (C) 2009 Renato Lima - Akretion #
6 #This program is free software: you can redistribute it and/or modify #
7 #it under the terms of the GNU Affero General Public License as published by #
8 #the Free Software Foundation, either version 3 of the License, or #
9 #(at your option) any later version. #
11 #This program is distributed in the hope that it will be useful, #
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 #GNU General Public License for more details. #
16 #You should have received a copy of the GNU General Public License #
17 #along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 #################################################################################
20 from osv import fields, osv
22 class l10n_br_account_cst_template(osv.osv):
23 _name = 'l10n_br_account.cst.template'
24 _description = 'Tax Situation Code Template'
26 'code': fields.char('Code', size=8,required=True),
27 'name': fields.char('Description', size=64),
28 'tax_code_template_id': fields.many2one('account.tax.code.template', 'Tax Code Template',required=True),
31 def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
36 ids = self.search(cr, user, ['|',('name',operator,name),('code',operator,name)] + args, limit=limit, context=context)
37 return self.name_get(cr, user, ids, context)
39 def name_get(self, cr, uid, ids, context=None):
42 reads = self.read(cr, uid, ids, ['name', 'code'], context=context)
47 name = record['code'] + ' - '+name
48 res.append((record['id'], name))
51 l10n_br_account_cst_template()
53 class l10n_br_account_cst(osv.osv):
54 _name = 'l10n_br_account.cst'
55 _description = 'Tax Situation Code'
57 'code': fields.char('Code', size=8,required=True),
58 'name': fields.char('Description', size=64),
59 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code',required=True),
62 def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
67 ids = self.search(cr, user, ['|',('name',operator,name),('code',operator,name)] + args, limit=limit, context=context)
68 return self.name_get(cr, user, ids, context)
70 def name_get(self, cr, uid, ids, context=None):
73 reads = self.read(cr, uid, ids, ['name', 'code'], context=context)
78 name = record['code'] + ' - '+name
79 res.append((record['id'], name))
84 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: