Closed ska-ibees closed 4 years ago
Thank you for your report on our documentation platform! Strangely.. I was able to comment on the same page (so now I have this beautiful "test" comment on that page), but I will look into what happens for Portal users in the near future.
The difference between hr_payroll_timesheet
and hr_payroll_attendance
is simply the difference between Attendances (HR, clock in, clock out) and Timesheets (typically done on Project Tasks, but we've used them on Maintenance Requests as well) in Odoo.
To complicate this a little bit, I originally wrote the 'timesheet' one back on Odoo 9 or 10 and mid writing it changed the strategy to use Attendances instead of timesheets. Hence the hr_payroll_timesheet_old
.
Thanks for taking time to explain the difference. While testing hr_payroll_attendance module i have following findings:
Is it expected behavior? Or salary should be computed based on number of days/hours associated with "ATTN" line"?
Ultimately that comes down to a company's "BASIC" salary rule (or potentially new rules for hourly employees). I have never wanted to overwrite anyone's existing rules. That said, I should document/give examples of reasonable starting points for this. (I know I have one around here somewhere, but I can't find it...)
The most basic BASIC rule (with typical time and a half over 40hr overtime) would look something like this...
result = contract.wage
if contract.paid_hourly:
hours = worked_days.ATTN.number_of_hours
if hours > 40.0:
result = contract.wage * 40.0
result += contract.wage * (hours - 40.0) * 1.5
else:
result = contract.wage * hours
This is ultimately only great for weekly paid, or very lax overtime rules, but it does let us see how to reference the worked_days
object where the hours are stored/accessible. The next most complicated BASIC rules would look more like this.
result = contract.wage
if contract.paid_hourly_attendance:
result = 0.0
for week, hours in payslip.dict.hours_break_down_week('ATTN').items():
hours = round(hours, 2)
if hours <= 40.0:
result += hours * contract.wage
else:
result += 40.0 * contract.wage
result += (hours - 40.0) * (contract.wage * 1.5)
It uses an API ((hr.contract).hours_break_down_week(code)
) that is included in both the timesheet and attendance to group the items by ISO week to work out overtime (maybe different overtime for different states...).
Sometimes people want this in it's own rule, so the "contract.paid_hourly_attendance" is incorporated in the Condition
of the rule. Then a second 'HOURLY' rule is define with a similar, but opposite Condition
. Then maybe the overtime is broken out into its own rule....
Next you need to add in completely arbitrary things like Leaves/Holidays.
So ultimately, I cannot write a BASIC salary rule that meets everyone's expectations.
This explaination is fair enough to get a starting point. Yes, your approach is logical. Instead of hardcoding into a single rule, it makes sense to incorporate calculated hours with flexibility of rules.
Thanks again for the help!
Hello,
First of all, thanks a lot for providing such great modules. Really appreciate that!!! Secondly, could you pleaes elaborate difference between hr_payroll_timesheet and hr_payroll_attendence modules? Both seem identical in many aspects, so it is hard to know the difference. Thanks again!
PS: I tried posting this comment on your website at https://hibou.io/docs/hibou-odoo-suite-1/timesheets-on-payslips-37 but got 404 error.