Skip to Content
Odoo Меню
  • Увійти
  • Спробуйте це безкоштовно
  • Додатки
    Фінанси
    • Бухоблік
    • Виставлення рахунку
    • Витрати
    • Електронні таблиці (BI)
    • Документи
    • Підпис
    Продажі
    • CRM
    • Продажі
    • POS Магазин
    • POS Ресторан
    • Підписки
    • Оренда
    Веб-сайти
    • Конструктор веб-сайту
    • Електронна комерція
    • Блог
    • Форум
    • Живий чат
    • Електронне навчання
    Ланцюг поставок
    • Склад
    • Виробництво
    • PLM
    • Купівлі
    • Технічне обслуговування
    • Якість
    Кадри
    • Співробітники
    • Рекрутинг
    • Відпустки
    • Оцінювання
    • Рекомендації
    • Автотранспорт
    Маркетинг
    • Маркетинг соцмереж
    • Email-маркетинг
    • SMS-маркетинг
    • Події
    • Автом. маркетингу
    • Опитування
    Послуги
    • Проект
    • Табелі
    • Виїзне обслуговування
    • Служба підтримки
    • Планування
    • Призначення
    Продуктивність
    • Обговорення
    • Схвалення
    • IoT
    • IP-телефонія
    • База знань
    • WhatsApp
    Сторонні модулі Odoo Studio Платформа Odoo Cloud
  • Сфери
    Роздрібна торгівля
    • Книжковий магазин
    • Магазин одягу
    • Магазин меблів
    • Продуктовий магазин
    • Магазин будівельних матеріалів
    • Магазин іграшок
    Food & Hospitality
    • Бар та паб
    • Ресторан
    • Фастфуд
    • Guest House
    • Дистриб'ютор напоїв
    • Hotel
    Real Estate
    • Real Estate Agency
    • Архітектурна фірма
    • Будівництво
    • Управління нерухомістю
    • Садівництво
    • Асоціація власників нерухомості
    Consulting
    • Accounting Firm
    • Партнер Odoo
    • Marketing Agency
    • Юридична фірма
    • Придбання Талантів
    • Аудит та сертифікація
    Виробництво
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Корпоративні подарунки
    Здоров'я & Фітнес
    • Спортивний клуб
    • Оптика
    • Фітнес-центр
    • Практики здоров'я
    • Аптека
    • Салон краси
    Trades
    • Ремонтник
    • IT-обладнання та Підтримка
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Екологічна агенція
    • Оренда білбордів
    • Фотографія
    • Лізинг велосипедів
    • Реселлер програмного забезпечення
    Browse all Industries
  • Спільнота
    Навчання
    • Навчальний посібник
    • Документація
    • Сертифікації
    • Тренування
    • Блог
    • Подкаст
    Сприяйте Освіті
    • Програма навчання
    • Бізнес гра Scale Up!
    • Відвідайте Odoo
    Отримайте програмне забезпечення
    • Завантаження
    • Порівняйте версії
    • Релізи
    Співпрацюйте
    • Github
    • Форум
    • Події
    • Переклади
    • Стати партнером
    • Services for Partners
    • Зареєструйте вашу бухгалтерську фірму
    Отримайте послуги
    • Знайдіть партнера
    • Знайдіть бухгалтера
    • Зустріньтеся з консультантом
    • Послуги з впровадження
    • Референси клієнтів
    • Підтримка
    • Оновлення
    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
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Допомога

hr.attendance: extend data model with value for break

Підписатися

Отримуйте сповіщення про активність щодо цієї публікації

Це запитання позначене
hrfieldsmodelsattendanceodoo12
3 Відповіді
6026 Переглядів
Аватар
Thomas Blum

Hi to all,

I'd like to extend the hr.attendance data model to manage a default break per day. So I switched to developer mode, then went to "technical" -> "data models" found hr.attendance model and added a float number field x_break. I also modified the corresponding view so that this field is shown. Now, how can I achieve, that this field carries a value of, for instance, 0.75 by default? The field should be editable but if no one edits, it should be 0.75. How can I do it? 

And, as a second step, I would like to have another field that shows the difference between worked_hours and this break. I think that this shoul be a calculated field. In the field definition I see a textbox "compute". Do I simply write down "worked_hours - x_break" in this textbox?

Best regards 

Thomas

0
Аватар
Відмінити
Аватар
Paresh Wagh
Найкраща відповідь

Hi Thomas:

You can define the default value for x_break as follows:

  • Activate developer mode.

  • Go to the view/form where you have added the field.

  • Click on create to open a blank record and type 0.75 into the field.

  • Go into "Open Developer Tools" (the bug symbol at the top right of the screen) and choose "Set Defaults". Select "<name of x_break> = 0.75" and "All users" and click on "Save Default". This will save 0.75 as the default value for all users.

For the second step (assuming you have added another field called x_netto_hours), you can set the following in the Advanced Settings section of the field:

  • Dependencies: worked_hours,x_break

  • Compute:

for record in self:
    if record['worked_hours'] and record['x_break']:
        record['x_netto_hours'] = record['worked_hours'] - record['x_break']


1
Аватар
Відмінити
Аватар
Dennis Schueller
Найкраща відповідь

Hey All,

i need this filed to but I don't get it worked in Version 16.

Could someone Help me?

0
Аватар
Відмінити
Аватар
Thomas Blum
Автор Найкраща відповідь

Hi Paresh,

thank you very much for your quick answer. Setting the default value for the break works like a charm :)

But calculating the diff_hours gives this error when saving the model:

ValueError: <class 'AttributeError'>: "'hr.attendance' object has no attribute 'get'" while evaluating"for record in self:\n    record['x_netto_hours'] = record.get('worked_hours',0) - record.get('x_break',0)\n"

I've made a screenshot of the field definition, you can see it here: https://ibb.co/FsjcHxT

Do you have an idea how I can resolve this?

Kind regards 

Thomas


0
Аватар
Відмінити
Paresh Wagh

Try removing the space between the comma and x_break in "Dependencies".

Paresh Wagh

I have also updated the code part of the solution since you got an error on the "get".

Thomas Blum
Автор

Wow, Paresh, thank you again, now it works, I'm happy and motivated learning a bit of python, it seems to me, it would not be bad.

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

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

Реєстрація
Related Posts Відповіді Переглядів Дія
[HR] How to send email automatically at the end of day if employee forgets to logout in odoo12 Вирішено
hr email attendance odoo12
Аватар
Аватар
1
січ. 20
7916
how to logout from kiosk mode? Вирішено
hr attendance hr_timesheet kiosk odoo12
Аватар
Аватар
Аватар
2
січ. 21
8088
How to find the field type? Вирішено
fields models
Аватар
Аватар
1
черв. 25
5857
Connect fingerprint devices to Odoo Вирішено
hr attendance
Аватар
Аватар
1
трав. 25
2002
Allow employees to see their own attendances Вирішено
hr attendance
Аватар
Аватар
Аватар
Аватар
Аватар
6
січ. 23
18275
Спільнота
  • Навчальний посібник
  • Документація
  • Форум
Open Source
  • Завантаження
  • Github
  • Runbot
  • Переклади
Послуги
  • Хостинг Odoo.sh
  • Підтримка
  • Оновлення
  • Кастомні доробки
  • Навчання
  • Знайдіть бухгалтера
  • Знайдіть партнера
  • Стати партнером
Про нас
  • Наша компанія
  • Торгові активи
  • Зв'яжіться з нами
  • Вакансії
  • Події
  • Подкаст
  • Блог
  • Клієнти
  • Юридичні документи • Конфіденційність
  • Безпека
الْعَرَبيّة 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, електронна комерція, бухгалтерський облік, склад, точка продажу, управління проектами тощо.

Унікальна пропозиція 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