bzr revid: fp@tinyerp.com-20091223171819-hcmfjuvk2z5m34ag
This commit is contained in:
Fabien Pinckaers 2009-12-23 18:18:19 +01:00
parent c032072ca1
commit ecc123464c
4 changed files with 8 additions and 5 deletions

View File

@ -57,7 +57,7 @@ class ir_sequence(osv.osv):
'number_next': lambda *a: 1,
'padding' : lambda *a : 0,
'weight' : lambda *a: 10,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'ir.sequence', c)
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'ir.sequence', context=c)
}
def _process(self, s):

View File

@ -163,7 +163,7 @@ class res_partner(osv.osv):
'active': lambda *a: 1,
'customer': lambda *a: 1,
'category_id': _default_category,
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'res.partner', c),
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'res.partner', context=c),
}
def copy(self, cr, uid, id, default={}, context={}):
name = self.read(cr, uid, [id], ['name'])[0]['name']

View File

@ -95,7 +95,6 @@ class res_company(osv.osv):
"""
if not context:
context = {}
user_company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
proxy = self.pool.get('multi_company.default')
args = [
('object_id.model', '=', object),
@ -104,11 +103,15 @@ class res_company(osv.osv):
args.append(('field_id.name','=',field))
else:
args.append(('field_id','=',False))
ids = proxy.search(cr, uid, args)
print args
ids = proxy.search(cr, uid, args, context=context)
for rule in proxy.browse(cr, uid, ids, context):
user = self.pool.get('res.users').browse(cr, uid, uid)
if eval(rule.expression, {'context': context, 'user': user}):
print 'found', object
return rule.company_dest_id.id
user_company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
print 'not found', object
return user_company_id
def _get_child_ids(self, cr, uid, uid2, context={}):

View File

@ -63,7 +63,7 @@ class res_currency(osv.osv):
}
_defaults = {
'active': lambda *a: 1,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'res.currency', c)
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'res.currency', context=c)
}
_order = "code"