1
# -*- coding: utf-8 -*-
3
from osv import fields, osv
5
from os.path import join as opj
6
from tools.translate import _
9
class msf_instance_setup(osv.osv_memory):
10
_name = 'msf_instance.setup'
11
_inherit = 'res.config'
14
'instance_id': fields.many2one('msf.instance', string="Proprietary instance", required=True),
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
22
'instance_id': get_instance,
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']})