-
Notifications
You must be signed in to change notification settings - Fork 51
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] fields/make_field_non_stored #208
Open
Pirols
wants to merge
1
commit into
odoo:master
Choose a base branch
from
odoo-dev:master-clean_filters_upon_fields_column_removal-pied
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[ADD] fields/make_field_non_stored #208
Pirols
wants to merge
1
commit into
odoo:master
from
odoo-dev:master-clean_filters_upon_fields_column_removal-pied
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
d0b39e6
to
b3e11b4
Compare
KangOl
reviewed
Feb 6, 2025
8671cfa
to
8eacb4e
Compare
aj-fuentes
reviewed
Feb 6, 2025
a714f59
to
8cf7e6b
Compare
upgradeci retry with always only hr |
a907eb2
to
48c597c
Compare
80b7c06
to
d666964
Compare
6b686df
to
24d1103
Compare
aj-fuentes
reviewed
Feb 13, 2025
opw-4502675 When a field becomes non-stored, the associated column must be removed during the upgrade. Unless the field remains selectable, such removal will cause `ir.filters` relying on such field to fail. This commit introduces a new util to clean up user-defined filters. In order to do that, the relevant part of the `remove_field` util is factored out into a new private method. --- Example of problem, with reproducer: `account.account`'s `group_id` field has become non-stored[^1] in 18.0, therefore: 1. Create db in 17.0, with `account` installed; 2. Create user-defined default filter on model `account.account`, with domain containing `group_id`. Example: `{"group_by", ["group_id"]}`; 3. Upgrade db to 18.0 4. Open chart of account (and select filter, if not automatically selected) Error should look something like the following: ``` RPC_ERROR Odoo Server Error Occured on localhost:8069 on model account.account and id 6 on 2025-02-06 09:34:41 GMT Traceback (most recent call last): File "/home/odoo/src/odoo/18.0/odoo/http.py", line 1957, in _transactioning return service_model.retrying(func, env=self.env) File "/home/odoo/src/odoo/18.0/odoo/service/model.py", line 137, in retrying result = func() File "/home/odoo/src/odoo/18.0/odoo/http.py", line 1924, in _serve_ir_http response = self.dispatcher.dispatch(rule.endpoint, args) File "/home/odoo/src/odoo/18.0/odoo/http.py", line 2172, in dispatch result = self.request.registry['ir.http']._dispatch(endpoint) File "/home/odoo/src/odoo/18.0/odoo/addons/base/models/ir_http.py", line 329, in _dispatch result = endpoint(**request.params) File "/home/odoo/src/odoo/18.0/odoo/http.py", line 727, in route_wrapper result = endpoint(self, *args, **params_ok) File "/home/odoo/src/odoo/18.0/addons/web/controllers/dataset.py", line 35, in call_kw return call_kw(request.env[model], method, args, kwargs) File "/home/odoo/src/odoo/18.0/odoo/api.py", line 517, in call_kw result = getattr(recs, name)(*args, **kwargs) File "/home/odoo/src/odoo/18.0/addons/web/models/models.py", line 243, in web_read_group groups = self._web_read_group(domain, fields, groupby, limit, offset, orderby, lazy) File "/home/odoo/src/odoo/18.0/addons/web/models/models.py", line 269, in _web_read_group groups = self.read_group(domain, fields, groupby, offset=offset, limit=limit, File "/home/odoo/src/odoo/18.0/odoo/models.py", line 2858, in read_group rows = self._read_group(domain, annotated_groupby.values(), annotated_aggregates.values(), offset=offset, limit=limit, order=orderby) File "/home/odoo/src/odoo/18.0/odoo/models.py", line 1973, in _read_group groupby_terms: dict[str, SQL] = { File "/home/odoo/src/odoo/18.0/odoo/models.py", line 1974, in <dictcomp> spec: self._read_group_groupby(spec, query) File "/home/odoo/src/odoo/18.0/odoo/models.py", line 2090, in _read_group_groupby sql_expr = self._field_to_sql(self._table, fname, query) File "/home/odoo/src/odoo/18.0/addons/account/models/account_account.py", line 184, in _field_to_sql return super()._field_to_sql(alias, fname, query, flush) File "/home/odoo/src/odoo/18.0/odoo/models.py", line 2946, in _field_to_sql raise ValueError(f"Cannot convert {field} to SQL because it is not stored") ValueError: Cannot convert account.account.group_id to SQL because it is not stored The above server error caused the following client error: OwlError: An error occured in the owl lifecycle (see this Error's "cause" property) Error: An error occured in the owl lifecycle (see this Error's "cause" property) at handleError (http://localhost:8069/web/assets/fd2cc33/web.assets_web.min.js:959:101) at App.handleError (http://localhost:8069/web/assets/fd2cc33/web.assets_web.min.js:1610:29) at ComponentNode.initiateRender (http://localhost:8069/web/assets/fd2cc33/web.assets_web.min.js:1051:19) Caused by: RPC_ERROR: Odoo Server Error RPC_ERROR at makeErrorFromResponse (http://localhost:8069/web/assets/fd2cc33/web.assets_web.min.js:3134:163) at XMLHttpRequest.<anonymous> (http://localhost:8069/web/assets/fd2cc33/web.assets_web.min.js:3139:13) ``` [^1]: https://github.com/odoo/upgrade/blob/6197269809a7007fd7eadfc8fb6d2c6a83bc5ca4/migrations/account/saas~17.5.1.2/pre-migrate.py#L97
24d1103
to
1cf294b
Compare
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.
opw-4502675
When a field becomes non-stored, the associated column must be removed during the upgrade.
Such removal may cause user-defined filters relying on such field to fail.
This commit factors the logic to clean fields' references in
ir.filters
out fromremove_field
into a new private helper method, which is then reused inremove_column
, preventing the above mentioned issue.Example of problem, with reproducer:
account.account
'sgroup_id
field has become non-stored1 in 18.0, therefore:account
installed;account.account
, with domain containinggroup_id
. Example:{"group_by", ["group_id"]}
;Error should look something like the following:
Footnotes
https://github.com/odoo/upgrade/blob/6197269809a7007fd7eadfc8fb6d2c6a83bc5ca4/migrations/account/saas~17.5.1.2/pre-migrate.py#L97 ↩