fix(fusion_clock): code-review hardening [19.0.5.0.1]

- _cron_generate: per-rule savepoint isolation (one bad rule can't abort the
  whole daily batch)
- fclk_attach_recurrence: clear an existing recurrence first (no orphaned rule
  generating forever)
- fclk_apply_planner_cell: collapse split rows (search was limit=1 after the
  UNIQUE drop, orphaning extras)
- fclk_release_shift: reject non-posted/open shifts (raw-POST guard)
- delete_open_shift: report success=false when nothing was deleted + JS surfaces it
- _generate: log before removing an empty recurrence
Tests added for collapse, re-attach, draft-release.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-06-04 22:32:44 -04:00
parent 53c292083f
commit 19d484680d
8 changed files with 83 additions and 11 deletions

View File

@@ -316,8 +316,10 @@ class FusionClockShiftPlanner(http.Controller):
return {'error': 'Access denied.'}
Schedule = request.env['fusion.clock.schedule'].sudo()
row = Schedule.browse(int(schedule_id or 0))
if row.exists() and row.is_open:
row.unlink()
if not (row.exists() and row.is_open):
return {'success': False,
'message': 'That open shift is no longer available (it may have just been claimed).'}
row.unlink()
return {'success': True, 'data': self._load_week_data(week_start)}
@http.route('/fusion_clock/shift_planner/bulk_apply', type='jsonrpc', auth='user', methods=['POST'])