Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

How to inherit <field name="is_published" widget="website_redirect_button"/> and add attributes to it, hr.job odoo 14

Odoberať

Get notified when there's activity on this post

This question has been flagged
recruitmentjobv14
1 Odpoveď
4332 Zobrazenia
Avatar
Jay
I want to inherit the widget in the recruitment module under hr.job model and add one level record rule
restricting employees from publishing the job unless they're managers.

  • How can I go about this?
    Any assistance will be highly appreciated.





1
Avatar
Zrušiť
Avatar
Krys.Raj
Best Answer

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 😎


1
Avatar
Zrušiť
Jay
Autor

Thanks a lot, Krys.Raj, the answer is well explained and working perfectly well.
Thanks again, man.

Jay
Autor

Only one error below, kindly check.
odoo.exceptions.ValidationError: Error while validating view:

Element '<xpath expr="//field[@name='is_published']">', '<xpath expr="//field[@name='website_published']">' cannot be located in parent view

Krys.Raj

Will check in a minute up to 30 minutes will be back

Krys.Raj

Ok, the problem is I did it for Odoo 15, now after checking the soruce code od Odoo 14 I see there is no field with "name='website_published'" in this view you tries to inherit.. So remove this xpath:
<xpath expr="//field[@name='is_published']" position="attributes">
<attribute name="groups">hr_recruitment.group_hr_recruitment_manager</attribute>
</xpath>

Jay
Autor

Hi Krys.Raj,
I have removed the xpath and still getting this error:
odoo.exceptions.ValidationError: Error while validating view:

Element '<xpath expr="//field[@name='website_published']">' cannot be located in parent view

Krys.Raj
Or you have removed the wrong xpath... not the one with 'is_published' or you havent yet updated the module.. from App menu.. check it out.
You should be left only with one xpath
this one;
<xpath expr="//field[@name='website_published']">

so the code should be 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='is_published']" position="attributes">
            <attribute name="groups">hr_recruitment.group_hr_recruitment_manager</attribute>
        </xpath>
    </field>
</record>

and then update the module...

Oh, and the question is, how do you do it? With module? Have you created one? If you paste this code into the view of course it will generate the error.
Send me screenshot + more explanations..

On Nov 19 2021, at 11:32 am, Jay <jaymezon@gmail.com> wrote:

View Forum Post Odoo S.A.

Hi Krys.Raj,
I have removed the xpath and still getting this error:
odoo.exceptions.ValidationError: Error while validating view:

Element '<xpath expr="//field[@name='website_published']">' cannot be located in parent view
Sent by Odoo S.A. using Odoo.
Sent from Mailspring
Jay
Autor

Now showing this error:
Field "is_published" does not exist in model "hr.job"

Krys.Raj
Can you explain where do you paste it? Because if you modify the template directly in odoo it has no sense.. this will work only if you created a module and from that you inherit and load that view.

Screenshot, please! It will tell more than words :)

On Nov 19 2021, at 11:47 am, Jay <jaymezon@gmail.com> wrote:

View Forum Post Odoo S.A.

Now showing this error:
Field "is_published" does not exist in model "hr.job"
Sent by Odoo S.A. using Odoo.
Sent from Mailspring
Jay
Autor

I had commented this field in my inherited hr.job and the error is gone.
is_published = fields.Boolean('Is Published', copy=False, default=False)

Will this override the 'Go to Website' from here https://ibb.co/kBjrWGC ?

Jay
Autor

Also, it shouldn't allow employees to publish jobs from recruitment as well as shown here, circled part.
https://ibb.co/nByh6jY

Krys.Raj
hello jay I am back to the office... taking look into it
Sent from Mailspring
Krys.Raj
Jay are you there yet? My question is if you like it in the form of xpath full code or just telling you wich view you should modify and how?
Sent from Mailspring
Jay
Autor

xpath full code is fine Krys

Krys.Raj
I can record a video for you how to find how to find view you want to modify..
but now xpath -> ok 10 minutes.. had a guest in my office before.
Sent from Mailspring
Krys.Raj
Hello again, here is a link to the pastebin, as the forum code editor is a disaster
https://pastebin.com/smvUfnA3
What is important your manifest.py (if you do it with custom module) file should include dependency on "website_hr_recruitment" module
like this:
"depends": ["website_hr_recruitment"],
Then this xpath will work as you need.
If you do it in other way than custom module let me know
Sent from Mailspring
Jay
Autor

Code and explanations are fine Krys, no need for a video.

Jay
Autor

added this field in hr.job model:
is_published = fields.Boolean('Is Published', copy=False, default=False)

Will this override the 'Go to Website' from here https://ibb.co/kBjrWGC
and Also, it shouldn't allow employees to publish jobs from recruitment as well as shown here, circled part.
https://ibb.co/nByh6jY?

Krys.Raj
The code I have provided you is exactly doing the thing
https://ibb.co/8sWSg9B
You do not have to recreate the field. Yes, it will be override
Sent from Mailspring
Jay
Autor

Thanks a lot, Krys.Raj.
Working perfectly fine now.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrácia
Related Posts Replies Zobrazenia Aktivita
How to send email to multiple applicant via server action using python code in Odoo 14
recruitment job v14
Avatar
0
okt 21
2927
How do I inherit a website page, Job Application Form in hr.job odoo 14 and add a field and add override submit button? Solved
recruitment controllers v14
Avatar
Avatar
Avatar
2
jún 22
5485
Odoo 14, how to link job application form with the job's survey questions, so that applicant can fill the survey after applying for the job.
email recruitment v14
Avatar
0
feb 22
3981
How to inherit the recruitment job application page website and add survey questions from the survey module associated with the job position in Odoo 14 recruitment module.
survey recruitment v14
Avatar
0
dec 21
2499
Odoo 14EE Recruitment App Does Not Ask for Job Specific Email Address
email recruitment v14
Avatar
Avatar
Avatar
2
máj 21
3147
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now