On 07/11/2011 04:26 PM, Leonardo Pistone - Agile BG - Domsense wrote:
> The only way that I found to be able to switch companies is to set
> the res.company rule [('id','in',[x.id for x in user.company_ids])].
>
> Am I missing something?
How are you switching companies? The user preferences panel has a
special system to display the list of user.company_ids, regardless of
the security rules, for this very purpose.
I just checked on a 6.0 system (latest server and addons versions) and I
can switch between companies with any user (who belongs to multi
companies group), even if I set the res.company rule to something that
does not match any company. And this works also if the companies I
belong to are not related (no ancestor/descendant relationship between
them).
Technically, this works because res.company has an overridden _search()
method that checks the context for a special key, and that special key
is passed by the res_users.company_id field, so it is used when loading
the selectable companies in the user preferences.
If this doesn't work for you, can you investigate and perhaps report a
bug if you find that it is reproducible with official addons?
--
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-10420-ira/+merge/66546
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-server/6.0-opw-10420-ira.
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp