As I understand from you question; you want to set if the product is on stock for a specific retailer. And thus, the product details aren't added by the individual Retailer, but by the head office of the retailers. Right? This means that each retailer has its own OnStock Object.
Your domain model should look like this
If above assumption is correct, then you should change the context of your list. Based on my example domain model, instead of showing the list of products, you should show a list of the Stock objects of that Retailer. Thus for each product there should be a Stock object for each Retailer. Not depending if the product is on stock or not. Any situation. To identify if a product is on stock, you switch the boolean Available to true and false if not. This is simple when you have the context of your list set to stock, referencing the current Retailer. Because each stock object refers to a single Product.
Hi Rene, thank you for the answer. It might be a very good alternative solution for my issue.
However, my thoughts are more like having the administrator of the application who is authorized to amend the data of Products and Retailers separately.
For, the ‘Retailer’ list, where only the administrator can access it, has a “register product to be in stock” button (demonstrated in the first photo on the above post). By clicking it, the administrator will be guided to a list view of ‘Products’ where he can press the switch button to register a product to be in stock for this particular retailer (demonstrated in the second photo on the above post).
Also, I have created a second list view that shows all attributes of ‘Product’ for general users, where there is a ‘details’ button for this. By clicking on it, general users will be guided to a form where they can see all the attributes of a ‘Product’. Here, in this form, I hope the association of ‘Product’, ‘Stock’, and ‘Retailer’ can show me all the attributes of the ‘Retailer’ that ‘register product to be instock’.
Below is a flow to explain my idea:
Administrator access ‘Retailer’ list > click ‘register product instock’ > enable switch > General user access ‘Product’ list > click ‘details’ > see attributes of ‘Retailer’ that Administrator help ‘register product instock’
Apologies for typing that many words, hope that you can understand my idea :)