Hey guys, i hope everything is all right with you.
I am struggling to define a group rule for the commission module. I’m probably missing something, so any help is much appreciated.
So I am trying to define a trivial group rule where each logged company employee user can only see his/her invoice commissions. I have read about this on other topics in here, but nothing worked so far. The list of commissions is always empty. I’m defining the rule in the group rule tab with the following PYSON statement: [['party', '=', Get(Eval('user', {}), 'employee', None)]], referring to the Commission Agent model.
With this I thought that Tryton ERP would only list commission records in which the party agent is equal to the logged in company employee user.
However, it did not work. It still listing no records. Is there any difference between defining the group rule by xml files or with the group rule tab?
Yeah, because I want Tryton to list the commission records according to the commission agent, identified by a party, whenever the commission agent is equal to the company employee user currently logged in.
Yeah, but the definition is made on the Commission Agent model, not in the Commission model. It seems more reasonable for me to define the restriction on the commission agent model, because the user can check for the commissions from the commission agent model with the relate window.
Rules apply only directly to the Model for which they are written.
I think you can not write such rule out-of-the-box. You need to have an agent or a list of agents defined on the user. So you can write rules like: [('agent', '=', Eval('user', {}).get('agent'))]