[FIX] website: remove 'properties' type field from website form

Commit [1], [2] and [3] added `Properties` type fields on (respectively)
project.task, helpdesk.ticket and crm.lead. Unfortunately, those fields
are not currently supported by the Website Form snippet. Selecting the
"Properties" field while editing a form related to one of these model
will lead to a crash as no definition for how the field is supposed to
render is present in the current code base.

(Note that no logic for how options should behave if such field is
selected is present either.)

Therefore, this commit removes this specific type of field from being
present in the "Existing Fields" section of the Website Form Field
editor.

Steps to reproduce:
 - Install website and project
 - Go to Website and start edit mode
 - Drop a form snippet
 - Click on the form snippet and select "Create a task" as an Action
 - Click on an existing field or add one
 - Select "Properties" as the field type
 => Traceback (QWeb render error)

[1]: https://github.com/odoo/odoo/commit/2f244769cbb1512875ae197aa8adc3efd34fd54b
[2]: https://github.com/odoo/odoo/commit/8de9f4c4777481142063f75d4cd3cef47948714b
[3]: https://github.com/odoo/odoo/commit/4722cc4b1fb027b7b9d731c3b206656588071360

opw-3240395

closes odoo/odoo#118597

X-original-commit: 078f879444e5c2655f80ee572156ac663c0e4abb
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Arthur Detroux (ard)
2023-04-14 15:06:07 +02:00
parent 586b72e0c9
commit 4c928c46ea
+2 -1
View File
@@ -63,7 +63,8 @@ class website_form_model(models.Model):
for field in list(fields_get):
if 'domain' in fields_get[field] and isinstance(fields_get[field]['domain'], str):
del fields_get[field]['domain']
if fields_get[field].get('readonly') or field in models.MAGIC_COLUMNS or fields_get[field]['type'] == 'many2one_reference':
if fields_get[field].get('readonly') or field in models.MAGIC_COLUMNS or \
fields_get[field]['type'] in ['many2one_reference', 'properties']:
del fields_get[field]
return fields_get