From d7d40f52339bd3a5a18d31b7e2887ae4d820c782 Mon Sep 17 00:00:00 2001 From: Flotchet Date: Thu, 23 Nov 2023 22:06:03 +0100 Subject: [PATCH] [FIX] website_hr_recruitment: remove useless csrf_token field Steps to reproduce the bug: - Go to /@/jobs/apply/experienced-developer-4 - Click on "Edit" button - Click anywhere in the form - Try to add a field => Nothing happens Expected behavior: You should be able to add a field without any problem. Explanation of the bug: A dynamic element is in the form (csrf_token) and it is preventing the form to be modified correctly. This was an artifact of a mistake made in commit [1]. Behavior after the fix: You can add a field without any problem. [1]: https://github.com/odoo/odoo/commit/ab93449323140d8a315c1e9dc2a1c789bfa3d859 task-3593111 closes odoo/odoo#143456 Signed-off-by: Quentin Smetz (qsm) --- addons/website_hr_recruitment/__manifest__.py | 2 +- .../migrations/17.0.1.1/pre-migrate.py | 13 +++++++++++++ .../views/website_hr_recruitment_templates.xml | 3 --- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 addons/website_hr_recruitment/migrations/17.0.1.1/pre-migrate.py diff --git a/addons/website_hr_recruitment/__manifest__.py b/addons/website_hr_recruitment/__manifest__.py index aa0753b7016..ffd428c92f6 100644 --- a/addons/website_hr_recruitment/__manifest__.py +++ b/addons/website_hr_recruitment/__manifest__.py @@ -5,7 +5,7 @@ 'name': 'Online Jobs', 'category': 'Website/Website', 'sequence': 310, - 'version': '1.0', + 'version': '1.1', 'summary': 'Manage your online hiring process', 'description': "This module allows to publish your available job positions on your website and keep track of application submissions easily. It comes as an add-on of *Recruitment* app.", 'depends': ['hr_recruitment', 'website_mail'], diff --git a/addons/website_hr_recruitment/migrations/17.0.1.1/pre-migrate.py b/addons/website_hr_recruitment/migrations/17.0.1.1/pre-migrate.py new file mode 100644 index 00000000000..3bbc2edb05b --- /dev/null +++ b/addons/website_hr_recruitment/migrations/17.0.1.1/pre-migrate.py @@ -0,0 +1,13 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +def migrate(cr, version): + # Remove the csrf_token and its surrounding div from the + # website_hr_recruitment.apply (it was set with a t-att- breaking the + # possibility to properly edit the form, and it was actually useless). + cr.execute(r""" + UPDATE ir_ui_view + SET arch_db = REGEXP_REPLACE(arch_db::text, '[^<]*]+id=\\"csrf_token\\"[^>]*/>[^<]*', '', 'g')::jsonb + WHERE key = 'website_hr_recruitment.apply' + AND website_id IS NOT NULL + AND arch_db::text LIKE '%csrf_token%' + """) diff --git a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml index 061f588fa7e..f5470475c18 100644 --- a/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml +++ b/addons/website_hr_recruitment/views/website_hr_recruitment_templates.xml @@ -291,9 +291,6 @@ class="form-control s_website_form_input" name="job_id"/> -
- -