HybirdCorp / creme_crm

Creme is a highly configurable free/open-source Customer Relationship Management designed with an entities/relationships architecture.
Other
54 stars 25 forks source link

EntityFilter issue with M2M fields #513

Open hsmett opened 1 year ago

hsmett commented 1 year ago

When creating an EntityFilter for with two conditions targeting the same M2M field, the resulting listview items are incorrect. For exemple, given

    Class Stuff(CremeEntity):
        things = models.ManyToManyField(Thing ...)

The stuff resulting from a filter with conditions (things = a_thing) & (things != another_thing) would be wrong.

genglert commented 1 year ago

There's a workaround: move one of the conditions in a sub-filter. Edit: a condition '!=' + a sub-filter with the condition '=' (order is important).