1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
6
# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
8
# WARNING: This program as such is intended to be used by professional
9
# programmers who take the whole responsability of assessing all potential
10
# consequences resulting from its eventual inadequacies and bugs
11
# End users who are looking for a ready-to-use solution with commercial
12
# garantees and support are strongly adviced to contract a Free Software
15
# This program is Free Software; you can redistribute it and/or
16
# modify it under the terms of the GNU General Public License
17
# as published by the Free Software Foundation; either version 2
18
# of the License, or (at your option) any later version.
20
# This program is distributed in the hope that it will be useful,
21
# but WITHOUT ANY WARRANTY; without even the implied warranty of
22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
# GNU General Public License for more details.
25
# You should have received a copy of the GNU General Public License
26
# along with this program; if not, write to the Free Software
27
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29
##############################################################################
31
from osv import fields, osv
33
class res_company(osv.osv):
34
_inherit = 'res.company'
37
'certificate': fields.char('Certificate', size=256, help='Wrigth the compleat path of the .Key file'),
38
'nocertificado': fields.char('Numero de Certificado', size=20,),
39
#'key': fields.many2one('ir.attachment','Key', required=True, help='Attach your Key .key to the company as an Attachment,/n and then select it here'),
40
'key':fields.char('Key', size=256, help='Wrigth the compleat path of the .Key file'),
41
'key_phrase': fields.char('Key Phrase', invisible=True, size=32, required=True),
42
'folio_ids': fields.one2many('res.company.folios', 'company_id', 'Folios'),
49
class res_company_folios(osv.osv):
50
_name = "res.company.folios"
51
_description = "Folios autorizados a la compania"
53
_rec_name = 'folio_from'
56
'serie': fields.char('Serie', size=5,),
57
'folio_from': fields.integer('Folio From', required=True),
58
'folio_to': fields.integer('Folio To', required=True),
59
'approved_year': fields.integer('Approved Year',required=True),
60
'approved_number': fields.char('Approved Number', size=32, required=True),
61
'company_id': fields.many2one('res.company', 'Company', required=True, select=True),
68
def get_folio_info(self, cr, uid, company_id, folio, field, serie=''):
70
serie = " and serie='%s'"%(serie)
71
query = "SELECT %s from res_company_folios where %s <= folio_to and %s >= folio_from and company_id=%s %s"%(field, folio, folio, company_id, serie)
77
raise osv.except_osv(('Error !'), ('No se encontro un folio valido!.'))