Перейти к содержимому
Odoo Меню
  • Войти
  • Попробовать бесплатно
  • Модули
    Финансы
    • Бухгалтерия
    • Выставление счетов
    • Расходы
    • Таблицы
    • Документооборот
    • Подпись
    Продажи
    • CRM
    • Продажи
    • POS Магазин
    • POS Ресторан
    • Подписки
    • Аренда
    Вебсайты
    • Конструктор вебсайтов
    • eCommerce
    • Блог
    • Форум
    • Онлайн-чат
    • Электронное обучение
    Логистика
    • Склад
    • Производство
    • PLM
    • Закупки
    • Обслуживание
    • Качество
    Отдел кадров
    • Сотрудники
    • Подбор персонала
    • Отпуска
    • Оценка персонала
    • Реферальная программа
    • Автопарк
    Маркетинг
    • SMM
    • E-mail рассылки
    • СМС рассылки
    • Мероприятия
    • Автоматизация маркетинга
    • Опросы
    Услуги
    • Проекты
    • Табели
    • Выездной сервис
    • Поддержка
    • Планирование
    • Встречи
    Продуктивность
    • Обсуждения
    • Согласование
    • IoT
    • VoIP-телефония
    • Knowledge
    • WhatsApp
    Сторонние приложения Модуль Студия Odoo Платформа Odoo Cloud
  • Индустрии
    Розничная торговля
    • Книжный магазин
    • Магазин одежды
    • Мебельный магазин
    • Продуктовый магазин
    • Строительный магазин
    • Магазин игрушек
    Гостинично-ресторанный бизнес
    • Бар и паб
    • Ресторан
    • Фастфуд
    • Гостевой дом
    • Дистрибьютор напитков
    • Отель
    Недвижимость
    • Агентство недвижимости
    • Архитектурное бюро
    • Строительство
    • Управление недвижимостью
    • Ландшафтный дизайн
    • Товарищество собственников жилья
    Консалтинг
    • Бухгалтерская фирма
    • Партнер Odoo
    • Маркетинговое агентство
    • Юридическая фирма
    • Подбор персонала
    • Аудиторское бюро
    Производство
    • Текстиль
    • Металл
    • Мебель
    • Продукты питания
    • Пивоварня
    • Корпоративные сувениры
    Здоровье и фитнес
    • Спортивный комплекс
    • Магазин оптики
    • Фитнес-клуб
    • Велнес-центр
    • Аптека
    • Салон красоты
    Услуги
    • Специалист по бытовым услугам
    • Продажа и обслуживание IT-оборудования
    • Солнечные энергосистемы
    • Производство обуви
    • Клининг
    • Системы ОВКВ
    Прочее
    • Некоммерческая организация
    • Консалтинг в сфере устойчивого развития
    • Аренда рекламных щитов
    • Бизнес по фотосъемке
    • Прокат велосипедов
    • Реселлер программного обеспечения
    Все индустрии
  • Community
    Обучение
    • Видео уроки
    • Документация
    • Сертификация
    • Тренинг
    • Блог
    • Подкаст
    Образование и развитие
    • Образовательная программа
    • Деловая игра Scale Up!
    • Экскурсия в офис Odoo
    ПО
    • Скачать
    • Сравнить версии
    • Релизы
    Сотрудничество
    • Github
    • Форум
    • Мероприятия
    • Перевод
    • Стать партнером
    • Услуги для партнеров
    • Зарегистрировать бухгалтерскую фирму
    Услуги
    • Найти партнера
    • Найти бухгалтера
    • Встреча с экспертом
    • Услуги по внедрению
    • Отзывы клиентов
    • Поддержка
    • Обновления
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Заказать демонстрацию
  • Цены
  • Поддержка

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

  • CRM
  • e-Commerce
  • Бухгалтерия
  • Склад
  • PoS
  • Проекты
  • MRP
All apps
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Помощь

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

Подписаться

Получайте уведомления о появлении активности в этом посте

Этот вопрос был отмечен
recruitmentjobv14
1 Ответить
4325 Представления
Аватар
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
Аватар
Отменить
Аватар
Krys.Raj
Лучший ответ

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
Аватар
Отменить
Jay
Автор

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

Jay
Автор

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
Автор

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
Автор

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
Автор

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
Автор

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
Автор

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
Автор

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

Jay
Автор

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
Автор

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

Не оставайтесь в стороне – присоединяйтесь к обсуждению!

Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!

Регистрация
Похожие посты Ответы Просмотры Активность
How to send email to multiple applicant via server action using python code in Odoo 14
recruitment job v14
Аватар
0
окт. 21
2923
How do I inherit a website page, Job Application Form in hr.job odoo 14 and add a field and add override submit button? Решено
recruitment controllers v14
Аватар
Аватар
Аватар
2
июн. 22
5484
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
Аватар
0
февр. 22
3980
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
Аватар
0
дек. 21
2499
Odoo 14EE Recruitment App Does Not Ask for Job Specific Email Address
email recruitment v14
Аватар
Аватар
Аватар
2
мая 21
3147
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • Github
  • Runbot
  • Перевод
Услуги
  • Хостинг Odoo.sh
  • Поддержка
  • Обновление
  • Индивидуальные решения по доработке
  • Образование
  • Найти бухгалтера
  • Найти партнера
  • Стать партнером
О нас
  • Наша компания
  • Активы бренда
  • Cвяжитесь с нами
  • Вакансии
  • Мероприятия
  • Подкаст
  • Блог
  • Клиенты
  • Правовые документы • Конфиденциальность
  • Безопасность
الْعَرَبيّة 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 – это набор бизнес-модулей с открытым исходным кодом, который закроет все потребности вашей компании: CRM, E-commerce, Бухгалтерия, Склад, POS, управление проектами и др.

Odoo сочетает в себе простоту использования и полную интеграцию всех бизнес-процессов в одной системе.

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