After upgrading to Tryton 5.6, I noticed that the current company name is not shown next to the user name in Sao’s status bar as it was in version 5.4. Digging into the code, I noticed that a test is condition was added to make the company name show up only when the user has more than one company (this code is in res.py in company module). I believe this check may have a bug and is not working correctly as intended when the user has selected a child company as current one.
To illustrate the issue, I have the following companies setup:
Company A (no child companies)
Company B (3 children companies)
- Child Company B1
- Child Company B2
- Child Company B3
Case1:
If the user has “Company A” as his/her main company, then the status bar will not show the company name, which is the correct behaviour, because there is only one company that the user can access and work with.
Case2:
If the user has “Company B” as his/her main company, then it has access to the sub companies B1, B2 and B3 but not Company A. The status bar will show the company name when the user has selected “Company B” as his/her current company. However, when the user changes his/her current company to any of the children companies (B1, B2 or B3) then the company name is not show in the status bar. This may be an inconvenience for user working with multiple same-level companies as there it is immediately visible which company they are currently on and may lead to errors.
As a solution, I believe the domain used in the Company.search function inside the “get_companies()” from the res.user class should be the same as the domain clause used in the User.company field.