Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

hr.attendance: extend data model with value for break

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
hrfieldsmodelsattendanceodoo12
3 Replies
6094 Rodiniai
Portretas
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
Portretas
Atmesti
Portretas
Paresh Wagh
Best Answer

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
Portretas
Atmesti
Portretas
Dennis Schueller
Best Answer

Hey All,

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

Could someone Help me?

0
Portretas
Atmesti
Portretas
Thomas Blum
Autorius Best Answer

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
Portretas
Atmesti
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
Autorius

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!

Registracija
Related Posts Replies Rodiniai Veikla
[HR] How to send email automatically at the end of day if employee forgets to logout in odoo12 Solved
hr email attendance odoo12
Portretas
Portretas
1
saus. 20
7968
how to logout from kiosk mode? Solved
hr attendance hr_timesheet kiosk odoo12
Portretas
Portretas
Portretas
2
saus. 21
8168
View a field from one model in another model Solved
fields models
Portretas
Portretas
1
lapkr. 25
6127
How to find the field type? Solved
fields models
Portretas
Portretas
1
birž. 25
5929
Connect fingerprint devices to Odoo Solved
hr attendance
Portretas
Portretas
1
geg. 25
2069
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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