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
[FIX] base: consider multi_edit="1" views editable #103743
Closed
Closed
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
Since odoo#95729 nodes with a `groups=` are completely removed from the views when the user is not part of the group, instead of being made invisible. In that PR, views have been adapted to add back fields, with invisible="1", when they were required, for instance when they were used in a domain of another field which was still there despite the user is not part of the given group. As `tree` views having `multi_edit="1"` where not considered as editable views, the domain of fields in these views were not validated: - https://github.com/odoo/odoo/blob/1fb8fa16ab7dc298d54f089d7163fb556dbc5fcc/odoo/addons/base/models/ir_ui_view.py#L1460 - https://github.com/odoo/odoo/blob/1fb8fa16ab7dc298d54f089d7163fb556dbc5fcc/odoo/addons/base/models/ir_ui_view.py#L1321-L1322 while they are well required for the web client, in `multi_edit="1"` this is possible to edit relational/many2one field, and therefore it will do `name_search` calls using the domain of the field, and therefore the fields used in these domains must always be present in the views. Without it, a crash in the web client occurs when attempting to edit the relational/many2one field. This revision targets to consider the `multi_edit="1"` tree views as editable, to make the field domains validated as they should be. Hence, views are adapted to add back fields with `invisible="1"` when they are required in domains of other fields.
Before this commit, in a list view in multi_edit mode and editable="0", it was possible to edit a required field with an invalid value. Why: In the PR 101924, we decided to no longer pass readonly/required of fields in non-editable views (if no editable="1"). Solution: To know if a view is editable, you should not only look if it is editable="1" but also if it is multi_edit="1". So we want to pass the readonly/required fields if the view is editable="1" or multi_edit="1". How to reproduce: - Go to a multi_edit="1" and editable="0" list view with at least one required field on the server side - Select the checkbox of the record you want to edit - Edit that field with an invalid value (e.g. clearing a text field) - Click outside the line being edited Before this commit: The record is saved with the invalid value After this commit: An alert dialog is displayed to warn us that the value is invalid. The record returns to readonly mode with the old value.
@moylop260 the Denis' initial explanation is what we are handling in OCA/odoo-pre-commit-hooks#10 |
robodoo rebase-ff |
Merge method set to rebase and fast-forward. |
robodoo
pushed a commit
that referenced
this pull request
Oct 21, 2022
Since #95729 nodes with a `groups=` are completely removed from the views when the user is not part of the group, instead of being made invisible. In that PR, views have been adapted to add back fields, with invisible="1", when they were required, for instance when they were used in a domain of another field which was still there despite the user is not part of the given group. As `tree` views having `multi_edit="1"` where not considered as editable views, the domain of fields in these views were not validated: - https://github.com/odoo/odoo/blob/1fb8fa16ab7dc298d54f089d7163fb556dbc5fcc/odoo/addons/base/models/ir_ui_view.py#L1460 - https://github.com/odoo/odoo/blob/1fb8fa16ab7dc298d54f089d7163fb556dbc5fcc/odoo/addons/base/models/ir_ui_view.py#L1321-L1322 while they are well required for the web client, in `multi_edit="1"` this is possible to edit relational/many2one field, and therefore it will do `name_search` calls using the domain of the field, and therefore the fields used in these domains must always be present in the views. Without it, a crash in the web client occurs when attempting to edit the relational/many2one field. This revision targets to consider the `multi_edit="1"` tree views as editable, to make the field domains validated as they should be. Hence, views are adapted to add back fields with `invisible="1"` when they are required in domains of other fields. Part-of: #103743
moylop260
added a commit
to vauxoo-dev/odoo-pre-commit-hooks
that referenced
this pull request
Oct 24, 2022
moylop260
added a commit
to vauxoo-dev/odoo-pre-commit-hooks
that referenced
this pull request
Oct 24, 2022
moylop260
added a commit
to OCA/odoo-pre-commit-hooks
that referenced
this pull request
Oct 24, 2022
) Related to odoo/odoo#103743 Fix #10 * [REF] tox: Fix missing change
moylop260
added a commit
to vauxoo-dev/pylint-odoo
that referenced
this pull request
Oct 24, 2022
moylop260
added a commit
to vauxoo-dev/pylint-odoo
that referenced
this pull request
Oct 24, 2022
moylop260
added a commit
to OCA/pylint-odoo
that referenced
this pull request
Oct 24, 2022
…419) Related to odoo/odoo#103743 Fix OCA/odoo-pre-commit-hooks#10 Backport of OCA/odoo-pre-commit-hooks#32 to pylint-odoo@7.0
svs-odoo
added a commit
to odoo-dev/odoo
that referenced
this pull request
Nov 4, 2022
Following odoo#103743 Changes the xpath adding the `batch_id` in the picking list view from before `company_id` to after `picking_type_id` because the linked commit added an invisible `company_id` at the start of the list, so the `batch_id` was wrongly placed.
robodoo
pushed a commit
that referenced
this pull request
Nov 4, 2022
Following #103743 Changes the xpath adding the `batch_id` in the picking list view from before `company_id` to after `picking_type_id` because the linked commit added an invisible `company_id` at the start of the list, so the `batch_id` was wrongly placed. closes #104888 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
fw-bot
pushed a commit
to odoo-dev/odoo
that referenced
this pull request
Nov 4, 2022
Following odoo#103743 Changes the xpath adding the `batch_id` in the picking list view from before `company_id` to after `picking_type_id` because the linked commit added an invisible `company_id` at the start of the list, so the `batch_id` was wrongly placed. X-original-commit: d3f6bd6
robodoo
pushed a commit
that referenced
this pull request
Nov 8, 2022
Following #103743 Changes the xpath adding the `batch_id` in the picking list view from before `company_id` to after `picking_type_id` because the linked commit added an invisible `company_id` at the start of the list, so the `batch_id` was wrongly placed. closes #104981 X-original-commit: d3f6bd6 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Steve Van Essche <svs@odoo.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Since #95729
nodes with a
groups=
are completely removed from the views whenthe user is not part of the group, instead of being made invisible.
In that PR, views have been adapted to add back fields, with invisible="1",
when they were required, for instance when they were used in a domain
of another field which was still there despite the user is not part
of the given group.
As
tree
views havingmulti_edit="1"
where not consideredas editable views, the domain of fields in these views were not
validated:
odoo/odoo/addons/base/models/ir_ui_view.py
Line 1460 in 1fb8fa1
odoo/odoo/addons/base/models/ir_ui_view.py
Lines 1321 to 1322 in 1fb8fa1
while they are well required for the web client,
in
multi_edit="1"
this is possible to edit relational/many2one field,and therefore it will do
name_search
calls using the domain of thefield, and therefore the fields used in these domains must always
be present in the views. Without it, a crash in the web client occurs
when attempting to edit the relational/many2one field.
This revision targets to consider the
multi_edit="1"
tree viewsas editable, to make the field domains validated as they should be.
Hence, views are adapted to add back fields with
invisible="1"
when they are required in domains of other fields.