Hello Jay, how you're doing...
I am here to help you.. maybe I will just paste here the working code and you will analyze it yourself after then.
The goal is to give the field right "groups" attribute. Then it will be only seen for this group. So for manager there is "group_hr_recruitment_manager" which comes from hr.recruitment module. So the code will be something like this.
<record id="view_hr_job_form_website_published_button_limited" model="ir.ui.view">
<field name="name">hr.job.form.inherit.published.button_limited</field>
<field name="model">hr.job</field>
<field name="inherit_id" ref="website_hr_recruitment.view_hr_job_form_website_published_button"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='website_published']" position="attributes">
<attribute name="groups">hr_recruitment.group_hr_recruitment_manager</attribute>
</xpath>
<xpath expr="//field[@name='is_published']" position="attributes">
<attribute name="groups">hr_recruitment.group_hr_recruitment_manager</attribute>
</xpath>
</field>
</record>
Explanation:
1. inheriting the right view with the button included
website_hr_recruitment.view_hr_job_form_website_published_button
2. using xpath for selection + position="attributes" to add additional attribute called "groups"
<xpath expr="//field[@name='website_published']" position="attributes">
3. putting the content of the attribute
<attribute name="groups">hr_recruitment.group_hr_recruitment_manager</attribute>
4. NOTICE: I have put this attribute to 2 fields as maybe it's wiser to hide both of these fields in the form
look at the screenshot -> https://ibb.co/kBjrWGC
5. Now you can switch the Manager/Officer group for Recruitment module and only Managers will be able to see and use them.
look at the screenshot -> https://ibb.co/d0FnM0g
Hope this will help you a lot.
Please remember, to vote +1 👍 to my answer for the effort, and mark as Best Answer if it worked for you 😎