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

[ADD] web_widget_child_selector #1430

Merged
merged 3 commits into from Oct 8, 2020

Conversation

etobella
Copy link
Member

@etobella etobella commented Nov 7, 2019

This module allows to use a new widget for many2one fields that are made hierarchically.
Now, you can navigate easily between the hierarchy.

When we are using readonly, the behaviour is similar than Many2one, but on edition
we are able to select the parents and childs in order to navigate properly.

imagen

Usage

Use child_selection widget on a field.
If necessary we can use child_selection_field on options in order to define
which field we will show on edition only.
For example, name instead of display_name.

Copy link

@jarroyomorales jarroyomorales left a comment

Choose a reason for hiding this comment

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

Just a couple of comments. It would be nice if you could fix travis warnings regarding js formatting and also add some tests to the python part at least to ensure js gets the correct information.


def _get_record_parents(self, field):
if not self:
return [(False, _('Root'))]

Choose a reason for hiding this comment

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

I guess it is used to be able to set the field to False when using this widget but I think it can cause confusion since the word Root doesnt have anything to do with setting a field to false

Choose a reason for hiding this comment

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

Maybe a good option is to add a X icon next to the name when in edit mode that sets the field to false and we can get rid off that 'Root' element.

<t t-name="FieldChildSelectorChild">
<div class="row">
<div t-foreach="childs" t-as="key" class="col-xs-12">
<button t-att-data-id="childs[key][0]" t-att-data-index="key"

Choose a reason for hiding this comment

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

Maybe a group of radio buttons would be nicer

Choose a reason for hiding this comment

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

imagen

@etobella etobella force-pushed the 11.0-add-web_widget_child_selector branch 3 times, most recently from 80c8007 to a9b9c80 Compare December 17, 2019 16:36
@etobella
Copy link
Member Author

Comments attended @jarroyomorales

@etobella etobella force-pushed the 11.0-add-web_widget_child_selector branch from a9b9c80 to d3fbfc9 Compare January 10, 2020 09:26
Copy link

@jarroyomorales jarroyomorales left a comment

Choose a reason for hiding this comment

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

LGTM now 👍 🍏! Could you please squash the commits?

Copy link
Sponsor

@tonygalmiche tonygalmiche left a comment

Choose a reason for hiding this comment

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

I tested on my computer with this :
<field name="categ_id" string="Product Category" widget="child_selector"/>

image

and
<field name="categ_id" string="Product Category" widget="child_selector" options="{&quot;child_selection_field&quot;: &quot;name&quot;}"/>

And everything works fine

Thanks for this new widget

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@etobella
Copy link
Member Author

etobella commented Oct 8, 2020

This is already on 12.0 @OCA/web-maintainers , How should we proceed?

@legalsylvain
Copy link
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 11.0-ocabot-merge-pr-1430-by-legalsylvain-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 1694897 into OCA:11.0 Oct 8, 2020
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 5cae192. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants