[FIX] base, website_form: prevent assetsbundle commit in savepoint
Steps to reproduce: - Install industry_fsm_report, website - Create Project P, add column/stage PC. - Edit stage, Email Template = Task: Intervention Schduled. - Edit the template > Advanced Settings > Optional report to print and attach = Worksheet Report (PDF). Save everything. - Go to website, "contact us" page > Edit the form, Action = Create a task, Project = P > Save Issue: When you first submit the form, it will fail, but the task will be created and visible in project P. By instinct, the user will submit the form again, so the task will be duplicated. The second form submit will return a success message. When submitting a form, we first generate a savepoint (added in commit [1]). Since this is the first interaction with the report system, during the handling of the form, the assetsbundle will be generated (see keyword 'commit_assetsbundle'), which will cause a commit. Finally, assuming no other error is raised, we try to delete the savepoint. However, since a commit was executed, then the savepoint will no longer exist, which will cause an error status to be returned. Solution: When submitting a form, pass `commit_assetsbundle=False` to the record creation, which prevents the commit from happening. This solution has a downside; creating the record also sends an email and the report attached to that email will have broken styling. This is still an improvement to the current behaviour, which doesn't send the first email at all. [1]: https://github.com/odoo-dev/odoo/commit/5a499ecf113f08c11d2b33b47680dd00ec1b297b opw-3183912 closes odoo/odoo#119612 Signed-off-by:Romain Derie (rde) <rde@odoo.com>
Loading