Victor Piryns (pivi)
21f78b1ae0
[FIX] web, stock: rollback database when crashing on report generation
...
Current behaviour:
When we are printing a report and then the report fails to generate
(for ex. wkhtmltopdf memory limit/timeout),
the incorrect state is committed to the database.
Expected behaviour:
We should rollback when generating reports fails, since it is an error state.
Steps to reproduce:
To reproduce the behaviour, we need to force an error state.
- In odoo/addons/base/models/ir_actions_report.py:`_run_wkhtmltopdf()`,
raise an exception before spawning the subprocess (for ex. adding a 1/0).
- In addons/web/controllers/main.py:`report_download()`#L2126,
add this little code snippet:
```python
ids = [int(x) for x in docids.split(",")]
report = request.env['ir.actions.report']._get_report_from_name(reportname)
obj = request.env[report.model].browse(ids)
if getattr(obj, 'message_post'):
obj.message_post(body='This report was committed!')
```
- Install Inventory
- Pick a delivery order and try to print it, there should be an error
(whatever exception you decided to raise in `_run_wkhtmltopdf()`)
- See that in the message board we got a message that the report has been committed,
which isn't the case, it failed to generate.
Reason for the problem:
Controllers are catching the exception when generating reports,
but never reset the state of the database.
Fix:
Raise an InternalServerError with an error code of 500 to trigger
a database rollback.
Affected versions:
- 14.0
- 15.0
- saas-15.2
- saas-15.3
- 16.0
- master
opw-3001950
closes odoo/odoo#106172
X-original-commit: ec185fcf7f32da05c83733af36bebe10ac22e2ad
Related: odoo/enterprise#34193
Signed-off-by: Julien Castiaux <juc@odoo.com >
Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com >
2022-11-21 15:57:11 +01:00
..
2022-11-18 17:03:59 +01:00
2022-11-07 14:52:54 +01:00
2022-10-04 07:28:57 +02:00
2022-11-18 20:42:53 +01:00
2022-10-09 22:04:00 +02:00
2022-10-25 18:44:57 +02:00
2022-09-24 15:00:56 +02:00
2022-09-20 13:48:49 +02:00
2022-10-28 14:20:59 +02:00
2022-11-11 17:54:39 +01:00
2022-10-25 18:44:57 +02:00
2022-11-14 12:04:04 +01:00
2022-09-17 00:51:32 +02:00
2022-10-09 22:04:00 +02:00
2022-09-20 13:48:49 +02:00
2022-09-16 20:51:56 +02:00
2022-09-16 20:51:56 +02:00
2022-10-06 14:56:52 +02:00
2022-10-11 13:15:12 +02:00
2022-10-06 14:56:52 +02:00
2022-10-06 14:56:52 +02:00
2022-09-20 13:48:49 +02:00
2022-11-09 16:08:07 +01:00
2022-11-15 10:34:04 +01:00
2022-10-21 17:17:07 +02:00
2022-11-21 11:50:23 +01:00
2022-09-20 13:48:49 +02:00
2022-09-30 09:31:52 +02:00
2022-11-07 11:26:33 +01:00
2022-11-16 10:28:50 +01:00
2022-11-16 10:28:43 +01:00
2022-11-16 10:28:53 +01:00
2022-11-18 19:42:14 +01:00
2022-10-28 14:21:13 +02:00
2022-11-06 02:16:48 +01:00
2022-11-07 22:38:56 +01:00
2022-11-21 14:56:53 +01:00
2022-11-21 15:56:57 +01:00
2022-11-18 13:59:53 +01:00
2022-11-06 02:16:48 +01:00
2022-11-14 16:21:55 +01:00
2022-10-26 19:03:55 +02:00
2022-11-15 10:34:15 +01:00
2022-09-20 13:48:49 +02:00
2022-10-06 18:00:49 +02:00
2022-10-11 13:15:12 +02:00
2022-11-17 14:56:42 +01:00
2022-10-07 11:13:17 +02:00
2022-11-15 13:01:29 +01:00
2022-10-07 21:43:23 +02:00
2022-11-17 14:56:42 +01:00
2022-10-29 12:05:55 +02:00
2022-10-10 16:11:01 +02:00
2022-10-04 07:28:57 +02:00
2022-09-28 20:29:50 +02:00
2022-11-09 10:56:54 +01:00
2022-10-25 16:11:59 +02:00
2022-11-09 16:08:07 +01:00
2022-11-15 13:01:29 +01:00
2022-10-28 20:39:58 +02:00
2022-11-15 16:16:48 +01:00
2022-11-18 16:04:23 +01:00
2022-09-30 09:32:23 +02:00
2022-09-24 15:00:56 +02:00
2022-11-21 11:49:57 +01:00
2022-10-27 10:37:34 +02:00
2022-09-30 09:31:52 +02:00
2022-10-21 11:09:14 +02:00
2022-10-21 11:09:22 +02:00
2022-11-14 17:18:02 +01:00
2022-11-21 15:56:57 +01:00
2022-10-27 16:44:13 +02:00
2022-10-06 14:56:52 +02:00
2022-10-06 19:04:28 +02:00
2022-09-29 09:08:50 +02:00
2022-09-14 20:25:01 +02:00
2022-11-15 18:25:08 +01:00
2022-09-20 13:48:49 +02:00
2022-09-14 20:25:01 +02:00
2022-10-26 01:58:35 +02:00
2022-10-21 12:06:04 +02:00
2022-11-21 11:50:26 +01:00
2022-11-14 14:20:29 +01:00
2022-09-26 09:36:02 +02:00
2022-10-09 22:04:00 +02:00
2022-09-20 13:48:49 +02:00
2022-11-17 15:59:16 +01:00
2022-09-20 13:48:49 +02:00
2022-10-18 21:48:02 +02:00
2022-10-25 18:44:57 +02:00
2022-11-02 11:38:38 +01:00
2022-11-10 09:50:39 +01:00
2022-11-11 17:54:39 +01:00
2022-10-04 13:29:08 +02:00
2022-11-02 12:37:16 +01:00
2022-11-11 17:54:39 +01:00
2022-09-13 13:53:04 +02:00
2022-09-13 13:53:04 +02:00
2022-10-04 13:29:08 +02:00
2022-10-04 13:29:08 +02:00
2022-11-14 13:01:49 +01:00
2022-10-25 18:44:57 +02:00
2022-10-25 18:44:57 +02:00
2022-10-04 13:29:08 +02:00
2022-09-14 20:25:01 +02:00
2022-10-19 16:09:55 +02:00
2022-11-15 18:25:45 +01:00
2022-11-15 18:25:45 +01:00
2022-11-14 13:01:49 +01:00
2022-10-04 13:29:08 +02:00
2022-10-04 13:29:08 +02:00
2022-10-04 13:29:08 +02:00
2022-11-11 17:54:39 +01:00
2022-11-11 17:54:39 +01:00
2022-10-05 11:04:20 +02:00
2022-11-02 10:40:14 +01:00
2022-10-04 13:29:08 +02:00
2022-10-08 15:20:55 +02:00
2022-10-28 09:17:43 +02:00
2022-10-25 18:44:57 +02:00
2022-10-08 17:02:51 +02:00
2022-11-10 22:22:01 +01:00
2022-11-11 17:54:39 +01:00
2022-11-11 17:54:39 +01:00
2022-10-21 11:09:14 +02:00
2022-11-11 17:54:39 +01:00
2022-11-11 17:54:39 +01:00
2022-10-04 13:29:08 +02:00
2022-09-13 13:53:04 +02:00
2022-09-16 11:12:29 +02:00
2022-10-04 13:29:08 +02:00
2022-10-28 08:22:57 +02:00
2022-09-13 13:53:04 +02:00
2022-11-14 17:17:53 +01:00
2022-10-27 08:44:49 +02:00
2022-11-09 10:56:48 +01:00
2022-09-14 20:25:01 +02:00
2022-11-11 17:54:39 +01:00
2022-11-11 17:54:39 +01:00
2022-10-04 13:29:08 +02:00
2022-11-11 17:54:39 +01:00
2022-09-27 12:43:44 +02:00
2022-10-04 13:29:08 +02:00
2022-11-11 17:54:39 +01:00
2022-09-30 22:54:47 +02:00
2022-10-04 13:29:08 +02:00
2022-11-11 17:54:39 +01:00
2022-09-13 13:53:04 +02:00
2022-10-04 13:29:08 +02:00
2022-09-24 15:00:56 +02:00
2022-10-04 13:29:08 +02:00
2022-11-04 09:52:54 +01:00
2022-10-07 12:41:12 +02:00
2022-10-04 13:29:08 +02:00
2022-10-25 16:12:15 +02:00
2022-11-11 17:54:39 +01:00
2022-11-08 07:46:40 +01:00
2022-10-04 13:29:08 +02:00
2022-09-13 13:53:04 +02:00
2022-10-04 13:29:08 +02:00
2022-10-04 13:29:08 +02:00
2022-10-25 13:03:28 +02:00
2022-10-24 13:05:52 +02:00
2022-11-11 17:54:39 +01:00
2022-11-11 17:54:39 +01:00
2022-10-04 13:29:08 +02:00
2022-09-13 13:53:04 +02:00
2022-10-04 13:29:08 +02:00
2022-11-18 12:58:22 +01:00
2022-10-04 13:29:08 +02:00
2022-10-04 13:29:08 +02:00
2022-10-25 21:20:50 +02:00
2022-10-04 13:29:08 +02:00
2022-11-11 17:54:39 +01:00
2022-10-04 13:29:08 +02:00
2022-09-13 13:53:04 +02:00
2022-10-10 16:11:01 +02:00
2022-10-17 13:09:20 +02:00
2022-09-20 13:48:49 +02:00
2022-11-10 14:13:41 +01:00
2022-11-21 15:56:57 +01:00
2022-10-31 18:52:59 +01:00
2022-11-11 17:54:39 +01:00
2022-10-06 14:56:52 +02:00
2022-09-24 15:00:56 +02:00
2022-11-21 14:57:12 +01:00
2022-11-21 09:51:13 +01:00
2022-10-06 14:56:52 +02:00
2022-09-20 13:48:49 +02:00
2022-09-20 13:48:49 +02:00
2022-09-20 13:48:49 +02:00
2022-09-28 20:29:51 +02:00
2022-10-25 16:11:59 +02:00
2022-11-21 09:51:19 +01:00
2022-11-18 14:00:11 +01:00
2022-11-11 17:54:39 +01:00
2022-11-14 13:01:57 +01:00
2022-11-16 13:23:41 +01:00
2022-10-05 14:26:14 +02:00
2022-11-06 02:16:48 +01:00
2022-11-11 17:54:39 +01:00
2022-10-24 14:12:23 +02:00
2022-11-18 12:57:52 +01:00
2022-11-14 16:21:36 +01:00
2022-10-12 08:33:40 +02:00
2022-10-12 08:33:40 +02:00
2022-10-18 18:58:37 +02:00
2022-10-12 08:33:40 +02:00
2022-10-12 08:33:40 +02:00
2022-10-12 08:33:40 +02:00
2022-10-12 08:33:40 +02:00
2022-10-12 08:33:40 +02:00
2022-10-12 08:33:40 +02:00
2022-11-11 17:54:39 +01:00
2022-10-18 18:58:37 +02:00
2022-10-12 08:33:40 +02:00
2022-10-18 18:58:37 +02:00
2022-10-12 08:33:40 +02:00
2022-10-12 08:33:40 +02:00
2022-10-12 08:33:40 +02:00
2022-10-28 09:17:56 +02:00
2022-10-26 00:55:05 +02:00
2022-11-18 15:01:08 +01:00
2022-10-18 13:17:31 +02:00
2022-09-24 15:00:56 +02:00
2022-10-20 09:20:54 +02:00
2022-09-20 13:48:49 +02:00
2022-11-11 17:54:39 +01:00
2022-11-11 17:54:39 +01:00
2022-11-14 12:03:51 +01:00
2022-11-11 17:54:39 +01:00
2022-11-14 12:03:51 +01:00
2022-11-09 16:08:07 +01:00
2022-11-16 13:23:32 +01:00
2022-09-14 21:22:05 +02:00
2022-11-11 17:54:39 +01:00
2022-11-11 17:54:39 +01:00
2022-11-11 17:54:39 +01:00
2022-11-11 17:54:39 +01:00
2022-11-13 21:54:40 +01:00
2022-11-03 16:43:36 +01:00
2022-10-11 14:10:15 +02:00
2022-11-21 14:56:55 +01:00
2022-09-20 13:48:49 +02:00
2022-09-20 13:48:49 +02:00
2022-09-20 13:48:49 +02:00
2022-10-29 12:05:55 +02:00
2022-10-06 14:56:52 +02:00
2022-11-18 15:00:53 +01:00
2022-11-09 21:17:46 +01:00
2022-09-24 15:00:56 +02:00
2022-11-04 10:54:57 +01:00
2022-10-17 10:11:09 +02:00
2022-10-08 13:30:24 +02:00
2022-11-07 13:49:50 +01:00
2022-11-18 12:57:50 +01:00
2022-09-20 13:48:49 +02:00
2022-10-10 13:00:43 +02:00
2022-11-18 12:58:16 +01:00
2022-10-05 19:38:45 +02:00
2022-11-16 13:23:41 +01:00
2022-11-18 15:00:56 +01:00
2022-11-17 11:58:50 +01:00
2022-11-21 11:50:28 +01:00
2022-11-21 12:56:40 +01:00
2022-11-10 13:15:39 +01:00
2022-09-27 12:43:50 +02:00
2022-11-09 23:33:27 +01:00
2022-11-09 23:33:27 +01:00
2022-11-18 17:03:59 +01:00
2022-11-17 13:57:22 +01:00
2022-11-09 16:08:19 +01:00
2022-10-09 22:03:50 +02:00
2022-10-10 19:55:43 +02:00
2022-11-18 08:43:51 +01:00
2022-11-07 14:52:51 +01:00
2022-10-09 22:03:50 +02:00
2022-11-13 00:28:43 +01:00
2022-11-19 12:02:19 +01:00
2022-10-17 12:13:25 +02:00
2022-11-17 13:57:30 +01:00
2022-11-15 10:34:12 +01:00
2022-11-11 17:54:39 +01:00
2022-11-18 14:00:05 +01:00
2022-11-18 14:00:05 +01:00
2022-11-18 14:00:05 +01:00
2022-10-04 08:30:44 +02:00
2022-09-30 09:31:52 +02:00
2022-11-08 16:52:44 +01:00
2022-09-30 09:31:52 +02:00
2022-09-30 09:31:52 +02:00
2022-09-30 09:31:52 +02:00
2022-09-30 09:31:52 +02:00
2022-10-04 08:30:44 +02:00
2022-10-12 18:58:43 +02:00
2022-09-30 09:31:52 +02:00
2022-09-30 09:31:52 +02:00
2022-10-06 18:00:54 +02:00
2022-11-21 15:57:11 +01:00
2022-11-16 10:28:48 +01:00
2022-11-18 17:03:56 +01:00
2022-09-20 13:48:49 +02:00
2022-11-08 09:40:57 +01:00
2022-09-20 13:48:49 +02:00
2022-11-21 15:57:03 +01:00
2022-10-10 16:11:01 +02:00
2022-11-04 17:56:45 +01:00
2022-11-18 14:00:30 +01:00
2022-10-28 20:39:58 +02:00
2022-10-26 00:55:05 +02:00
2022-11-18 14:00:30 +01:00
2022-10-04 16:01:19 +02:00
2022-10-12 10:34:45 +02:00
2022-11-14 17:17:59 +01:00
2022-09-09 13:38:08 +02:00
2022-10-06 00:37:25 +02:00
2022-09-24 15:00:56 +02:00
2022-10-06 14:56:52 +02:00
2022-11-21 15:57:11 +01:00
2022-11-18 17:03:53 +01:00
2022-10-27 14:41:17 +02:00
2022-10-27 14:41:17 +02:00
2022-10-27 14:41:17 +02:00
2022-11-21 11:50:26 +01:00
2022-11-07 17:59:55 +01:00
2022-09-12 17:33:39 +02:00
2022-11-14 14:20:39 +01:00
2022-10-12 10:35:05 +02:00
2022-10-12 10:35:05 +02:00
2022-11-15 22:06:15 +01:00
2022-09-20 13:48:49 +02:00
2022-09-24 15:00:56 +02:00
2022-09-20 13:48:49 +02:00
2022-11-09 16:08:07 +01:00
2022-10-12 10:35:05 +02:00
2022-11-04 14:00:24 +01:00
2022-10-10 19:03:15 +02:00
2022-10-12 10:35:05 +02:00
2022-09-20 13:48:49 +02:00
2022-09-14 20:25:01 +02:00
2022-11-03 16:43:45 +01:00
2022-11-07 11:26:58 +01:00
2022-11-07 11:26:33 +01:00
2022-09-14 20:25:01 +02:00
2022-10-10 16:11:01 +02:00
2022-11-17 15:59:16 +01:00
2022-09-20 13:48:49 +02:00
2022-09-20 13:48:49 +02:00
2022-11-10 21:16:18 +01:00
2022-09-20 13:48:49 +02:00
2022-10-12 10:35:05 +02:00
2022-11-07 14:52:59 +01:00
2022-09-09 13:38:08 +02:00
2022-11-18 12:57:52 +01:00
2022-10-06 14:56:52 +02:00
2022-11-17 21:04:40 +01:00
2022-09-14 20:25:01 +02:00
2022-11-11 17:54:39 +01:00
2022-10-04 16:01:08 +02:00
2022-11-11 17:54:39 +01:00
2022-11-14 14:20:29 +01:00
2022-11-09 10:56:54 +01:00
2022-09-12 12:43:41 +02:00
2022-09-20 19:21:15 +02:00
2022-11-10 09:50:40 +01:00
2022-11-04 16:59:54 +01:00
2022-09-20 13:48:49 +02:00
2022-10-24 14:12:34 +02:00
2022-11-11 17:54:39 +01:00
2022-11-18 14:00:30 +01:00
2022-11-03 08:42:52 +01:00
2022-10-06 14:56:52 +02:00
2022-09-20 13:48:49 +02:00