Ok, i tested add_relationship_filter instead add_relationship_filters
and it seems to work fine, but it uses ID's
'SELECT "aquariki"."public"."asset".* FROM "aquariki"."public"."asset" WHERE ("asset"."s_status" != \'retired\' or "asset"."s_status" is NULL) AND "asset"."id" = 7 ORDER BY "asset"."name"'
And if i do something like this:
search.add_relationship_filters(eval_sobjects, op=op, path='parent')
it also works no matter what path i pass here, child or parent:
'SELECT "aquariki"."public"."asset".* FROM "aquariki"."public"."asset" WHERE ("asset"."s_status" != \'retired\' or "asset"."s_status" is NULL) AND "asset"."code" in (\'ASSET00002\', \'ASSET00003\', \'ASSET00007\') ORDER BY "asset"."name"'
Code from add_relationship_filters of search.py:
attrs = schema.get_relationship_attrs(search_type, related_type, path=path, type=type)
When i not set path explicitly attrs ==:
{'from': 'tvs/asset', 'to': 'tvs/asset', 'instance_type': 'tvs/asset_in_asset', 'relationship': 'instance', 'from_col': 'code', 'to_col': 'code'}
When i not set path explicitly to 'child' attrs ==:
{'from': 'tvs/asset_in_asset', 'to': 'tvs/asset', 'relationship': 'code', 'from_col': 'child_asset_code', 'to_col': 'code', 'path': 'parent', 'type': 'many_to_many'}
and it seems to work fine, but it uses ID's
'SELECT "aquariki"."public"."asset".* FROM "aquariki"."public"."asset" WHERE ("asset"."s_status" != \'retired\' or "asset"."s_status" is NULL) AND "asset"."id" = 7 ORDER BY "asset"."name"'
And if i do something like this:
search.add_relationship_filters(eval_sobjects, op=op, path='parent')
it also works no matter what path i pass here, child or parent:
'SELECT "aquariki"."public"."asset".* FROM "aquariki"."public"."asset" WHERE ("asset"."s_status" != \'retired\' or "asset"."s_status" is NULL) AND "asset"."code" in (\'ASSET00002\', \'ASSET00003\', \'ASSET00007\') ORDER BY "asset"."name"'
Code from add_relationship_filters of search.py:
attrs = schema.get_relationship_attrs(search_type, related_type, path=path, type=type)
When i not set path explicitly attrs ==:
{'from': 'tvs/asset', 'to': 'tvs/asset', 'instance_type': 'tvs/asset_in_asset', 'relationship': 'instance', 'from_col': 'code', 'to_col': 'code'}
When i not set path explicitly to 'child' attrs ==:
{'from': 'tvs/asset_in_asset', 'to': 'tvs/asset', 'relationship': 'code', 'from_col': 'child_asset_code', 'to_col': 'code', 'path': 'parent', 'type': 'many_to_many'}