Many to Many relationship with nested attribute

Hi,
I have a scenario like this:
Task (Attività)
Customer (Cliente/i)
Site (Appezzamento/i)

customer has Many site
customer has Many task
task has Many site (customer.site)
site has Many task (customer.task)

Which is the best way to model this scenario in Jmix?

I had created

1 - Customer Entity and Site entity
2 - composition relation Customer One to Many Site
3 - Task entity
4 - association relation Task Many to One Customer
5 - association relation Task Many to Many Site

So when I edit task I would like, after the customer selection, filter the Site browser screen by the customer when I add a site to task.

I would like to find only fields that have ABCD like customer

Thanks in advance.

Screenshot 2023-05-04 alle 20.01.58

You should create a parameter in the Site browse screen and use it to filter data by modifying the query. You can find an example of query modification at Custom filter using query modification - Jmix UI Samples.

Use screenConfigurer handler to pass the parameter to the browse screen.

Thanks, I had use a twinColumn component to manage this situation

<collection id="appezzamentoesDc" class="com.company.innoagri.entity.Appezzamento">
            <fetchPlan extends="_local">
                <property name="varieta" fetchPlan="_local"/>
            </fetchPlan>
            <loader id="appezzamentoesDl">
                <query>
                    <![CDATA[select e from Appezzamento e where 1=0]]>
                </query>
            </loader>
        </collection>

...

            <twinColumn leftColumnCaption="Appezzamenti Cliente" rightColumnCaption="Appezzamenti Lavorati" id="appezzamentiField" addAllBtnEnabled="true" optionsContainer="appezzamentoesDc" width="100%"/>

Controller


 @Subscribe
    public void onAfterShow(AfterShowEvent event) {
        if(Objects.isNull(getEditedEntity().getCliente())){
            clienteField.setVisible(true);
        }else {
            appezzamentoesDc.setItems(getEditedEntity().getCliente().getAppezzamenti());
            appezzamentiField.setValue(getEditedEntity().getAppezzamenti());
        }
        //daFatturareField.setValue(true);
    }

 @Subscribe("appezzamentiField")
    public void onAppezzamentiFieldValueChange(HasValue.ValueChangeEvent<Collection<Appezzamento>> event) {
        List<Appezzamento> app = new ArrayList(appezzamentiField.getValue());
        getEditedEntity().setAppezzamenti(app);
    }