On Sunday, October 9, 2016 at 3:00:04 PM UTC+8, Ryan wrote:
>
> Thanks Sir Sergi. 
>
> I'll try it later and update this trend asap.
>
> sorry... but I got blank result on this: please see code below. any help 
please...
    
z_group = fields.Char('Default Group')


@staticmethod
def default_zgroup():
      pool = Pool() 
      User = pool.get('res.user') 
      user = User(Transaction().context['user']) 
      return user.groups 
 

> Best Regards...
> //elite
>
> On Saturday, October 8, 2016 at 9:43:20 PM UTC+8, Sergi Almacellas 
> Abellana wrote:
>>
>> El 08/10/16 a les 12:07, Ryan ha escrit: 
>> > Thanks Sir Cedric, 
>> > 
>> > Just a newbie here, just a month ago... 
>> > 
>> > Can you please show me the code for creating a query to check the 
>> user's 
>> > id to get his group. 
>> > does the user group can be found on 'res_group'? or res_user-res_group? 
>> You have to browse the user with the id from the context of transaction 
>> user and then read it's group properties. Something like (sorry but 
>> writting from memory): 
>>
>> pool = Pool() 
>> User = pool.get('res.user') 
>> user = User(Transaction().context['user'] 
>> user.groups  # This is a tuple of res.group instances for each group of 
>> the user. 
>>
>> Hope it helps. 
>>
>> -- 
>> Sergi Almacellas Abellana 
>> www.koolpi.com 
>> Twitter: @pokoli_srk 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/6f300917-b893-4fa5-bdaf-a785e41076f1%40googlegroups.com.

Reply via email to