Skip to content
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

[IMP] website: choose between radio or dropdown in select fields #138944

Conversation

SergeBayet
Copy link
Contributor

@SergeBayet SergeBayet commented Oct 17, 2023

This task addresses the limitation where users do not have the option
to choose between a select and radio button when dealing with existing
fields. The goal is to facilitate a more informed choice between the
two based on the number of available options.
A new "Selection Type" option is added, allowing users to choose between
Dropdown List and Radio for fields with a moderate number of options.
The option fields are removed from the preview area, considering that
the options are already displayed in the right panel.

task-2232291

@robodoo
Copy link
Contributor

robodoo commented Oct 17, 2023

@C3POdoo C3POdoo added the RD research & development, internal work label Oct 17, 2023
@SergeBayet SergeBayet force-pushed the master-select-field-radio-dropdown-seba branch 5 times, most recently from 539e4e4 to 2a86f65 Compare February 26, 2024 09:17
Copy link
Contributor

@Guillaume-gdi Guillaume-gdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a first review.

In the commit message, you can put the website on the first line without using the * 👍

@@ -289,13 +289,18 @@
<t t-call="website.form_field">
<select class="form-select s_website_form_input" t-att-name="field.name" t-att-required="field.required || field.modelRequired || None" t-att-id="field.id" style="display: none">
<t t-foreach="field.records" t-as="record" t-key="record_index">
<option t-esc="record.display_name" t-att-value="record.id" t-att-selected="record.selected and 'selected' or None"/>
<option t-attf-selected="#{record.selected and 'selected' or None}" t-esc="record.display_name" t-att-value="record.id"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change ? And why do you change the order of attributes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the changes introduced in 6303a3e, there is a bug affecting the behavior of t-att-selected, possibly introduced in the subsequent commit: 3632519. I've created a task (id:3767819). A work around to avoid waiting the forward-port in master, is to use t-attf instead. I could remove this change as soon as the bug is fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Guillaume-gdi I took inspiration from the commit b42e9cc by @rdeodoo to address this issue, which will be resolved in the aforementioned task.
https://github.com/odoo/odoo/pull/138944/files#diff-e84353750393781d43d4a4bb1debe41db124f3b0ef9301e516f622695905d4b4R292

addons/website/static/src/xml/website_form_editor.xml Outdated Show resolved Hide resolved
addons/website/static/tests/tours/website_form_editor.js Outdated Show resolved Hide resolved
addons/website/views/snippets/s_website_form.xml Outdated Show resolved Hide resolved
@SergeBayet SergeBayet force-pushed the master-select-field-radio-dropdown-seba branch 2 times, most recently from ad9d5fa to bc96432 Compare February 27, 2024 08:27
@SergeBayet SergeBayet changed the title [IMP] *: choose between radio or dropdown in select fields [IMP] website: choose between radio or dropdown in select fields Feb 29, 2024
@SergeBayet SergeBayet force-pushed the master-select-field-radio-dropdown-seba branch from bc96432 to c42084c Compare February 29, 2024 08:21
@SergeBayet SergeBayet force-pushed the master-select-field-radio-dropdown-seba branch 5 times, most recently from 783dc05 to 83a0023 Compare March 20, 2024 09:52
@SergeBayet SergeBayet force-pushed the master-select-field-radio-dropdown-seba branch from 83a0023 to 4d690c0 Compare March 26, 2024 09:35
@SergeBayet SergeBayet marked this pull request as ready for review April 18, 2024 14:30
@C3POdoo C3POdoo requested a review from a team April 18, 2024 14:32
@qsm-odoo
Copy link
Contributor

@robodoo delegate=bso-odoo
@bso-odoo

@SergeBayet SergeBayet force-pushed the master-select-field-radio-dropdown-seba branch from 4d690c0 to d01e21d Compare April 19, 2024 06:06
@SergeBayet SergeBayet changed the title [IMP] website: choose between radio or dropdown in select fields [IMP] web_editor, *: choose between radio or dropdown in select fields Apr 19, 2024
Copy link
Contributor

@bso-odoo bso-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are a few comments:

addons/web_editor/static/src/js/editor/snippets.options.js Outdated Show resolved Hide resolved
addons/web_editor/static/src/js/editor/snippets.options.js Outdated Show resolved Hide resolved
addons/website/static/src/xml/website_form_editor.xml Outdated Show resolved Hide resolved
addons/website/static/src/xml/website_form_editor.xml Outdated Show resolved Hide resolved
addons/website/static/tests/tours/website_form_editor.js Outdated Show resolved Hide resolved
addons/website/static/src/xml/website_form_editor.xml Outdated Show resolved Hide resolved
@SergeBayet SergeBayet force-pushed the master-select-field-radio-dropdown-seba branch from d01e21d to deabc84 Compare April 23, 2024 09:25
@SergeBayet SergeBayet changed the title [IMP] web_editor, *: choose between radio or dropdown in select fields [IMP] website: choose between radio or dropdown in select fields Apr 23, 2024
@SergeBayet SergeBayet force-pushed the master-select-field-radio-dropdown-seba branch 2 times, most recently from 044a994 to 681e32e Compare April 23, 2024 12:39
This task addresses the limitation where users do not have the option
to choose between a select and radio button when dealing with existing
fields. The goal is to facilitate a more informed choice between the
two based on the number of available options.
A new "Selection Type" option is added, allowing users to choose between
Dropdown List and Radio for fields with a moderate number of options.
The option fields are removed from the preview area, considering that
the options are already displayed in the right panel.

task-2232291
@SergeBayet SergeBayet force-pushed the master-select-field-radio-dropdown-seba branch from 681e32e to 11d1832 Compare April 23, 2024 13:32
@bso-odoo
Copy link
Contributor

@robodoo r+

robodoo pushed a commit that referenced this pull request Apr 24, 2024
This task addresses the limitation where users do not have the option
to choose between a select and radio button when dealing with existing
fields. The goal is to facilitate a more informed choice between the
two based on the number of available options.
A new "Selection Type" option is added, allowing users to choose between
Dropdown List and Radio for fields with a moderate number of options.
The option fields are removed from the preview area, considering that
the options are already displayed in the right panel.

task-2232291

closes #138944

Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
@robodoo robodoo closed this Apr 24, 2024
@robodoo robodoo added the 17.3 label Apr 24, 2024
zel-odoo pushed a commit to odoo-dev/odoo that referenced this pull request Apr 29, 2024
This task addresses the limitation where users do not have the option
to choose between a select and radio button when dealing with existing
fields. The goal is to facilitate a more informed choice between the
two based on the number of available options.
A new "Selection Type" option is added, allowing users to choose between
Dropdown List and Radio for fields with a moderate number of options.
The option fields are removed from the preview area, considering that
the options are already displayed in the right panel.

task-2232291

closes odoo#138944

Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
17.3 RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants