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

upgrade_analysis: Odoo-version #2736

Closed
BartvandenHout opened this issue Oct 16, 2023 · 5 comments
Closed

upgrade_analysis: Odoo-version #2736

BartvandenHout opened this issue Oct 16, 2023 · 5 comments
Labels

Comments

@BartvandenHout
Copy link

Module

upgrade_analysis

Describe the bug

Retrieved Odoo-version

To Reproduce

14.0, 15.0, probably others

Steps to reproduce the behavior:

  1. Perform Analysis

Expected behavior
Work out the correct main version 14.0 even though the retrieved version is formatted as 14.0-20230920

Additional context
models/upgrade_analysis.py

Current code, line 78:
if float(self.config_id.version < 14.0:
return connection.env["openupgrade.record"]
else:
return connection.env["upgrade.record"]

Proposed code:
try:
version, subversion = self.config_id.version.split("-")
except ValueError:
version = self.config_id.version
if float(version) < 14.0:
return connection.env["openupgrade.record"]
else:
return connection.env["upgrade.record"]

@legalsylvain
Copy link
Contributor

legalsylvain commented Oct 16, 2023

could you make a PR ? it will be more readable.

thanks !

@pedrobaeza
Copy link
Member

But it should work as is AFAIK.

@BartvandenHout
Copy link
Author

FYI: using Python 3.9.2 I get this error with current code:

2023-10-16 14:04:37,554 417033 ERROR odoodev3 odoo.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 368, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 357, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 921, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 546, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1328, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1316, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 464, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 451, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons_oe/upgrade_analysis/models/upgrade_analysis.py", line 130, in analyze
RemoteRecord = self._get_remote_model(connection, "record")
File "/usr/lib/python3/dist-packages/odoo/addons_oe/upgrade_analysis/models/upgrade_analysis.py", line 78, in _get_remote_model
if float(self.config_id.version) < 14.0:
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 654, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: could not convert string to float: '14.0-20230920'

@pedrobaeza
Copy link
Member

OK, true. String comparison should be done instead of converting to float.

@BartvandenHout
Copy link
Author

We'll be setting up a specific development-server for OCA-modules in a couple of weeks. That way I can work (cleanly) on OCA addons using github. But for now this is the only way I can help. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants