FIX unable assign role_line with same role different companies
Related to this card.
I feel that perhaps it is a BUG or a inconsistence of the OCA module 'base_user_role_company' because this domain at xml-view level it is not allowing to add additional role line ids if the role_id is already assigned to the user, but we need to be able to assign the same Role to a user but for different companies.
The module 'base_user_role_company' already have a sql-constrain implemented at res.users.role.line
model that it taking care of no user+role+company duplicities:
_sql_constraints = [ ( "user_role_uniq", "unique (user_id,role_id,company_id)", "Roles can be assigned to a user only once at a time", ) ]
So I feel that we can proceed to teke out this xml-view domain. I you @enricostn & @DaniilDigtyar ara agre, we can also proceed to suggest it as a MR proposal to the OCA repo of 'res.users.role.line'
Merge request reports
Activity
requested review from @enricostn
assigned to @xavier.bonet
Wow, this is a weird logic in the OCA module.
I see that they only use this domain that you are deleting to make sure that you can't add a role that is in
default_user
so it doesn't add it two times, so removing it shouldn't cause any unexpected bug.Without a multi-company assigned to the roles this domain makes sense but not in our case. I think it is interesting to open a PR to OCA, but I'm not sure if just removing the domain is the best implementation for OCA.
Here is testing case for this domain and only use.
Edited by Daniil Digtyar Vasilievachanged milestone to %v14.0.1.1.13
mentioned in commit 78e5ac1e
mentioned in merge request !187 (merged)
mentioned in merge request !188 (merged)