Dynamic form depending of values in a one2many

I'll try to be as clear as possible, don't hesitate to ask for more information. The following example as no purpose in itself.

So you have `product` which can have a `category`. `category` is a table and there can be more or less records in it.

You would like to make a `list` with a title, note and manually add then sort per `category` all your `product`s.

For this, you create a junction table, `list_product_rel` which contains `product` and `list` FK and an integer for the product placement in the list.

Now, editing the list in a form you could have a One2many and sort your `product`. But it would be for all the product you add to the list and not per product `category`. You want to have a One2many field per product category, in which you will sort the products.

In python, you can't make a One2many field per category (using domain) in `list` because records in `category` is unknown or maybe you can using a loop ? if so how to print all the fields in the form view ?

I tried in xml to have multiple times the one2many field with different domains but the view will use the last one defined (or i don't know how to do it)