Siirry sisältöön
Odoo Menu
  • Kirjaudu sisään
  • Kokeile ilmaiseksi
  • Sovellukset
    Talous
    • Kirjanpito
    • Laskutus
    • Kulut
    • Datataulukot (BI)
    • Asiakirjat
    • Allekirjoita
    Myynti
    • CRM
    • Myynti
    • Kassajärjestelmä myymälään
    • Kassajärjestelmä ravintolaan
    • Tilaukset
    • Vuokraus
    Verkkosivut
    • Verkkosivun Rakennustyökalu
    • Verkkokauppa
    • Blogi
    • Foorumi
    • Livechat
    • Verkko-oppiminen
    Toimitusketju
    • Varastointi
    • Tuotanto
    • Tuotteen elinkaaren hallinta (PLM)
    • Ostot
    • Huolto
    • Laatu
    Henkilöstöhallinto
    • Työntekijät
    • Rekrytointi
    • Vapaat
    • Arvioinnit
    • Suositukset
    • Kuljetuskalusto
    Markkinointi
    • Somemarkkinointi
    • Sähköpostimarkkinointi
    • Tekstiviestimarkkinointi
    • Tapahtumat
    • Markkinoinnin automaatio
    • Kyselyt
    Palvelut
    • Projekti
    • Työaikakirjaukset
    • Kenttähuolto
    • Asiakaspalvelu
    • Suunnittelu
    • Ajanvaraukset
    Tuottavuus
    • Viestintä
    • Hyväksynnät
    • IoT
    • IP-puhe
    • Tietokirjasto
    • WhatsApp
    Kolmannen osapuolen sovellukset Odoo-Studio Odoo-Pilvialusta
  • Toimialat
    Vähittäiskauppa
    • Kirjakauppa
    • Vaatekauppa
    • Huonekaluliike
    • Ruokakauppa
    • Laitteistokauppa
    • Lelukauppa
    Ruoka & Majoitus
    • Baari ja Pubi
    • Ravintola
    • Pikaruoka
    • Majatalo
    • Juomien jakelija
    • Hotelli
    Kiinteistöt
    • Kiinteistönvälitystoimisto
    • Arkkitehtitoimisto
    • Rakentaminen
    • Kiinteistönhallinta
    • Puutarhanhoito
    • Kiinteistön omistajien yhdistys
    Konsultointi
    • Tilitoimisto
    • Odoo-kumppani
    • Markkinointitoimisto
    • Lakitoimisto
    • Osaajahankinta
    • Tilintarkastus & sertifiointi
    Tuotanto
    • Tekstiili
    • Metalli
    • Huonekalut
    • Ruoka
    • Panimo
    • Yrityslahjat
    Terveys & Liikunta
    • Urheiluseura
    • Silmälasiliike
    • Kuntokeskus
    • Hyvinvointialan ammattilaiset
    • Apteekki
    • Kampaamo
    Kaupat
    • Yleismies
    • IT-laitteisto & Tuki
    • Aurinkoenergiajärjestelmät
    • Suutari
    • Siivoustarvikkeet
    • LVI-palvelut
    Muut
    • Voittoa tavoittelematon järjestö
    • Ympäristötoimisto
    • Mainostaulujen vuokraus  
    • Valokuvaus
    • Leasing-pyörät
    • Ohjelmistojen jälleenmyyjä
    Selaa kaikkia toimialoja
  • Yhteisö
    Opi
    • Tutoriaalit
    • Dokumentaatio
    • Todistukset
    • Koulutus
    • Blogi
    • Podcast
    Kannusta kouluttautumaan
    • Koulutusohjelmat
    • Scale Up! Liiketoimintapeli
    • Vieraile Odoolla
    Hanki ohjelmisto
    • Lataa
    • Vertaile versioita
    • Julkaisut
    Tee yhteistyötä
    • Github
    • Foorumi
    • Tapahtumat
    • Käännökset
    • Ryhdy kumppaniksi
    • Kumppanipalvelut
    • Rekisteröi tilitoimistosi
    Hanki palveluja
    • Löydä kumppani
    • Löydä kirjanpitäjä
    • Varaa asiantuntijatapaaminen
    • Implementaatiopalvelut
    • Asiakasreferenssit
    • Tuki
    • Versionkorotukset
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Varaa demo
  • Hinnoittelu
  • Asiakaspalvelu

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

  • CRM
  • e-Commerce
  • Kirjanpito
  • Varastointi
  • PoS
  • Projekti
  • MRP
All apps
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Apua

hr.attendance: extend data model with value for break

Tilaa

Saat ilmoituksen, kun tähän viestiin ilmaantuu aktiviteettia

Tämä kysymys on merkitty
hrfieldsmodelsattendanceodoo12
3 Vastaukset
6036 Näkymät
Avatar
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
Avatar
Hylkää
Avatar
Paresh Wagh
Paras vastaus

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
Avatar
Hylkää
Avatar
Dennis Schueller
Paras vastaus

Hey All,

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

Could someone Help me?

0
Avatar
Hylkää
Avatar
Thomas Blum
Tekijä Paras vastaus

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
Avatar
Hylkää
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
Tekijä

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.

Nautitko keskustelusta? Älä vain lue, vaan osallistu!

Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!

Rekisteröidy
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
[HR] How to send email automatically at the end of day if employee forgets to logout in odoo12 Ratkaistu
hr email attendance odoo12
Avatar
Avatar
1
tammik. 20
7920
how to logout from kiosk mode? Ratkaistu
hr attendance hr_timesheet kiosk odoo12
Avatar
Avatar
Avatar
2
tammik. 21
8092
How to find the field type? Ratkaistu
fields models
Avatar
Avatar
1
kesäk. 25
5866
Connect fingerprint devices to Odoo Ratkaistu
hr attendance
Avatar
Avatar
1
toukok. 25
2009
Allow employees to see their own attendances Ratkaistu
hr attendance
Avatar
Avatar
Avatar
Avatar
Avatar
6
tammik. 23
18279
Yhteisö
  • Tutoriaalit
  • Dokumentaatio
  • Foorumi
Avoin lähdekoodi
  • Lataa
  • Github
  • Runbot
  • Käännökset
Palvelut
  • Odoo.sh hosting
  • Tuki
  • Versionkorotus
  • Räätälöidyt kehitykset
  • Koulutus
  • Löydä kirjanpitäjä
  • Löydä kumppani
  • Ryhdy kumppaniksi
Meistä
  • Yrityksemme
  • Tavaramerkki
  • Ota yhteyttä
  • Työpaikat
  • Tapahtumat
  • Podcast
  • Blogi
  • Asiakkaat
  • Oikeudellinen ilmoitus • Yksityisyys
  • Tietoturva
الْعَرَبيّة 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 on kokoelma avoimen lähdekoodin yrityssovelluksia, jotka kattavat kaikki yrityksesi tarpeet: asiakkuudenhallinta eli CRM, verkkokauppa, kirjanpito, varastointi, kassajärjestelmä, projektinhallinta, jne.

Odoon uniikki arvolupaus on olla samanaikaisesti erittäin helppokäyttöinen ja täysin integroitu.

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