Thinking a little about it, I’m wondering if it will be a good idea to add the agents as filter of this wizard. So this will allow the user to filter which agents want’s to generate the invoices and as a side effect it will be also possible to generate invoices only of a specific company (by selecting only it’s agents).
I think it makes senses to choose the agent when creating invoices for incoming commission.
But for outgoing commission it makes sense to allow to choose the companies but this is less important because grouped companies may have the rule to create commission at the same time.
But the problem is that the wizard allows the generation of both invoices (incomming and outgoing). So adding both fields will be more complex.
Also for outgoing commissions the record rules will be applied, so if an user only have access to a single company so this is an implicit resctriction when needed.
I mean that this is a restriction that already existis and can be used in case there is the need to filter company in some cases. Having another filter of companies to be able to select will be reduntant with the rules.