Bug 265957 - finance/odoo broken
Summary: finance/odoo broken
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Jose Alonso Cardenas Marquez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-20 15:41 UTC by Tobias Bölz
Modified: 2022-09-30 16:04 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (acm)


Attachments
Back out py-werkzeug016 (1.88 KB, application/x-gzip)
2022-08-22 14:29 UTC, Wen Heping
no flags Details
Patch to Makefile to fix the issue (558 bytes, patch)
2022-09-23 20:33 UTC, Dimitri Kaparis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Bölz 2022-08-20 15:41:08 UTC
After installing finance/odoo, on startup the error `AttributeError: module 'werkzeug.routing' has no attribute 'NumberConverter'` is logged.

Every request returns an Internal Server Error and the following is logged:

```
 2022-08-20 15:37:04,038 17915 INFO odoodb werkzeug: 127.0.0.1 - - [20/Aug/2022 15:37:04] "GET / HTTP/1.1" 500 - 1 0.001 0.004
2022-08-20 15:37:04,041 17915 ERROR odoodb werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/werkzeug/serving.py", line 335, in run_wsgi
    execute(self.server.app)
  File "/usr/local/lib/python3.9/site-packages/werkzeug/serving.py", line 322, in execute
    application_iter = app(environ, start_response)
  File "/usr/local/lib/python3.9/site-packages/odoo/service/server.py", line 441, in app
    return self.app(e, s)
  File "/usr/local/lib/python3.9/site-packages/odoo/service/wsgi_server.py", line 123, in application
    return application_unproxied(environ, start_response)
  File "/usr/local/lib/python3.9/site-packages/odoo/service/wsgi_server.py", line 98, in application_unproxied
    result = odoo.http.root(environ, start_response)
  File "/usr/local/lib/python3.9/site-packages/odoo/http.py", line 1306, in __call__
    return self.dispatch(environ, start_response)
  File "/usr/local/lib/python3.9/site-packages/odoo/http.py", line 1272, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/local/lib/python3.9/site-packages/werkzeug/middleware/shared_data.py", line 247, in __call__
    return self.app(environ, start_response)
  File "/usr/local/lib/python3.9/site-packages/odoo/http.py", line 1463, in dispatch
    ir_http = request.registry['ir.http']
  File "/usr/local/lib/python3.9/site-packages/odoo/modules/registry.py", line 177, in __getitem__
    return self.models[model_name]
KeyError: 'ir.http' - - -
2022-08-20 15:37:11,549 17915 ERROR odoodb odoo.sql_db: bad query: SELECT latest_version FROM ir_module_module WHERE name='base'
ERROR: relation "ir_module_module" does not exist
LINE 1: SELECT latest_version FROM ir_module_module WHERE name='base...
                                   ^

2022-08-20 15:37:11,550 17915 WARNING ? odoo.addons.base.models.ir_cron: Tried to poll an undefined table on database odoodb.
2022-08-20 15:37:14,581 17915 ERROR odoodb odoo.sql_db: bad query: SELECT latest_version FROM ir_module_module WHERE name='base'
ERROR: relation "ir_module_module" does not exist
LINE 1: SELECT latest_version FROM ir_module_module WHERE name='base...
                                   ^

2022-08-20 15:37:14,582 17915 WARNING ? odoo.addons.base.models.ir_cron: Tried to poll an undefined table on database odoodb.
```

It looks like [Odoo requires Werkzeug 0.16][1] and doesn't work with version 2 from ports.

[1]: https://www.odoo.com/forum/help-1/attributeerror-module-werkzeug-routing-has-no-attribute-numberconverter-207496
Comment 1 Wen Heping freebsd_committer freebsd_triage 2022-08-22 14:08:16 UTC
 even update to 15.0, it still require Werkzeug==0.16.1 when python_version <= '3.9'
Comment 2 Wen Heping freebsd_committer freebsd_triage 2022-08-22 14:29:09 UTC
Created attachment 236066 [details]
Back out py-werkzeug016

I create www/py-werkzeug016.
Would you deinstall www/werkzeug and install www/py-werkzeug016, and have a new test ?
If it work well , I shall imort www/py-werkzeug016 into portstree.

wen
Comment 3 Tobias Bölz 2022-08-25 07:07:10 UTC
(In reply to Wen Heping from comment #2)

With your py-werkzeug016 it seems to work fine.

However, it did log the following critical error related to Werkzeug during `service odoo inittdb`:

```
2022-08-25 06:32:39,731 56261 CRITICAL odoodb odoo.service.server: Failed to initialize database `odoodb`.
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/odoo/service/server.py", line 1199, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)                                                          File "/usr/local/lib/python3.9/site-packages/odoo/modules/registry.py", line 89, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/local/lib/python3.9/site-packages/odoo/modules/loading.py", line 458, in load_modules
    processed_modules += load_marked_modules(cr, graph,                                                                   File "/usr/local/lib/python3.9/site-packages/odoo/modules/loading.py", line 346, in load_marked_modules
    loaded, processed = load_module_graph(                                                                                File "/usr/local/lib/python3.9/site-packages/odoo/modules/loading.py", line 178, in load_module_graph
    load_openerp_module(package.name)                                                                                     File "/usr/local/lib/python3.9/site-packages/odoo/modules/module.py", line 385, in load_openerp_module
    __import__('odoo.addons.' + module_name)                                                                              File "/usr/local/lib/python3.9/site-packages/odoo/addons/web_editor/__init__.py", line 4, in <module>
    from . import controllers
  File "/usr/local/lib/python3.9/site-packages/odoo/addons/web_editor/controllers/__init__.py", line 4, in <module>
    from . import main
  File "/usr/local/lib/python3.9/site-packages/odoo/addons/web_editor/controllers/main.py", line 20, in <module>
    from ..models.ir_attachment import SUPPORTED_IMAGE_MIMETYPES                                                          File "/usr/local/lib/python3.9/site-packages/odoo/addons/web_editor/models/__init__.py", line 4, in <module>
    from . import ir_attachment
  File "/usr/local/lib/python3.9/site-packages/odoo/addons/web_editor/models/ir_attachment.py", line 4, in <module>
    from werkzeug.urls.urls import url_quote                                                                            ModuleNotFoundError: No module named 'werkzeug.urls.urls'; 'werkzeug.urls' is not a package
```
Comment 4 Wen Heping freebsd_committer freebsd_triage 2022-08-25 08:20:50 UTC
(In reply to Tobias Bölz from comment #3)
Seems we have to downgrade werkzeug ?
Comment 5 Jose Alonso Cardenas Marquez freebsd_committer freebsd_triage 2022-08-27 04:44:24 UTC
(In reply to Tobias Bölz from comment #0)
Hi, try the following:

# Edit odoo/addons/base/models/ir_http.py
# Replace class SignedIntConverter(werkzeug.routing.NumberConverter): to 
class SignedIntConverter(werkzeug.routing.converters.NumberConverter):

It should fix issue reported by you with version of werkzeug in ports tree

I'll update odoo 14 to latest version and I will add odoo 15 to ports tree as soon as possibly

Tell me if it works for you
Comment 6 Wen Heping freebsd_committer freebsd_triage 2022-08-27 06:53:46 UTC
(In reply to Jose Alonso Cardenas Marquez from comment #5)
It is a better way than adding www/py-werkzeug016.
Comment 7 Jose Alonso Cardenas Marquez freebsd_committer freebsd_triage 2022-08-27 19:41:30 UTC
Hi, I have updated finance/odoo to 15.0 and I added finance/odoo 14 to ports tree. This issues should is fixed. Please test it and feel free to reopen this PR if you found another issues related to werkzeug
Comment 8 Dimitri Kaparis 2022-09-23 20:28:38 UTC
Installing the current 15.0 version of py39-odoo package gives me the same `NumberConverter` as originally reported.

It seems the current port does not apply the changes proposed in comment #5.
Comment 9 Dimitri Kaparis 2022-09-23 20:33:19 UTC
Created attachment 236776 [details]
Patch to Makefile to fix the issue

This patch applies to source the changes proposed in comment #5 and should solve the issue.
Comment 10 Dimitri Kaparis 2022-09-30 16:04:26 UTC
(In reply to Jose Alonso Cardenas Marquez from comment #7)

After applying the patch to run with current Werkzeug I was able to install and run the port. However, I'm encountering another issue: when attempting to export products the front end generates an error message: `TypeError: invalid parameter format`.

The same issue is reported at https://github.com/odoo/odoo/issues/94110 and there a user comments it's caused by using a newer version of the Werkzeug module.