-
Notifications
You must be signed in to change notification settings - Fork 29
[WIP][ADD] bg_job: Implement retry functionality for failed jobs and enhance views #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Conversation
93cc6d2 to
15b9725
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Este PR implementa funcionalidad de reintento masivo para trabajos en segundo plano fallidos y mejora las vistas del módulo bg.job para facilitar la gestión de importaciones de extractos bancarios.
- Añade el método
action_retry_batchque permite reintentar múltiples trabajos fallidos a la vez - Agrega filtros específicos en la vista de búsqueda para trabajos de importación de extractos
- Crea una acción y menú dedicados para acceder rápidamente a importaciones fallidas
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
account_statement_import_sheet_file_bg/__manifest__.py |
Incrementa la versión de 18.0.1.0.1 a 18.0.1.0.2 y referencia el nuevo archivo de vistas |
account_statement_import_sheet_file_bg/models/__init__.py |
Importa el nuevo modelo bg_job |
account_statement_import_sheet_file_bg/models/bg_job.py |
Implementa el método action_retry_batch para reintentar trabajos fallidos en lote |
account_statement_import_sheet_file_bg/views/bg_job_views.xml |
Añade botón de reintento masivo, filtros específicos para trabajos de importación, y una acción/menú para trabajos fallidos |
| def action_retry_batch(self): | ||
| """ | ||
| Action to retry multiple failed jobs at once | ||
| """ | ||
| failed_jobs = self.filtered(lambda j: j.state == "failed") | ||
| if not failed_jobs: | ||
| raise UserError(_("Please select only failed jobs to retry")) | ||
|
|
||
| other_jobs = self - failed_jobs | ||
| if other_jobs: | ||
| raise UserError(_("Some selected jobs are not in failed state and cannot be retried")) | ||
|
|
||
| failed_jobs.write( | ||
| { | ||
| "state": "enqueued", | ||
| "retry_count": 0, | ||
| "error_message": False, | ||
| } | ||
| ) | ||
|
|
||
| return { | ||
| "type": "ir.actions.client", | ||
| "tag": "display_notification", | ||
| "params": { | ||
| "title": _("Jobs Requeued"), | ||
| "type": "success", | ||
| "message": _("%s job(s) have been requeued for retry") % len(failed_jobs), | ||
| "sticky": False, | ||
| }, | ||
| } |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
El método action_retry_batch no tiene cobertura de tests. Dado que el módulo base base_bg cuenta con tests automatizados (incluyendo tests para action_retry), sería recomendable agregar tests para este nuevo método que verifiquen:
- El comportamiento con múltiples trabajos fallidos
- El manejo de errores cuando se seleccionan trabajos en estados diferentes a "failed"
- La actualización correcta de los campos state, retry_count y error_message
- El retorno correcto de la notificación de éxito
| """ | ||
| failed_jobs = self.filtered(lambda j: j.state == "failed") | ||
| if not failed_jobs: | ||
| raise UserError(_("Please select only failed jobs to retry")) |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La validación funciona correctamente, pero el mensaje de error en la línea 17 podría ser más específico. Cuando no hay trabajos fallidos seleccionados, el mensaje actual "Please select only failed jobs to retry" podría interpretarse de múltiples formas.
Sugerencia: Hacer el mensaje más explícito:
- Si no hay trabajos fallidos: "No failed jobs selected. Please select at least one failed job to retry"
- O simplificar la lógica validando directamente que todos los trabajos estén fallidos, en cuyo caso un solo mensaje sería suficiente
| raise UserError(_("Please select only failed jobs to retry")) | |
| raise UserError(_("No failed jobs selected. Please select at least one failed job to retry")) |
|
De sumar esto vería:
Igual lo ideal es entender porque da timeout |

No description provided.