Sfoglia il codice sorgente

fix para contemplar hora al inicio y fin del mes

Roberto Pineda 1 anno fa
parent
commit
3f6610470d

BIN
m22_planning/models/__pycache__/planning_slot.cpython-38.pyc


+ 4 - 2
m22_planning/models/planning_slot.py

@@ -38,12 +38,13 @@ class PlanningSlot(models.Model):
             datetime_begin, datetime_end = planned_dates_per_calendar_id[slot.resource_id.calendar_id.id]
 
             start_datetime = slot.start_datetime
-            first_day_of_month = datetime(start_datetime.year, start_datetime.month, 1)
+            first_day_of_month = datetime(start_datetime.year, start_datetime.month, 1, 0, 0, 0)
             last_day = calendar.monthrange(start_datetime.year, start_datetime.month)[1]
-            last_day_of_month = datetime(start_datetime.year, start_datetime.month, last_day)
+            last_day_of_month = datetime(start_datetime.year, start_datetime.month, last_day, 23, 59, 59)
 
             datetime_begin = min(datetime_begin, first_day_of_month)
             datetime_end = max(datetime_end, last_day_of_month)
+
             planned_dates_per_calendar_id[slot.resource_id.calendar_id.id] = datetime_begin, datetime_end
         for calendar_slot, slot_ids in slots_per_calendar.items():
             slots = self.env['planning.slot'].browse(list(slot_ids))
@@ -55,6 +56,7 @@ class PlanningSlot(models.Model):
             datetime_end = timezone_datetime(datetime_end)
             resources = slots.resource_id
             day_total = calendar_slot._get_resources_day_total(datetime_begin, datetime_end, resources)
+            _logger.info('DAY TOTAL %s', day_total)
             intervals = calendar_slot._work_intervals_batch(datetime_begin, datetime_end, resources)
             for slot in slots:
                 slot.real_working_days_count = calendar_slot._get_days_data(