[19.0][MIG] agreement_account: Migration to 19.0 - #112
Conversation
Initial migration commit: copy agreement_account from 18.0 with manifest bumped to 19.0.1.0.0 and an empty migrations/19.0.1.0.0/pre-migration.py to mark the version step explicitly. This commit is intentionally functionality-equivalent to the 18.0 state. The follow-up commit applies the 19.0 API breaking changes (read_group to _read_group on the agreement._compute_invoice_count compute method). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
read_group has been removed in 19.0. Migrated _compute_invoice_count
in agreement.py from the old (domain, fields, groupby) tuple form to
the new _read_group(domain, groupby=, aggregates=) form, which returns
recordset tuples directly:
# 18.0
rg = aio.read_group(domain, ['agreement_id'], ['agreement_id'])
data = {x['agreement_id'][0]: x['agreement_id_count'] for x in rg}
# 19.0
rg = aio._read_group(domain, groupby=['agreement_id'],
aggregates=['__count'])
data = {agreement.id: count for agreement, count in rg}
Also: prettier @prettier/plugin-xml@3.4.2 normalisation across the
view files and readme/, no semantic XML changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The XML ID 'account.account_management_menu' was removed in Odoo 19.0
(ValueError: External ID not found in the system: account.account_
management_menu). The 18.0 menu was a top-level 'Management' entry
under group_account_manager.
In 19.0 the Account top-level structure was reorganised:
- account.account_management_menu — gone
- account.account_reports_management_menu — under Reports tree
- account.menu_finance_configuration — top-level 'Configuration'
under group_account_manager
Choosing menu_finance_configuration: it's the semantic equivalent
(top-level, Account-Manager-only) and is the right home for the
agreement-type setup action this menu hosts.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The parent view account.view_account_invoice_filter no longer wraps its group-by filters in <group expand="0">; in 19.0 the container is a plain <group> with no attributes. The 18.0 inheritance form <group expand="0" position="inside"> cannot locate that element and fails with ParseError: Element '<group expand="0">' cannot be located in parent view Switch to a positional xpath that matches the first group inside the search element, which is the group-by container regardless of whether it carries an expand attribute. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
/ocabot migration agreement_account |
max3903
left a comment
There was a problem hiding this comment.
Review summary
Solid 19.0 migration overall — read_group → _read_group, menu rename to account.menu_finance_configuration, and the search xpath fix all look correct. CI is green.
A few items should be cleaned up before merge:
Requested changes
-
Remove empty
migrations/19.0.1.0.0/pre-migration.py
OCA’s 19.0 guide asks to dropmigrations/when there is no schema work. This file is only a docstring (nomigrate(cr, version)). Prefer deleting the folder entirely. -
Strengthen
test_compute_invoice_count
The test never creates invoices, so it does not protect the_read_groupmapping — the only real 19.0 API change. Please create at least one customer invoice and one vendor bill linked to an agreement and assert the counts. -
setUpClass(self)→setUpClass(cls)
Works by accident on a classmethod, but it should use the conventionalclsparameter.
Non-blocking / nit
- PR body: this module does not depend on
agreement_legal(#111). Depends are onlyagreement+account(agreementis already on 19.0). Also the body still says “Draft” / “two commits” while the PR is open with 4 commits. - Supplier form xpath
//page/group/group/field[@name='company_id']is fragile on 19.0 (company_idlives inaccounting_info_groupand is multi-company). CI load passed; a more precise xpath would be safer if you touch that view again.
Thanks for the migration!
Summary
Migrates
agreement_accountfrom 18.0 to 19.0. Marked as Draft so OCA CI can validate it without adding review-queue pressure while #111 (agreement_legal) is still pending.Two commits:
init migration— copies the 18.0 source verbatim with the manifest bumped to19.0.1.0.0and an emptymigrations/19.0.1.0.0/pre-migration.pyplaceholder.19.0 API + prettier format— applies the only 19.0 breaking change in this module (read_group→_read_groupat 2 sites in_compute_invoice_count) plus prettier-XML normalisation across the view files.Net change: 1 production code file (
models/agreement.py), 2 view files reformatted.19.0 API adaptation
read_groupwas removed in 19.0; replaced both call sites with_read_groupusing the newgroupby=/aggregates=keyword form, which returns recordset tuples directly:The change is local to
_compute_invoice_counton the inheritedagreementmodel. No other 19.0-API touches were needed (no_()translation calls, nores.groupsrecords, no multi-_inherit, notarget='inline'actions, nolambda-default fields, no wizard/view ordering issues — all the categories that bit us in #111).Dependencies
Test plan
pre-commit,test with Odoo,test with OCB,codecov_read_groupmappingRelated
agreement✅ ([19.0][MIG] agreement: Migration to 19.0 #99)agreement_rebate*✅ ([19.0][MIG] agreement_rebate: Migration to 19.0 #108, [19.0][MIG] agreement_rebate_partner_company_group: Migration to 19.0 #110)agreement_sale🟡 ([19.0][MIG] agreement_sale: Migration to 19.0 #100, open, all checks green)agreement_legal🟡 ([19.0][MIG] agreement_legal: Migration to 19.0 #111, open, all checks green — same author)agreement_account🟡 (this PR)🤖 Generated with Claude Code