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
[FW][FIX] web: SearchView of many2one is not getting the form domain #163029
Closed
fw-bot
wants to merge
1
commit into
odoo:16.0
from
odoo-dev:16.0-15.0-many2one-domain-fix-aab-aJRc-fw
Closed
[FW][FIX] web: SearchView of many2one is not getting the form domain #163029
fw-bot
wants to merge
1
commit into
odoo:16.0
from
odoo-dev:16.0-15.0-many2one-domain-fix-aab-aJRc-fw
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR targets 16.0 and is part of the forward-port chain. Further PRs will be created up to master. More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
@aab-odoo ci/runbot failed on this forward-port PR |
Steps to reproduce the problem: 1. Add a many2one field to lines of a model, example: sale.order.line 2. Add it to form view of the lines with a domain 3. Click on Search more... option 4. You will see results out of the scope of the domain In the getDomain is passed an object that has only the key fieldName but for knew in what view is the field placed it needs to be provided the key viewType, this both are placed on the class object this.recordParams builded at: https://github.com/odoo/odoo/blob/b8a5175b6c92749bd3bb7b9f869b1ecff78e133f/addons/web/static/src/legacy/js/fields/relational_fields.js#L129 If this key is not provided the viewType is beeing filled with the element viewType, this element is the record opened placed in the parent view, so by default if will be kanban or list. So if the domain is filled just in the form view, the search panel will get the domain [], so all the entries will be displayed and they will be able to be selected. If we see the next line: https://github.com/odoo/odoo/blob/b8a5175b6c92749bd3bb7b9f869b1ecff78e133f/addons/web/static/src/legacy/js/fields/relational_fields.js#L431 We will see that getContext is getting this.recordParams as argument, for the same reason that the domain should have it. With this changes the getDomain method is getting the viewType to take the domain instead of the viewType of the lines displayed on the parent view. X-original-commit: 2506a06 Co-authored-by: Aaron Bohy <aab@odoo.com>
aab-odoo
force-pushed
the
16.0-15.0-many2one-domain-fix-aab-aJRc-fw
branch
from
April 24, 2024 05:59
83388e8
to
e88fd46
Compare
robodoo r+ |
C3POdoo
requested review from
a team,
Iucapad and
juliusc2066
and removed request for
a team
April 24, 2024 06:01
robodoo
pushed a commit
that referenced
this pull request
Apr 24, 2024
Steps to reproduce the problem: 1. Add a many2one field to lines of a model, example: sale.order.line 2. Add it to form view of the lines with a domain 3. Click on Search more... option 4. You will see results out of the scope of the domain In the getDomain is passed an object that has only the key fieldName but for knew in what view is the field placed it needs to be provided the key viewType, this both are placed on the class object this.recordParams builded at: https://github.com/odoo/odoo/blob/b8a5175b6c92749bd3bb7b9f869b1ecff78e133f/addons/web/static/src/legacy/js/fields/relational_fields.js#L129 If this key is not provided the viewType is beeing filled with the element viewType, this element is the record opened placed in the parent view, so by default if will be kanban or list. So if the domain is filled just in the form view, the search panel will get the domain [], so all the entries will be displayed and they will be able to be selected. If we see the next line: https://github.com/odoo/odoo/blob/b8a5175b6c92749bd3bb7b9f869b1ecff78e133f/addons/web/static/src/legacy/js/fields/relational_fields.js#L431 We will see that getContext is getting this.recordParams as argument, for the same reason that the domain should have it. With this changes the getDomain method is getting the viewType to take the domain instead of the viewType of the lines displayed on the parent view. closes #163029 X-original-commit: 2506a06 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
MohammedBasioni
pushed a commit
to odoo-dev/odoo
that referenced
this pull request
Apr 29, 2024
Steps to reproduce the problem: 1. Add a many2one field to lines of a model, example: sale.order.line 2. Add it to form view of the lines with a domain 3. Click on Search more... option 4. You will see results out of the scope of the domain In the getDomain is passed an object that has only the key fieldName but for knew in what view is the field placed it needs to be provided the key viewType, this both are placed on the class object this.recordParams builded at: https://github.com/odoo/odoo/blob/b8a5175b6c92749bd3bb7b9f869b1ecff78e133f/addons/web/static/src/legacy/js/fields/relational_fields.js#L129 If this key is not provided the viewType is beeing filled with the element viewType, this element is the record opened placed in the parent view, so by default if will be kanban or list. So if the domain is filled just in the form view, the search panel will get the domain [], so all the entries will be displayed and they will be able to be selected. If we see the next line: https://github.com/odoo/odoo/blob/b8a5175b6c92749bd3bb7b9f869b1ecff78e133f/addons/web/static/src/legacy/js/fields/relational_fields.js#L431 We will see that getContext is getting this.recordParams as argument, for the same reason that the domain should have it. With this changes the getDomain method is getting the viewType to take the domain instead of the viewType of the lines displayed on the parent view. closes odoo#163029 X-original-commit: 2506a06 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Steps to reproduce the problem:
In the getDomain is passed an object that has only the key fieldName but for knew in what view is the field placed it needs to be provided the key viewType, this both are placed on the class object this.recordParams builded at:
odoo/addons/web/static/src/legacy/js/fields/relational_fields.js
Line 129 in b8a5175
If this key is not provided the viewType is beeing filled with the element viewType, this element is the record opened placed in the parent view, so by default if will be kanban or list. So if the domain is filled just in the form view, the search panel will get the domain [], so all the entries will be displayed and they will be able to be selected.
If we see the next line:
odoo/addons/web/static/src/legacy/js/fields/relational_fields.js
Line 431 in b8a5175
With this changes the getDomain method is getting the viewType to take the domain instead of the viewType of the lines displayed on the parent view.
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #162983