Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: Overtime calculation in Odoo 15 and OCA

by
sewisoft UG , Stefan Wild
- 10/08/2023 11:37:14
Hi Frederik,

I get you point of course. What I can add here is, that there is a boolean flag in the attendance record, where you see that it is generated.
So for that, you are able every time to delete all generated records, if you want. (Perhaps to that time, that Odoo fixes the problem ;-)

I think to build a working patch, needs a lot of refactoring, because everything of overtime calculation is based on attendance records.
And the only way to consider them is, when they really exist.

I also would be more happy, if it wouldn't need such a workaround.
Anyway, this solution fits to our needs, and I just want to share it with all of you. No force to use it.

Vielen Dank und viele Grüße

Stefan Wild
Geschäftsführer
sewisoft.de - Logo

sewisoft GmbH
Örtleinsweg 39
96148 Baunach

info@sewisoft.de
Tel. +49 (0) 160 / 99 11 25 69
www.sewisoft.de

Sitz der Gesellschaft: Baunach
Registergericht: Amtsgericht Bamberg, HRB 8508
Geschäftsführer: Günter Selbert, Stefan Wild



Am 10.08.23 um 09:17 schrieb Frederik Kramer:

Hi Stefan,

grounding your work on Odoo Standard is what we usually do as well, as it limits the upstream work and even more importantly the maintenance effort. However, i am genuinly not a friend of "dirty" work arounds like the one you described, even if that is definitely pragmatic. The reason is simple: Attendance of 0 effectively means, a given employee was attending but technically less than the minimum recordable time. So if the authorities see that record at a given time in the future, they might be tempted to belive there was an error with regard to the recorded time. Moreover an attendenance cron job means, the entry has not been made by the employee or a manager (human), which mit might not be favourable either (with regard to law and credibility of the system).

Overall i believe, your strategy is pragmatic but less favourable from a legal standpoint.

So why not patching the standard functionality, so that it calculates "0" when there is no entry and sent this patch for upstream inclusion? I know this is generally a bumpy road with Odoo but to me that would be the best solution for the given problem

Best Frederik

Am 09.08.23 um 23:52 schrieb Stefan Wild | sewisoft.de:
Hello everyone,

I pained about the same issues, you are all telling about. I just can speak for version 16. Probably 15 too, but I‘am not sure. Our module depends to Odoo Core only.

Our biggest pain was, that the overtime is not reduced on days without attendance, where you normally have to work. 

For that problem we found a really simple solution.
The approach was, when you have attendances, then overtime calculation is correct.
 
The trick is, we create an attendance with zero time for days, where no attendance entries exist. 

Therefore we have implemented a cronjob which runs every night and creates missing attendances for days where are no entries. We use here the „generate_series“ method from postgres. 

You also have got a new field „count_attendance_from“ in employee. Starting from that date, all missing attendances are generated with zero time.

If anyone is interested, here is a link to the code.
I just uploaded it to github, while primarily we are using gitlab.

In this repository there are two more modules. Once for generating public holidays worldwide using pythons holiday library and one module, for updating overtime when creating the holidays later. 

hr_attendance_no_gaps:
Module for correct overtime calculation 

hr_generate_public_holidays:
Module for generating holidays

hr_holidays_attendance_overtime:
Bridge module between hr_attendance and hr_holidays to update overtime.

We also would contribute them to oca, but haven‘t written any tests yet. Feel free to contribute :)

Vielen Dank und Viele Grüße

Stefan Wild 
Geschäftsführer
sewisoft.de - Logo

sewisoft GmbH
Örtleinsweg 39
96148 Baunach

info@sewisoft.de 
Tel. +49 (0) 160 / 99 11 25 69
www.sewisoft.de

Sitz der Gesellschaft: Baunach
Registergericht: Amtsgericht Bamberg, HRB 8508
Geschäftsführer: Günter Selbert, Stefan Wild


Am 08.08.2023 um 15:11 schrieb Rafael Blasco <notifications@odoo-community.org>:



Hello Florian, Holger:

 

After testing and testing in runbot I don’t catch up the “issue” for me is working properly.

 

I will try to test the OCA PR to get in a defined user cases (we can write down) the difference.

 

Regards

Rafael

 

 

De: Holger Brunn <notifications@odoo-community.org>
Enviado el: martes, 8 de agosto de 2023 7:42
Para: Contributors <contributors@odoo-community.org>
Asunto: Re: Overtime calculation in Odoo 15 and OCA

 

> Is your proposal to transfer times from time-sheet / attendance -> payslip
 
> CODE according to some rules (like the Salary Rules). I am running older
 
> version of Odoo and upgrading to 16 ATM and would like to incorporate a
 
> feature like this.
 
no, it might be built on top of my proposal though. I'm now exclusively 
talking about populating hr.attendance.overtime in a way that
 
overtime = (time recorded in hr.attendance records) - (expected working hours 
as per working calendar)
 
holds
 
 
-- 
Your partner for the hard Odoo problems
https://hunki-enterprises.com

_______________________________________________
Mailing-List:
https://odoo-community.org/groups/contributors-15
Post to:
mailto:contributors@odoo-community.org
Unsubscribe:
https://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

-- 
Dr.-Ing. Frederik Kramer
Geschäftsführer

initOS GmbH
Innungsstraße 7
21244 Buchholz i.d.N.

Tel:   +49 (0) 4181 13503 12
Fax:   +49 (0) 4181 13503 10
Mobil: +49 (0) 179 3901819

Email: frederik.kramer@initos.com
Internet: www.initos.com

Geschäftsführung:
Dr.-Ing. Frederik Kramer & Dipl.-Ing. (FH) Torsten Francke

Sitz der Gesellschaft: Buchholz i.d.N.
Amtsgericht Tostedt, HRB 205226
USt-IdNr.: DE815580155
Steuer-Nr: 15/200/53247

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe


Reference