Domain : using child_of with dynamic ids

Hi everyone,

I’m trying to create a domain to restrict the parties to those with the category “CLIENTS”.
I wanted to use child_of, but I can’t find a way to retrieve dynamically the id :

            ('', '=', 'CLIENTS'),
            ('categories', 'child_of', ID, 'parent'),

It works if I set the value of ID in the source code but I want to retrieve it dynamically.
ID is like :

 [('name', '=', 'CLIENTS', 'party.category')]

Is there a way to do something like :

            ('', '=', 'CLIENTS'),
            ('categories', 'child_of', [('name', '=', 'CLIENTS', 'party.category')][0].id, 'parent'),


I guess you are talking about a specific category. So in this case I guess you have created the category by XML declaration. So you can use the pyson.Id to get the database id of the XML record.

Thank you @ced
The category “CLIENTS” is created with proteus when I import all the datas from the previous “ERP” (excel files).

Ok so I could create the cat like you say via xml then do the import, It makes sens
Thanks !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.