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

Viewtiverse Avengers: add required field (invisible) automatically in views #137031

Closed

Conversation

Gorash
Copy link
Contributor

@Gorash Gorash commented Sep 28, 2023

[IMP] base: required field (from view python expr) are add automatically

Goal:

  • Simplified xml view ;
  • prevent fields from being missing due to forgetfulness or access groups ;
  • Simplified group checking and check the model and field groups.

Fields are added if they appear in python expressions (invisible,
column_invisible, readonly, required, context, domain). Added fields are
invisible and readonly. Some invisible fields are necessary in views for
other reasons such as onchanges.

This commit adds the feature and some examples of view simplification
(removal of invisible fields) and fixes views with bad groups.

Before this commit:
View validation performed a match between the combination of groups on the
required fields and the combination of groups on the fields where they
were used. Validation was only done for groups in xml views and did not
take care of restrictions on the model or fields.

After this commit:
Validation checks if the fields exist on the model and if the groups on
the fields match the combination of groups or values are used.
During post-processing, required fields are added as needed in the view
(cached) as invisible and readonly. These have all the groups for which
it might be required.

Task: Viewtiverse Avengers
task-3414068
task-3482092

@robodoo
Copy link
Contributor

robodoo commented Sep 28, 2023

Pull request status dashboard

@C3POdoo C3POdoo added the RD research & development, internal work label Sep 28, 2023
@Gorash Gorash force-pushed the master-viewtiverse-invisible2-chm branch 6 times, most recently from 094fef2 to 08e3c7f Compare October 5, 2023 14:08
@Gorash Gorash force-pushed the master-viewtiverse-invisible2-chm branch 8 times, most recently from ee4f054 to 79ecace Compare October 11, 2023 09:33
@Gorash Gorash changed the title Master viewtiverse invisible2 chm Viewtiverse Avengers: add required field (invisible) automatically in views Oct 11, 2023
@Gorash Gorash force-pushed the master-viewtiverse-invisible2-chm branch from 1a0ad6f to e76dee0 Compare October 11, 2023 12:52
Gorash added a commit to odoo/documentation that referenced this pull request Oct 12, 2023
@Gorash Gorash force-pushed the master-viewtiverse-invisible2-chm branch from 4fd7794 to e57b9e7 Compare October 12, 2023 08:35
@Gorash Gorash marked this pull request as ready for review October 12, 2023 08:35
@C3POdoo C3POdoo requested review from a team October 12, 2023 08:38
Gorash added a commit to odoo-dev/odoo that referenced this pull request Apr 18, 2024
Since odoo#137031 the invisible fields are
add automatically (invisible and readonly) if they are used by python
expressions in views (invisible, required, readonly, context, domain...).

The mandatory invisible field must be commented just after the field
tag. The comment must indicate what is the technical requirement to be
present. The goal is to clean all views, improve the comprehention of
the addons and remove dead code.

Task-3482092
Task-3864056
@fw-bot fw-bot deleted the master-viewtiverse-invisible2-chm branch April 22, 2024 21:46
robodoo pushed a commit that referenced this pull request Apr 25, 2024
Since #137031 the invisible fields are
add automatically (invisible and readonly) if they are used by python
expressions in views (invisible, required, readonly, context, domain...).

The mandatory invisible field must be commented just after the field
tag. The comment must indicate what is the technical requirement to be
present. The goal is to clean all views, improve the comprehention of
the addons and remove dead code.

Task-3482092
Task-3864056

closes #162009

Related: odoo/upgrade#5923
Related: odoo/enterprise#60811
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
hubvd added a commit to odoo-dev/odoo that referenced this pull request Jun 11, 2024
Steps to reproduce
==================

- Website > Configuration > Payment Providers
- Enable a payment provider, and it will be published by default
- Save your changes
- Observed behavior: the status of the payment provider is Unpublished, even
- though it is published on the website
- When disabling the payment provider, the status will be changes to Published
- If you try to unpublish it, you'll get the message You cannot publish a disabled provider
- Expected behavior: it should be automatically published when enabled, and
- automatically unpublished when disabled. At the moment, the behavior from the
- front-end is okay, but the status of the publish button is wrong.

Cause of the issue
==================

Changes applied to readonly fields are not saved

https://github.com/odoo/odoo/blob/4f325ef620263c27e095eb49026a677ac617a0ee/addons/web/static/src/model/relational_model/record.js#L623-L630

Since odoo#137031 ,
the field has been removed from the view. It is now considered readonly.

Solution
========

Add the field back to the view

opw-3908473
hubvd added a commit to odoo-dev/odoo that referenced this pull request Jun 11, 2024
Steps to reproduce
==================

- Website > Configuration > Payment Providers
- Enable a payment provider, and it will be published by default
- Save your changes
- Observed behavior: the status of the payment provider is Unpublished, even
- though it is published on the website
- When disabling the payment provider, the status will be changes to Published
- If you try to unpublish it, you'll get the message You cannot publish a disabled provider
- Expected behavior: it should be automatically published when enabled, and
- automatically unpublished when disabled. At the moment, the behavior from the
- front-end is okay, but the status of the publish button is wrong.

Cause of the issue
==================

Changes applied to readonly fields are not saved

https://github.com/odoo/odoo/blob/4f325ef620263c27e095eb49026a677ac617a0ee/addons/web/static/src/model/relational_model/record.js#L623-L630

Since odoo#137031 ,
the field has been removed from the view. It is now considered readonly.

Solution
========

Add the field back to the view

opw-3908473
robodoo pushed a commit that referenced this pull request Jun 11, 2024
Steps to reproduce
==================

- Website > Configuration > Payment Providers
- Enable a payment provider, and it will be published by default
- Save your changes
- Observed behavior: the status of the payment provider is Unpublished, even
- though it is published on the website
- When disabling the payment provider, the status will be changes to Published
- If you try to unpublish it, you'll get the message You cannot publish a disabled provider
- Expected behavior: it should be automatically published when enabled, and
- automatically unpublished when disabled. At the moment, the behavior from the
- front-end is okay, but the status of the publish button is wrong.

Cause of the issue
==================

Changes applied to readonly fields are not saved

https://github.com/odoo/odoo/blob/4f325ef620263c27e095eb49026a677ac617a0ee/addons/web/static/src/model/relational_model/record.js#L623-L630

Since #137031 ,
the field has been removed from the view. It is now considered readonly.

Solution
========

Add the field back to the view

opw-3908473

closes #168851

Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
fw-bot pushed a commit to odoo-dev/odoo that referenced this pull request Jun 11, 2024
Steps to reproduce
==================

- Website > Configuration > Payment Providers
- Enable a payment provider, and it will be published by default
- Save your changes
- Observed behavior: the status of the payment provider is Unpublished, even
- though it is published on the website
- When disabling the payment provider, the status will be changes to Published
- If you try to unpublish it, you'll get the message You cannot publish a disabled provider
- Expected behavior: it should be automatically published when enabled, and
- automatically unpublished when disabled. At the moment, the behavior from the
- front-end is okay, but the status of the publish button is wrong.

Cause of the issue
==================

Changes applied to readonly fields are not saved

https://github.com/odoo/odoo/blob/4f325ef620263c27e095eb49026a677ac617a0ee/addons/web/static/src/model/relational_model/record.js#L623-L630

Since odoo#137031 ,
the field has been removed from the view. It is now considered readonly.

Solution
========

Add the field back to the view

opw-3908473

X-original-commit: 08f6307
robodoo pushed a commit that referenced this pull request Jun 12, 2024
Steps to reproduce
==================

- Website > Configuration > Payment Providers
- Enable a payment provider, and it will be published by default
- Save your changes
- Observed behavior: the status of the payment provider is Unpublished, even
- though it is published on the website
- When disabling the payment provider, the status will be changes to Published
- If you try to unpublish it, you'll get the message You cannot publish a disabled provider
- Expected behavior: it should be automatically published when enabled, and
- automatically unpublished when disabled. At the moment, the behavior from the
- front-end is okay, but the status of the publish button is wrong.

Cause of the issue
==================

Changes applied to readonly fields are not saved

https://github.com/odoo/odoo/blob/4f325ef620263c27e095eb49026a677ac617a0ee/addons/web/static/src/model/relational_model/record.js#L623-L630

Since #137031 ,
the field has been removed from the view. It is now considered readonly.

Solution
========

Add the field back to the view

opw-3908473

closes #168966

X-original-commit: 08f6307
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
abya-odoo pushed a commit to odoo-dev/odoo that referenced this pull request Jul 1, 2024
Steps to reproduce
==================

- Website > Configuration > Payment Providers
- Enable a payment provider, and it will be published by default
- Save your changes
- Observed behavior: the status of the payment provider is Unpublished, even
- though it is published on the website
- When disabling the payment provider, the status will be changes to Published
- If you try to unpublish it, you'll get the message You cannot publish a disabled provider
- Expected behavior: it should be automatically published when enabled, and
- automatically unpublished when disabled. At the moment, the behavior from the
- front-end is okay, but the status of the publish button is wrong.

Cause of the issue
==================

Changes applied to readonly fields are not saved

https://github.com/odoo/odoo/blob/4f325ef620263c27e095eb49026a677ac617a0ee/addons/web/static/src/model/relational_model/record.js#L623-L630

Since odoo#137031 ,
the field has been removed from the view. It is now considered readonly.

Solution
========

Add the field back to the view

opw-3908473

closes odoo#168966

X-original-commit: 08f6307
Signed-off-by: Hubert Van De Walle <huvw@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