[FIX] ir_property: fixes in property fields related to multi company use cases

bzr revid: qdp-launchpad@openerp.com-20130624085731-fthhdpdm4ldi3220
This commit is contained in:
Quentin (OpenERP) 2013-06-24 10:57:31 +02:00
parent c54bc51eb7
commit bcac5bd834
2 changed files with 6 additions and 3 deletions

View File

@ -147,7 +147,8 @@ class ir_property(osv.osv):
domain = self._get_domain(cr, uid, name, model, context=context)
if domain is not None:
domain = [('res_id', '=', res_id)] + domain
nid = self.search(cr, uid, domain, context=context)
#make the search with company_id asc to make sure that properties specific to a company are given first
nid = self.search(cr, uid, domain, limit=1, order='company_id asc', context=context)
if not nid: return False
record = self.browse(cr, uid, nid[0], context=context)
return self.get_by_record(cr, uid, record, context=context)

View File

@ -1382,8 +1382,10 @@ class property(function):
def _get_by_id(self, obj, cr, uid, prop_name, ids, context=None):
prop = obj.pool.get('ir.property')
vids = [obj._name + ',' + str(oid) for oid in ids]
domain = [('fields_id.model', '=', obj._name), ('fields_id.name', 'in', prop_name)]
def_id = self._field_get(cr, uid, obj._name, prop_name[0])
company = obj.pool.get('res.company')
cid = company._company_default_get(cr, uid, obj._name, def_id, context=context)
domain = [('fields_id.model', '=', obj._name), ('fields_id.name', 'in', prop_name), ('company_id', '=', cid)]
#domain = prop._get_domain(cr, uid, prop_name, obj._name, context)
if vids:
domain = [('res_id', 'in', vids)] + domain