This question has been flagged
1 Reply
6160 Views

In a multi company environment, I created the same department structure (HR configuration) for all the companies ... sales, accounting, finance, production, etc. When I want to assign a department to an employee, who belongs to a company (company_id), I see all the departments of all companies but the company name associated to the department is not listed. So I can see 5 times "sales", 5 times "accounting", etc. I think we should see only the departments of the company id of the employee! Is it a bug or am I missing something?

Thanks!

Avatar
Discard
Author

I understand I can allow access to one company at a time for my superuser but it's a little painfull.

Yes, this is an annoying problem. The workaround I have used is to create departments with the company initials like Sales (ABA) and Sales (DRD). When selecting, I know the employee's company (is listed) and select the right one. It's more work on our end, and seems like something the system should be wary of. However, I'm sure if it forced you to select only that employee's company, there would be another use-case where someone wanted to put them in another company department for some reason.

Author

Good idea, I will put the company's initials.

Best Answer

Hi;

You are right; but i don't know if we can call it a " bug", so let's call it "a missing functionality".

When browsing the code in hr.py (HR module), you can see that there is a method "onchange_company" for the class hr_employee, which is executed when you select the company in the hr_view; but unfortunately it' just used to fill the company adress.

We can do the same, for the hr_job class, to filter only the departments belonging to the related company.

Maybe, we can do it with the same method (onchange_company), by returning 2 values instead of one, one for the adress_id and the second for department_id.

But how can we achieve this task , without patch, and patch again after each update?

In fact, i am also facing a similar issue, in sale order, when selecting a Shop or a Pricelist, i get the full list of Shops and PriceLists from all companies ...

This is really an annoying situation.

Yves, keep connected, and follow this question.

Best regards.

Avatar
Discard
Author

Thanks for answering!