I'm using odoo 15 and have multi company enabled. when A user in company B views the Recruitment it shows all the jobs posted in other companies. I want him to have access to his company B jobs only. how is that done?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
I had the same problem and finally solved it, solution attached below.
What I wanted:
- Recruitment Administrator - View/Edit all job positions in all companies
- Recruitment Officer - View/Edit all job positions in HIS company only
- Website visitor - View all job positions from all companies
The following code solved it, except that a Recruitment Officer has to log out (or go incognito) in order to see other companies job positions in the website, but I can live with that.
Solution attached (security/ir_rule.xml in a custom module):
<odoo>
<data noupdate="0">
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'hr'), ('name', '=', 'hr_job_comp_rule')]"/>
</function>
<value eval="{'noupdate': False}" />
</function>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'website_hr_recruitment'), ('name', '=', 'hr_job_officer')]"/>
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="hr.hr_job_comp_rule" model="ir.rule">
<field name="name">Job multi company rule</field>
<field name="model_id" ref="model_hr_job"/>
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field>
<field name="groups" eval="[(6, 0, [ref('hr_recruitment.group_hr_recruitment_user')])]"/>
</record>
<record id="website_hr_recruitment.hr_job_officer" model="ir.rule">
<field name="name">Job Positions: HR Officer</field>
<field name="model_id" ref="hr.model_hr_job"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(6, 0, [ref('hr_recruitment.group_hr_recruitment_manager')])]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_unlink" eval="False"/>
</record>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'hr'), ('name', '=', 'hr_job_comp_rule')]"/>
</function>
<value eval="{'noupdate': True}" />
</function>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'website_hr_recruitment'), ('name', '=', 'hr_job_officer')]"/>
</function>
<value eval="{'noupdate': True}" />
</function>
</data>
</odoo>
The record rule for Jobs in a multi-company setup is:
This means "a User can see the Job if the Company on that Job is FALSE, OR if the Company on that Job is one of the Companies the User is allowed to see".
First, check that this rule has not been changed.
With User A being able to see Company A and Company B records, they will see all Jobs:
Note: The Jobs are grouped by Company.
With User B being able to see Company B only, they will see the following Jobs:
Note: The Jobs are grouped by Company.
See if the Company is set (or not) and change the Company by clicking the EDIT Menu:
Check what you see in the Company field:
For the User in Company A, remember they have to have both Companies selected to see records in both Companies:
Done that and still the same problem.
Is the user A allowed in both companies?
yes user A is allowed but user B not.
If the user is allowed in both companies, then the user probably has both companies checked in the company selection dropdown menu (top-right of the database).
Problem is not with user A, problem with user B having access to see all jobs posted by user A and any other user in other companies.
Please show me screenshot of user B access rights.
here it is :
did you change any access rights for user B?
Because that is not normal behaviour
no, but let me create another user for company C and see how it goes.
Under the recruitment tab of the job. You can find a company field. Set the company corresponding to the job.
You should set the company field as company B, for your purpose.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Feb 24
|
363 | ||
|
0
Aug 23
|
2887 | ||
|
2
Jan 22
|
2611 | ||
|
0
Mar 21
|
1601 | ||
|
2
Aug 20
|
1517 |
Thanks Ray, that worked great. Facing another problem now.
Jobs posted by Company A is visible on the job portal. jobs posted by company B is not.
Company A is the main/default in odoo. How to make it that jobs for company B,C,D..etc appear in the jobs portal ?