~vauxoo/openerp-mexico-localization/l10n_mx_facturae_ir_approval_sequence_dev_carlos

« back to all changes in this revision

Viewing changes to l10n_mx_company_cif/wizard/installer.py

  • Committer: moylop260
  • Date: 2012-09-09 23:47:31 UTC
  • mfrom: (181.2.17 addons-mx-trunk)
  • Revision ID: moylop260@vauxoo.com-20120909234731-1tp1zww18ydo4r0r
[MERGE] Merge from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
 
2
###########################################################################
 
3
#    Module Writen to OpenERP, Open Source Management Solution
 
4
#
 
5
#    Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
 
6
#    All Rights Reserved.
 
7
#    info Vauxoo (info@vauxoo.com)
 
8
############################################################################
 
9
#    Coded by: Luis Torres (luis_t@vauxoo.com)
 
10
############################################################################
 
11
#
 
12
#    This program is free software: you can redistribute it and/or modify
 
13
#    it under the terms of the GNU Affero General Public License as
 
14
#    published by the Free Software Foundation, either version 3 of the
 
15
#    License, or (at your option) any later version.
 
16
#
 
17
#    This program is distributed in the hope that it will be useful,
 
18
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
#    GNU Affero General Public License for more details.
 
21
#
 
22
#    You should have received a copy of the GNU Affero General Public License
 
23
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
24
#
 
25
##############################################################################
 
26
from osv import osv
 
27
from osv import fields
 
28
 
 
29
class cif_config(osv.osv_memory):
 
30
    _name = 'cif.config'
 
31
    _inherit = 'res.config'
 
32
        
 
33
    def _write_company(self, cr, uid, cif_file,company_id,context=None):
 
34
        self.pool.get('res.company').write(cr, uid, company_id,{
 
35
            'cif_file': cif_file,
 
36
            },context=context)
 
37
            
 
38
    def execute(self, cr, uid, ids, context=None):
 
39
        company_id=self.pool.get('res.users').browse(cr,uid,[uid],context)[0].company_id.partner_id.id
 
40
        wiz_data = self.read(cr, uid, ids[0])
 
41
        if wiz_data['cif_file']:
 
42
            self._write_company(cr, uid, wiz_data["cif_file"],company_id,context)
 
43
            
 
44
    _columns={
 
45
        'cif_file': fields.binary('CIF',help="Fiscal Identification Card"),
 
46
    }
 
47
 
 
48
cif_config()