Community mailing list archives

community@mail.odoo.com

Re: track_visibility of many2many - get names not ids

by
Maxim Litnitskiy
- 11/05/2014 10:46:06
Trying to find a work around.
Added related field to many2many column like this:

organization = fields.Many2many('custom_contacts.organization', string=_('Organization'))
organization_names = fields.Char(string=_('Organizations'), select=1,
        track_visibility='onchange', compute='_get_organization_names', store=True)

    @api.one
    @api.depends('organization')
    def _get_organization_names(self):
        if self.organization:
            self.organization_names = ', '.join([k.name for k in self.organization])


This makes it possible to group_by many2many field.
But  track_visibility does not work at all.
I event added 

<field name='organization' widget='many2many_tags'/>
                            <field name='organization_names' invisible='0'/>

2014-11-03 21:02 GMT+04:00 Maxim Litnitskiy <litnimaxster@gmail.com>:
Hi all!
I have the following piese of code - https://gist.github.com/litnimax/b3f9085b5287a34e80d1
When  I change group I get on the chatter:
 • Group: custom_contacts.group(4, 5) → custom_contacts.group(4,)

Is there a way to show group names?
Thanks.