Browse Source

[MIG] b_shift : change cron definitions to fit 12.0 requirements

pull/143/head
Elouan Le Bars 5 years ago
parent
commit
f5ea1faf22
  1. 32
      beesdoo_shift/data/cron.xml
  2. 4
      beesdoo_shift/wizard/extension.py
  3. 2
      beesdoo_shift/wizard/validate_attendance_sheet.py

32
beesdoo_shift/data/cron.xml

@ -2,61 +2,71 @@
<data noupdate="1">
<record id="ir_cron_update_today" model="ir.cron">
<field name="name">Update Cooperatoor status base on the date</field>
<field name="model_id" ref="model_cooperative_status" />
<field name="state">code</field>
<field name="code">model._set_today()</field>
<field name="interval_number">24</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="model_id" ref="model_cooperative_status" />
<field name="code">model._set_today()</field>
</record>
<record id="ir_cron_generate_next_planning" model="ir.cron">
<field name="name">Generate Next Planning</field>
<field name="model_id" ref="model_beesdoo_shift_planning" />
<field name="state">code</field>
<field name="code">model._generate_next_planning()</field>
<field name="interval_number">1</field>
<field name="interval_type">weeks</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="model_id" ref="model_beesdoo_shift_planning" />
<field name="code">model._generate_next_planning()</field>
<field name="active" eval="False" />
</record>
<record id="ir_cron_generate_attendance_sheet" model="ir.cron">
<field name="name">Generate Attendance Sheets</field>
<field name="model_id" ref="model_beesdoo_shift_sheet" />
<field name="state">code</field>
<field name="code">model._generate_attendance_sheet()</field>
<field name="user_id" ref="base.user_root" />
<field name="interval_number">4</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="model_id" ref="model_beesdoo_shift_sheet" />
<field name="code">model._generate_attendance_sheet()</field>
<field name="active" eval="False" />
</record>
<record id="ir_cron_compute_shift_counter" model="ir.cron">
<field name="name">Compute Shift Counter</field>
<field name="model_id" ref="model_cooperative_status" />
<field name="state">code</field>
<field name="code">model._cron_compute_counter_irregular()</field>
<field name="interval_number">4</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field name="doall" eval="True" />
<field name="model_id" ref="model_cooperative_status" />
<field name="code">model._cron_compute_counter_irregular()</field>
<field name="active" eval="False" />
</record>
<record id="ir_cron_check_non_validated_sheet" model="ir.cron">
<field name="name">Check for non-validated sheets</field>
<field name="model_id" ref="model_beesdoo_shift_sheet" />
<field name="state">code</field>
<field name="code">model._cron_non_validated_sheets()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="nextcall" eval="datetime.now().replace(hour=00, minute=00, second=10)" />
<field name="model_id" ref="model_beesdoo_shift_sheet" />
<field name="code">model._cron_non_validated_sheets()</field>
<field name="active" eval="False" />
</record>
<record id="ir_cron_send_weekly_emails" model="ir.cron">
<field name="name">Send weekly shift summary</field>
<field name="model_id" ref="model_beesdoo_shift_shift" />
<field name="state">code</field>
<field name="code">model._cron_send_weekly_emails()</field>
<field name="interval_number">7</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
@ -64,8 +74,6 @@
<field name="nextcall"
eval="datetime.now() + timedelta((6 - datetime.now().weekday()) % 7)"
/>
<field name="model_id" ref="model_beesdoo_shift_shift" />
<field name="code">_cron_send_weekly_emails()</field>
<field name="active" eval="False" />
</record>

4
beesdoo_shift/wizard/extension.py

@ -6,7 +6,7 @@ class Subscribe(models.TransientModel):
_inherit = 'beesdoo.shift.action_mixin'
def _get_default_extension_delay(self):
return int(self.env['ir.config_parameter'].get_param('default_extension_delay', 28))
return int(self.env['ir.config_parameter'].sudo().get_param('default_extension_delay', 28))
extension_start_date = fields.Date(string="Start date for the extension", default=fields.Date.today, readonly=True)
@ -22,7 +22,7 @@ class Subscribe(models.TransientModel):
@api.multi
def extension(self):
self = self._check() #maybe a different group
grace_delay = int(self.env['ir.config_parameter'].get_param('default_grace_delay', 10))
grace_delay = int(self.env['ir.config_parameter'].sudo().get_param('default_grace_delay', 10))
status_id = self.env['cooperative.status'].search([('cooperator_id', '=', self.cooperator_id.id)])
if not status_id.extension_start_time:
raise UserError(_('You should not make a manual extension when the grace delay has not been triggered yet'))

2
beesdoo_shift/wizard/validate_attendance_sheet.py

@ -21,7 +21,7 @@ class ValidateAttendanceSheet(models.TransientModel):
def _get_card_support_setting(self):
return ast.literal_eval(
self.env["ir.config_parameter"].get_param(
self.env["ir.config_parameter"].sudo().get_param(
"beesdoo_shift.card_support"
)
)

Loading…
Cancel
Save