[IMP] hr-luncheon-voucher: add effective attendance as criteria
The calculation of eligible attendances now also depends on the effective attendance period field.
This commit is contained in:
@@ -27,6 +27,7 @@ Configuration
|
|||||||
1. Go to ``Configuration > Technical > Calendar > Meeting Types`` and define the meeting categories which cancel the daily luncheon voucher distribution.
|
1. Go to ``Configuration > Technical > Calendar > Meeting Types`` and define the meeting categories which cancel the daily luncheon voucher distribution.
|
||||||
2. Go to ``Configuration > General Settings > Employees`` and define if employees need to work the whole day to get a luncheon voucher.
|
2. Go to ``Configuration > General Settings > Employees`` and define if employees need to work the whole day to get a luncheon voucher.
|
||||||
3. Go to ``Employees`` and define for each employee the default number of luncheon vouchers to distribute in each distribution campaign.
|
3. Go to ``Employees`` and define for each employee the default number of luncheon vouchers to distribute in each distribution campaign.
|
||||||
|
4. Go to ``Configuration > Technical > Resource > Working Times`` and create Working Times for each combination of attendance that you have in your company. Do not forget to indicate which period are effectively attended.
|
||||||
|
|
||||||
Use
|
Use
|
||||||
===
|
===
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"name": "HR Luncheon Voucher",
|
"name": "HR Luncheon Voucher",
|
||||||
"category": "Human Resources",
|
"category": "Human Resources",
|
||||||
"version": "14.0.1.0",
|
"version": "14.0.1.1.0",
|
||||||
"summary": "Manage luncheon vouchers credit and distribution",
|
"summary": "Manage luncheon vouchers credit and distribution",
|
||||||
"author": "Elabore",
|
"author": "Elabore",
|
||||||
"website": "https://elabore.coop/",
|
"website": "https://elabore.coop/",
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
"base",
|
"base",
|
||||||
"calendar",
|
"calendar",
|
||||||
"hr",
|
"hr",
|
||||||
|
"hr_effective_attendance_period",
|
||||||
"hr_holidays",
|
"hr_holidays",
|
||||||
"resource",
|
"resource",
|
||||||
],
|
],
|
||||||
|
@@ -7,7 +7,11 @@ class ResourceCalendar(models.Model):
|
|||||||
_inherit = "resource.calendar"
|
_inherit = "resource.calendar"
|
||||||
|
|
||||||
def _retrieve_day_matching_attendances(self, day):
|
def _retrieve_day_matching_attendances(self, day):
|
||||||
domain = [("calendar_id", "=", self.id),("dayofweek", "=", day.weekday())]
|
domain = [
|
||||||
|
("calendar_id", "=", self.id),
|
||||||
|
("dayofweek", "=", day.weekday()),
|
||||||
|
("effective_attendance_period", "=", True)
|
||||||
|
]
|
||||||
if self.two_weeks_calendar:
|
if self.two_weeks_calendar:
|
||||||
# Employee has Even/Odd weekly calendar
|
# Employee has Even/Odd weekly calendar
|
||||||
week_type = 1 if int(math.floor((day.toordinal() - 1) / 7) % 2) else 0
|
week_type = 1 if int(math.floor((day.toordinal() - 1) / 7) % 2) else 0
|
||||||
|
Reference in New Issue
Block a user