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
[ADD] web_widget_child_selector #1430
Conversation
There was a problem hiding this 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'))] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
80c8007
to
a9b9c80
Compare
Comments attended @jarroyomorales |
web_widget_child_selector/static/src/js/widget_child_selector.js
Outdated
Show resolved
Hide resolved
web_widget_child_selector/static/src/js/widget_child_selector.js
Outdated
Show resolved
Hide resolved
a9b9c80
to
d3fbfc9
Compare
There was a problem hiding this 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?
There was a problem hiding this 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"/>
and
<field name="categ_id" string="Product Category" widget="child_selector" options="{"child_selection_field": "name"}"/>
And everything works fine
Thanks for this new widget
This PR has the |
This is already on 12.0 @OCA/web-maintainers , How should we proceed? |
/ocabot merge patch |
Hey, thanks for contributing! Proceeding to merge this for you. |
Congratulations, your PR was merged at 5cae192. Thanks a lot for contributing to OCA. ❤️ |
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.
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.