Repository navigation
[20.0][MIG] upgrade_analysis - #3748
Conversation
ca1e5e3 to
25da561
Compare
25da561 to
efd79f2
Compare
|
test failure fixed in OCA/oca-addons-repo-template#378 |
| "translate", | ||
| "required", | ||
| "table", | ||
| "_order", |
There was a problem hiding this comment.
isproperty isn't in any of the report_fields lists, so the isproperty branch in report_generic never runs and a field that becomes company dependent without changing type isn't reported. In the current 20.0 analysis sale_delay only shows previously in module stock, but it also became company_dependent (integer column → jsonb), and l10n_eg_eta_code on product.product isn't listed at all.
The same lists in 19.0 don't have it either, so I can send it as a separate fix if you prefer to keep it out of the migration.
Drafted with AI assistance (Claude Opus 5.5), reviewed by me.
There was a problem hiding this comment.
thanks, I've added this and removed the v18-specific part in the stored branch.
product.template#sale_delay and product.product#{qty_available,l10n_eg_eta_code} are now correctly rendered as newly company_dependent
Can be cherry-picked to v19.
There was a problem hiding this comment.
Checked on 029ace4: sale_delay is now reported as company_dependent. I suggested a test for it in tests/test_module.py so it can't get lost again, as happened in 19.0.
mauro2306
left a comment
There was a problem hiding this comment.
Functional test outside CI, on a real-world module set, at efd79f2.
Setup: the 88 modules installed on three production Community databases (account,
account_peppol, account_edi_ubl_cii, l10n_be, sale_stock, stock_account, project…).
Built on the official odoo:19 and odoo:20 Docker images (builds 20261015) rather
than OCB, with PostgreSQL 17. Fresh v19 and v20 databases with that module set, then
upgrade.generate.record.wizard on both, then upgrade.analysis from v20 against v19
over RPC. This is the same sequence as generate-analysis.yml.
Results:
- It works end to end. The xmlid comparison took about 30 s here. That is a subset, so
it says nothing about the 50kres.citycase. - For the 69 modules we share, the generated files match the ones in
20.0-initialize+analysis. The remaining differences have two explanations:- Our module set is smaller. The "moved from" / "renamed to" lines that point to
modules we don't install (website, stock_picking_batch, payment providers) differ. - Odoo 20 has moved since 2026-09-29. For example,
accountis now 20.0.1.6:
account.account._ordernow ends withid, and there is a new view
account.account_move_view_list_stock_closing. That is one more reason to merge
this, so the cron can regenerate the analysis.
- Our module set is smaller. The "moved from" / "renamed to" lines that point to
One issue, pre-existing and not introduced by this PR (see the line comment).
| def _get_remote_model(self, connection, model): | ||
| self.ensure_one() | ||
| if model == "record": | ||
| if float(self.config_id.version) < 14.0: |
There was a problem hiding this comment.
Pre-existing (the same line is in 19.0 and earlier): with the official Odoo packages or
Docker images, the remote server_version is 19.0-20261015. The analysis then crashes:
ValueError: could not convert string to float: '19.0-20261015'
OCB returns 19.0, so CI never hits this. Suggestion, which also covers saas~19.1:
if int(self.config_id.version.split("~")[-1].split(".")[0]) < 14:If you'd rather keep this PR focused, I can open a separate PR against 19.0.
There was a problem hiding this comment.
thanks, I'm using odoorpc.tools.v for parsing the version string now. can be cherry-picked to other versions
efd79f2 to
98536ae
Compare
|
The following commit authors need to sign the Contributor License Agreement: |
carlosdauden
left a comment
There was a problem hiding this comment.
Reviewed at 98536ae against server-tools origin/20.0 and Odoo origin/20.0 (53270b6147ce), commit by commit from the last merged 19.0 state. Thanks for the port and for the xmlid speed-up, the 20.0 analysis is not usable without it. What I checked:
- Every
odoo_patchtarget against Odoo 20.0:BaseModel._convert_records,Registry.init_models,xml_import._test_xml_id,stock.pre_init_hook(still resolved by name at load time) andIrModuleModule.button_immediate_installexist and are called as the patches expect._reflect_constraints/_reflect_table_objectlog the same xmlids as the 19.0_reflect_modelpatch: in 20.0_reflect_constraintonly returns nothing when there is no module, which_reflect_table_objectskips before. Dropping themrppatch is right,_pre_init_mrpis gone in 20.0.depends: webis needed forForm(BaseModel.onchangeraises in base). - The per-model
compare_xml_setsgives the same result as before:compare_recordsmatches models throughmodel_rename_map, so a merged model never matched in the old code either, and none of the merged source models in the 20.0 apriori (ir.model.access,ir.rule,res.bank,stock.scrap,hr.leave.type,crm.lead2opportunity.partner) exists in 20.0. odoorpc.tools.v(0.10.1) parses19.0-20261015,saas~19.1andtest~19.0-testas expected, so mauro2306's crash is fixed.- Tests, in a throwaway container (
oca-ci/py3.12-odoo20.0, PostgreSQL 16, Odoo origin/20.0): all green with odoorpc 0.10.1 from PyPI,test_connection_api_keyskipped. With odoorpc master and theskipIfremoved,test_connection_api_keypasses too. - CI: the module tests pass (11 tests, 0 failed). The red "test with Odoo/OCB" is only the
html_editorSCSS warning, which origin/20.0 already ignores since the copier update to v1.48 (your OCA/oca-addons-repo-template#378).
Changes I would ask for:
-
Rebase on origin/20.0.
requirements.txtconflicts (add/add: origin/20.0 now listscryptography,paramiko<4.0.0,pysftp), and the rebase bringschecklog-odoo.cfgfrom template v1.48, which turns the test jobs green. -
security/ir.access.csv:upgrade.recordandupgrade.attributewere read-only in 19.0 (1,0,0,0) and are nowcru. Their.model.access->ir.accessconversion for1,0,0,0isr(valid inCRUD_SELECTION, and whatodoo/upgrade_code/19.4-00-ir-access.pyproduces). Nothing in the module writes these records through the ORM as a user (the wizard andupgrade_loguse SQL), so admins should not get create/edit rights on generated data. Please userfor both. -
test_connection_api_keynever runs:odoorpc.__version__ <= "0.10.1"is true for the PyPI release and also for odoorpc master, which already has the JSON-2 support (OCA/odoorpc#109) but still declares0.10.1. It is also a string comparison ("0.9.0" <= "0.10.1"is false). Checking the feature instead works with every version, e.g."api_key" in inspect.signature(odoorpc.ODOO.login).parameters. The same check inget_connectionwould give a clearUserErrorwhen an API key is filled with an odoorpc without support; today it fails withlogin() got an unexpected keyword argument 'api_key'. -
The last 19.0 commit is missing: 8960605 "[19.0][FIX] upgrade_analysis: update usage documentation link".
readme/USAGE.mdstill points toanalyse.htmlinstead of070_migration_files.html#generate-the-difference-analysis-files. -
models/upgrade_analysis.py:124:_logger.exception("Could not open file {logfile} for writing")lost itsfprefix in the migration commit, so the log shows{logfile}literally._logger.exception("Could not open file %s for writing", logfile).
Not blocking, can be follow-ups:
-
No test covers the
ispropertyreporting added in 3fa3f7a (now company_dependent/not company_dependent anymore). A case intest_field_comparisonlike theselection_keysone would keep it from silently disappearing again, as it did in 19.0. -
test_connectionsearches the remote user with loginadminand takesids[0]. With an API key of another user, or a database withoutadmin, it reports "Connection failed" although the login worked. Reading the name of the connected user (connection.env.uid) avoids that. -
api_keyis a plainCharshown in clear text in the form.password="True"on the field in the view, as for any secret. -
The new test only covers
test_connection(search/read) with an API key. The analysis also callsfield_dump,list_modulesandget_xml_records, which odoorpc turns into JSON-2 keyword calls through the remote/doc-bearerendpoint (api_doc, auto_install in 19.0). Has a full analysis been run with an API key? -
Nits: the
upgrade_log.log_xml_iddocstring still namesIrModelConstraint._reflect_model(), and_loggeris unused inodoo_patch/odoo/addons/base/models/ir_module.py. -
CLA: the bot flags two history commits, abe0291 ([email protected], the 15.0 template noupdate change) and b68e882 ([email protected], the 19.0 doc link). Both are already merged in 19.0 with the same authors, so it is the maintainers' call.
Once this is merged, OCA/OpenUpgrade#6068 needs its analysis regenerated: its files (1faabaf8698) predate 3fa3f7a, e.g. sale/20.0.1.2/upgrade_analysis.txt still lacks the sale_delay company_dependent line that your 20.0-initialize+analysis branch already has.
… 13.0) to OCA/server-tools Based on commit 746b7acbd90d62f9ffe6ee17472a1a3533e36597 (Fri Nov 6 17:18:47 2020 +0100) Co-authored-by: Stefan Rijnhart <[email protected]>
… make the module installable, add readme folders
…y to select some modules, and improve filters, regarding test module with startswith and endswith pattern
Co-authored-by: Stefan Rijnhart <[email protected]>
… (replaced by logger), apply pre-commit rules
…using upgrade-path
[IMP] guess upgrade_path, if config is not set, and openupgrade_scripts is available
Co-authored-by: David Beal <[email protected]>
…anged When a noupdate field set in the previous version is dropped in the current one, only write the reset to noupdate_changes.xml if the value a fresh install would give the field actually differs from the previous value. Otherwise the (noupdate) record already holds the right value and the entry is a no-op.
69e2134 to
029ace4
Compare
|
@carlosdauden please use line based reviews for the remaining points, also in your openupgrade comments. there you can also join existing threads about some specific changes |
carlosdauden
left a comment
There was a problem hiding this comment.
As asked, the remaining points of my previous review as line comments, checked again on 029ace4 (module tests green with odoorpc 0.10.1 and master, with all the suggestions applied). Points 1, 4 and 5 are solved by the rebase. The CLA one (two history commits already merged in 19.0 with the same authors) stays with the maintainers.
| access_upgrade_record,upgrade.record all,model_upgrade_record,base.group_system,cru | ||
| access_upgrade_attribute,upgrade.attribute all,model_upgrade_attribute,base.group_system,cru |
There was a problem hiding this comment.
upgrade.record and upgrade.attribute were read-only in 19.0 (1,0,0,0), and the ir.model.access -> ir.access conversion of that is r (what odoo/upgrade_code/19.4-00-ir-access.py produces). The records are only written by SQL (upgrade_log, the generate wizard), so admins don't need create/edit rights on generated data. The module tests stay green with r.
| access_upgrade_record,upgrade.record all,model_upgrade_record,base.group_system,cru | |
| access_upgrade_attribute,upgrade.attribute all,model_upgrade_attribute,base.group_system,cru | |
| access_upgrade_record,upgrade.record all,model_upgrade_record,base.group_system,r | |
| access_upgrade_attribute,upgrade.attribute all,model_upgrade_attribute,base.group_system,r |
There was a problem hiding this comment.
that's intentional as it makes debugging and development simpler
| @skipIf( | ||
| odoorpc.__version__ <= "0.10.1", | ||
| "Not testing API key functionality of odoorpc for versions <= 0.10.1", | ||
| ) |
There was a problem hiding this comment.
This test never runs: odoorpc.__version__ is 0.10.1 both on PyPI and on master, which already supports API keys (OCA/odoorpc#109), and it is a string comparison ("0.9.0" <= "0.10.1" is False). Checking the feature works with any version: with odoorpc master the test runs and passes, with 0.10.1 from PyPI it is skipped (needs import inspect, see the next comment).
| @skipIf( | |
| odoorpc.__version__ <= "0.10.1", | |
| "Not testing API key functionality of odoorpc for versions <= 0.10.1", | |
| ) | |
| @skipIf( | |
| "api_key" not in inspect.signature(odoorpc.ODOO.login).parameters, | |
| "This version of odoorpc does not support API keys", | |
| ) |
There was a problem hiding this comment.
thanks, added this and below
| api_key = fields.Char( | ||
| help="If you connect to v19+ and your version of odoorpc supports it, " | ||
| "fill in an api key here instead of username and password" | ||
| ) |
There was a problem hiding this comment.
Has a full analysis been run with an API key? The new test covers test_connection (search/read), but the analysis also calls field_dump, list_modules and get_xml_records, which odoorpc turns into JSON-2 keyword calls through the remote /doc-bearer endpoint (api_doc, auto_install in 19.0).
| <field name="password" required="not api_key" /> | ||
| <field | ||
| name="api_key" | ||
| required="not username and not password" | ||
| /> |
There was a problem hiding this comment.
The API key (and the password) are shown in clear text in the form:
| <field name="password" required="not api_key" /> | |
| <field | |
| name="api_key" | |
| required="not username and not password" | |
| /> | |
| <field name="password" password="True" required="not api_key" /> | |
| <field | |
| name="api_key" | |
| password="True" | |
| required="not username and not password" | |
| /> |
There was a problem hiding this comment.
that's intentional, users aren't supposed to connect to anything else than systems with dummy credentials, and masking would make mistakes less obvious
| with self.assertRaises(AssertionError): | ||
| assertInFieldComparison(comparison, "state", "added: [new]") | ||
| with self.assertRaises(AssertionError): | ||
| assertInFieldComparison(comparison, "state", "removed") |
There was a problem hiding this comment.
Nothing covers the isproperty lines of c070a81, and they already got lost once in 19.0. A case next to the selection_keys ones (passes locally):
| assertInFieldComparison(comparison, "state", "removed") | |
| assertInFieldComparison(comparison, "state", "removed") | |
| path_field = next( | |
| field | |
| for field in new_fields | |
| if field["field"] == "upgrade_path" and field["model"] == "upgrade.analysis" | |
| ) | |
| path_field["isproperty"] = "property" | |
| comparison = compare.compare_sets(old_fields, new_fields) | |
| assertInFieldComparison(comparison, "upgrade_path", "now company_dependent") | |
| comparison = compare.compare_sets(new_fields, old_fields) | |
| assertInFieldComparison( | |
| comparison, "upgrade_path", "not company_dependent anymore" | |
| ) |
| - tools/convert.py:xml_import._test_xml_id() | ||
| - odoo/models.py:BaseModel._convert_records() | ||
| - odoo/addons/base/models/ir_model.py:IrModelConstraint._reflect_model() |
There was a problem hiding this comment.
Nit: the callers changed in 20.0.
| - tools/convert.py:xml_import._test_xml_id() | |
| - odoo/models.py:BaseModel._convert_records() | |
| - odoo/addons/base/models/ir_model.py:IrModelConstraint._reflect_model() | |
| - odoo/tools/convert.py:xml_import._test_xml_id() | |
| - odoo/orm/models.py:BaseModel._convert_records() | |
| - odoo/addons/base/models/ir_model.py:IrModelConstraint._reflect_constraints() |
There was a problem hiding this comment.
removed this whole block as it has no value with modern code analysis tools
| import logging | ||
|
|
||
| from odoo.addons.base.models import ir_module | ||
|
|
||
| from .....odoo_patch import OdooPatch | ||
|
|
||
| _logger = logging.getLogger(__name__) | ||
|
|
There was a problem hiding this comment.
Nit: _logger is unused here (same in odoo_patch/odoo/addons/base/models/ir_model.py, hidden by its # ruff: noqa).
| import logging | |
| from odoo.addons.base.models import ir_module | |
| from .....odoo_patch import OdooPatch | |
| _logger = logging.getLogger(__name__) | |
| from odoo.addons.base.models import ir_module | |
| from .....odoo_patch import OdooPatch | |
029ace4 to
195a3b6
Compare
MiquelRForgeFlow
left a comment
There was a problem hiding this comment.
LGTM. Too many changes, so I could ask for you to show an analysis done with this changes, but I think it's unnecessary. If you merge it and I don't like the new analysis files generated, I will do another PR hehe
|
Hey, thanks for contributing! Proceeding to merge this for you. |
|
Congratulations, your PR was merged at b3a799d. Thanks a lot for contributing to OCA. ❤️ |
v20 adds 50k+ res.city records, so I needed to speed up the comparison of xmlids to make this tenable. Also supports jsronrpc2 if the installed version of odoorpc supports it.
Result can be checked at https://github.com/hbrunn/OpenUpgrade/tree/20.0-initialize%2Banalysis/openupgrade_scripts/scripts