Browse Source

[IMP] Holiday end with and end day rater then a nb of days after the start

pull/105/head
Thibault Francois 7 years ago
committed by Elouan
parent
commit
a4d1805b12
  1. 6
      beesdoo_shift/models/cooperative_status.py
  2. 4
      beesdoo_shift/views/cooperative_status.xml

6
beesdoo_shift/models/cooperative_status.py

@ -39,9 +39,9 @@ class CooperativeStatus(models.Model):
super = fields.Boolean("Super Cooperative")
sr = fields.Integer("Compteur shift regulier", default=0)
sc = fields.Integer("Compteur shift de compensation", default=0)
time_holiday = fields.Integer("Holidays Days NB", default=0)
time_extension = fields.Integer("Extension Days NB", default=0, help="Addtional days to the automatic extension, 5 mean that you have a total of 15 extension days of default one is set to 10")
holiday_start_time = fields.Date("Holidays Start Day")
holiday_end_time = fields.Date("Holidays End Day")
alert_start_time = fields.Date("Alert Start Day")
extension_start_time = fields.Date("Extension Start Day")
#Champ compute
@ -67,7 +67,7 @@ class CooperativeStatus(models.Model):
@api.depends('today', 'sr', 'sc', 'time_holiday', 'holiday_start_time', 'time_extension', 'alert_start_time', 'extension_start_time', 'unsubscribed')
@api.depends('today', 'sr', 'sc', 'holiday_end_time', 'holiday_start_time', 'time_extension', 'alert_start_time', 'extension_start_time', 'unsubscribed')
def _compute_status(self):
alert_delay = int(self.env['ir.config_parameter'].get_param('alert_delay', 28))
grace_delay = int(self.env['ir.config_parameter'].get_param('default_grace_delay', 10))
@ -101,7 +101,7 @@ class CooperativeStatus(models.Model):
rec.can_shop = True
#Check for holidays; Can be in holidays even in alert or other mode ?
elif rec.today >= rec.holiday_start_time and rec.today < add_days_delta(rec.holiday_start_time, rec.time_holiday):
elif rec.today >= rec.holiday_start_time and rec.today <= rec.holiday_end_time:
rec.status = 'holiday'
rec.can_shop = True
elif ok or (not rec.alert_start_time and rec.sr >= 0):

4
beesdoo_shift/views/cooperative_status.xml

@ -73,9 +73,9 @@
<field name="can_shop" />
</group>
<group>
<field name="time_holiday" />
<field name="time_extension" />
<field name="holiday_start_time" />
<field name="holiday_end_time" />
<field name="alert_start_time" />
<field name="extension_start_time" />
</group>
@ -107,9 +107,9 @@
<field name="super" />
<field name="sr" />
<field name="sc" />
<field name="time_holiday" />
<field name="time_extension" />
<field name="holiday_start_time" />
<field name="holiday_end_time" />
<field name="alert_start_time" />
<field name="extension_start_time" />
<field name="status" widget="statusbar" />

Loading…
Cancel
Save