~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to msf_instance/msf_instance_installer.py

  • Committer: jf
  • Date: 2011-05-16 09:55:17 UTC
  • mfrom: (129.1.1 unifield-wm)
  • Revision ID: jf@tempo4-20110516095517-giuzv2mouka39jb8
UF-270 Advance return in a currency that is not the functional currency

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
 
3
 
from osv import fields, osv
4
 
import tools
5
 
from os.path import join as opj
6
 
from tools.translate import _
7
 
 
8
 
 
9
 
class msf_instance_setup(osv.osv_memory):
10
 
    _name = 'msf_instance.setup'
11
 
    _inherit = 'res.config'
12
 
 
13
 
    _columns = {
14
 
         'instance_id': fields.many2one('msf.instance', string="Proprietary instance", required=True),
15
 
    }
16
 
 
17
 
    def get_instance(self, cr, uid, context=None):
18
 
        instance_ids = self.pool.get('msf.instance').search(cr, uid, [], limit=1)
19
 
        return instance_ids and instance_ids[0] or False
20
 
 
21
 
    _defaults = {
22
 
        'instance_id': get_instance,
23
 
    }
24
 
 
25
 
    def execute(self, cr, uid, ids, context=None):
26
 
        res = self.read(cr, uid, ids)
27
 
        self.pool.get('res.company').write(cr, uid, [self.pool.get('res.users').browse(cr, uid, uid).company_id.id], {'instance_id': res[0]['instance_id']})
28
 
        return {}
29
 
 
30
 
msf_instance_setup()