Generating commissons for especific agent/company

While testing Issue 10544: Wrong account used when creating commission invoices - Tryton issue tracker I had some concerncs if it’s really a good idea to create commissions of all companies the user has acces to without explicity requesting a filter.

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.

This options should probably be removed.

I do not see why?

You mean the option to generate both invoices? 8

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.

I do not understand why you are talking about rules. They do not apply on wizard.

But the apply on the search cause of the Commission model when searching the commissions to invoices.

But nevermind, I think it will be good to just add the agents as filter

I do not understand this sentence.

I do not agree. The outgoing commissions should be filtered by companies.

But if the user only have access to a single company the filter is useless.

It is a wizard. The code has access to everything.

Oh you are right.

But I see the access check is activated in the asset create move wizard. Does it make sense to have the same behaviour for commission?
If we do so there is no need to add the company (just filter with the users rules).

Indeed it is a solution to avoid asking for companies on the wizard.