@@ -111,7 +111,6 @@ class PlanningSlotTemplate(models.Model):
|
||||
)
|
||||
shift_template.display_name = name
|
||||
|
||||
|
||||
class Planning(models.Model):
|
||||
_inherit = 'planning.slot'
|
||||
|
||||
@@ -127,11 +126,18 @@ class Planning(models.Model):
|
||||
planning_name = slot.template_id.planning_name if slot.template_id and slot.template_id.planning_name else ""
|
||||
new_start_datetime = slot.start_datetime + timedelta(hours=8)
|
||||
start_time_str = new_start_datetime.strftime("%Y-%m-%d")
|
||||
# new_end_datetime = slot.end_datetime + timedelta(hours=8)
|
||||
# end_time_str = new_end_datetime.strftime("%H:%M:%S")
|
||||
# slot.display_name = f"{planning_name + '/' + start_time_str}"
|
||||
slot.display_name = f"{planning_name}"
|
||||
|
||||
@api.constrains('template_id')
|
||||
def _check_template_id(self):
|
||||
for slot in self:
|
||||
if slot.template_id:
|
||||
new_start_datetime = slot.start_datetime + timedelta(hours=8)
|
||||
att_id = self.env['hr.attendance'].search([('employee_id', '=', slot.resource_id.employee_id.id), ('current_data', '=', new_start_datetime.date())])
|
||||
if att_id:
|
||||
att_id.compute_attend()
|
||||
|
||||
|
||||
@api.depends('template_id.color')
|
||||
def _compute_color(self):
|
||||
for slot in self:
|
||||
|
||||
Reference in New Issue
Block a user