This question has been flagged
2 Replies
5195 Views

Hello all,


is it posible to add a filter which groups me the Tags? (in reports)

By adding it to the group by or other filters?

If I try it like this way in "Edit Search view" it won't work:

<filter string="Tags" context="{'group_by':'tag_ids'}"/>.


Would be glad if some1 could help me.

Thanks and br,

Joe

Avatar
Discard
Best Answer

Hi,

tags is of the many2many type: it is impossible to group by m2m fields (otherwise the same record might be shown twice on the same view, what is not a case in Odoo).

What can be done:

  1. You can prepare a report (qweb, e.g.) which would prepare that feature

  2. If possible, to compute some many2one field. E.g. 'Main tag' and group by it

  3. Just use simple search by tag without groupings

UPDATE

For the point 3 there are 2 options:

  1. Simple search by tag: <field name="tag_ids" filter_domain="[('tag_ids', 'ilike', self)]" string="Tags"/>. You should type your tag in a searchbar

  2. Filter by a definite tag. <filter name="mytag" string="My Tag" domain="[('tag_ids', 'ilike', 'mytag')]" />. In that case you can just click on a filter, but you need to define fileters for each tag

Avatar
Discard
Author Best Answer

thank you for the response
about the third opportunity by using just a simple search without groupings
how does the filter look like? just like that:?

<filter string="Tags" context="{'tag_ids'}"/>.

Avatar
Discard

Hi, please look at the update in the initial answer