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

README HTML generation includes element that Odoo warns is deprecated in 17.0 #94

Closed
aisopuro opened this issue Mar 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@aisopuro
Copy link

aisopuro commented Mar 5, 2024

Module

The failing check is oca-gen-addon-readme.

I encountered the issue when migrating OCA/project/project_template: OCA/project#1245, though it seems this will happen with any module that has a generated static/description/index.html file.

Describe the bug

When upgrading the module in question, Odoo outputs a deprecation warning:

2024-03-05 14:56:06,792 1 WARNING test_project_template py.warnings: /opt/odoo/odoo/addons/base/models/ir_module.py:178: DeprecationWarning: XML declarations in HTML module descriptions are deprecated since Odoo 17, project_template can just have a UTF8 description with not need for a declaration.

(full traceback below).

Removing the <?xml version="1.0" encoding="utf-8"?> from the start of the file makes the deprecation warning go away. However, this fails pre-commit check, and the line is automatically re-introduced.

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. Checkout for example my migration branch
  2. Run pre-commit run -a (all checks should pass or be skipped)
  3. Test the module (I used -u project_template --test-enable --no-http --stop-after-init)
  4. Odoo will give the warning mentioned previously
  5. Remove the xml declaration from the index.html file like Odoo suggests
  6. Test the module again
  7. Odoo will not give any warnings
  8. Run pre-commit run -a

Expected behavior

  • Pre-commit should run without errors at step 8
  • Alternatively, Pre-commit could run with errors in step 2 and warn and/or fix the unnecessary xml-declaration

Additional context

Full warning trace:

2024-03-05 15:47:29,589 1 WARNING test_project_template py.warnings: /opt/odoo/odoo/addons/base/models/ir_module.py:178: DeprecationWarning: XML declarations in HTML module descriptions are deprecated since Odoo 17, project_template can just have a UTF8 description with not need for a declaration.
  File "/usr/local/bin/odoo", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/opt/odoo/setup/odoo", line 8, in <module>
    odoo.cli.main()
  File "/opt/odoo/odoo/cli/command.py", line 66, in main
    o.run(args)
  File "/opt/odoo/odoo/cli/server.py", line 179, in run
    main(args)
  File "/opt/odoo/odoo/cli/server.py", line 172, in main
    rc = odoo.service.server.start(preload=preload, stop=stop)
  File "/opt/odoo/odoo/service/server.py", line 1402, in start
    rc = server.run(preload, stop)
  File "/opt/odoo/odoo/service/server.py", line 579, in run
    rc = preload_registries(preload)
  File "/opt/odoo/odoo/service/server.py", line 1302, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "<decorator-gen-16>", line 2, in new
  File "/opt/odoo/odoo/tools/func.py", line 87, in locked
    return func(inst, *args, **kwargs)
  File "/opt/odoo/odoo/modules/registry.py", line 113, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/opt/odoo/odoo/modules/loading.py", line 476, in load_modules
    processed_modules += load_marked_modules(env, graph,
  File "/opt/odoo/odoo/modules/loading.py", line 364, in load_marked_modules
    loaded, processed = load_module_graph(
  File "/opt/odoo/odoo/modules/loading.py", line 222, in load_module_graph
    module._check()
  File "/opt/odoo/odoo/addons/base/models/ir_module.py", line 842, in _check
    if not module.description_html:
  File "/opt/odoo/odoo/fields.py", line 1207, in __get__
    self.compute_value(recs)
  File "/opt/odoo/odoo/fields.py", line 1389, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/odoo/models.py", line 4867, in _compute_field_value
    fields.determine(field.compute, self)
  File "/opt/odoo/odoo/fields.py", line 102, in determine
    return needle(*args)
  File "/opt/odoo/odoo/addons/base/models/ir_module.py", line 178, in _get_desc
    warnings.warn(

Output of running pre-commit run -a -v when the xml-declaration was removed:

atte@atte-p15v ~/o/c/h/l/project (17.0-mig-project_template)> pre-commit run -a -v
forbidden files......................................(no files to check)Skipped
- hook id: forbidden-files
en.po files cannot exist.............................(no files to check)Skipped
- hook id: en-po-files
init pyproject.toml with whool...........................................Passed
- hook id: whool-init
- duration: 0.04s
Update pre-commit excluded addons........................................Passed
- hook id: oca-update-pre-commit-excluded-addons
- duration: 0.02s

File .coveragerc not found: Skipped

Fix the manifest website key.............................................Passed
- hook id: oca-fix-manifest-website
- duration: 0.02s
Generate addons README files from fragments..............................Failed
- hook id: oca-gen-addon-readme
- duration: 0.28s
- files were modified by this hook
Generate requirements.txt for an addons directory........................Passed
- hook id: oca-gen-external-dependencies
- duration: 0.16s
Checks for Odoo modules..................................................Passed
- hook id: oca-checks-odoo-module
- duration: 0.04s
Checks for .po[t] files..................................................Passed
- hook id: oca-checks-po
- duration: 0.03s
prettier (with plugin-xml)...............................................Passed
- hook id: prettier
- duration: 0.24s



eslint...............................................(no files to check)Skipped
- hook id: eslint
trim trailing whitespace.................................................Passed
- hook id: trailing-whitespace
- duration: 0.03s
fix end of files.........................................................Passed
- hook id: end-of-file-fixer
- duration: 0.03s
debug statements (python)................................................Passed
- hook id: debug-statements
- duration: 0.03s
fix python encoding pragma...............................................Passed
- hook id: fix-encoding-pragma
- duration: 0.02s
check for case conflicts.................................................Passed
- hook id: check-case-conflict
- duration: 0.05s
check docstring is first.................................................Passed
- hook id: check-docstring-first
- duration: 0.03s
check that executables have shebangs.................(no files to check)Skipped
- hook id: check-executables-have-shebangs
check for merge conflicts................................................Passed
- hook id: check-merge-conflict
- duration: 0.04s
check for broken symlinks............................(no files to check)Skipped
- hook id: check-symlinks
check xml................................................................Passed
- hook id: check-xml
- duration: 0.03s
mixed line ending........................................................Passed
- hook id: mixed-line-ending
- duration: 0.04s
ruff.....................................................................Passed
- hook id: ruff
- duration: 0.01s
ruff-format..............................................................Passed
- hook id: ruff-format
- duration: 0.01s

14 files left unchanged

pylint with optional checks..............................................Passed
- hook id: pylint_odoo
- duration: 0.56s
Check for Odoo modules using pylint......................................Passed
- hook id: pylint_odoo
- duration: 0.54s
@aisopuro aisopuro added the bug Something isn't working label Mar 5, 2024
@pedrobaeza
Copy link
Member

It's just the repo doesn't have the latest definition. Done in OCA/project#1244

Just rebase your branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants