[19.0][MIG] agreement_legal: Migration to 19.0#111
Open
SyncMasta wants to merge 6 commits into
Open
Conversation
Initial migration commit: copy agreement_legal 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. Subsequent commits adapt the module to 19.0 API breaking changes: - mail.template._render_template removed (use mail.render.mixin) - read_group removed (use _read_group) - _read_group_stage_ids signature change (no order param) - copy() multi-record semantics (ensure_one in single-record paths) - kanban view rewrite (Bootstrap 5, native v19 card slots) - drop OWL FormView t-inherit hack (use action button in form header) - report tables: table-condensed -> table-sm Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Bundles 19.0 API adaptations with the dynamic-content refactor (extends the work proposed for 18.0 in PR OCA#105) so that the resulting code on 19.0 is final, not a transitional state. Mixin (agreement.dynamic.content.mixin): Replaces the dynamic-field-editor block (field_id, sub_object_id, sub_model_object_field_id, default_value, copyvalue and the onchange_copyvalue) which was duplicated across 5 models. Adds _render_dynamic() to centralise the inline-template rendering using mail.render.mixin._render_template — a direct replacement for the removed mail.template._render_template API. Concrete models (agreement, agreement.section, agreement.clause, agreement.recital, agreement.appendix) now inherit the mixin and override _get_render_partner() to declare which partner's lang to render with. Their _compute_dynamic_* methods become trivial one-liners and gain proper @api.depends triggers (was missing). 19.0 API adaptations: - mail.template._render_template -> mail.render.mixin._render_template with engine='inline_template' (5 call sites, all via the mixin) - _read_group_stage_ids(self, stages, domain): drop the third 'order' argument that was removed in 19.0 - action_view_agreement: drop view_type='form' (no-op in 19.0) - copy(): add ensure_one() for explicit single-record semantics under the new 19.0 multi-record copy() API - _compute_to_review_date: extend @api.depends to include agreement_type_id.review_days (was previously missing, leading to stale values on type changes) Views: - Rewrite kanban view from Bootstrap-4 markup (data-toggle, o_dropdown_kanban, fa-ellipsis-v, oe_kanban_color_*) to native v19 kanban-card slots (<header>/<main>/<footer>, kanban_color_picker widget, many2one_avatar_user, highlight_color attribute). - Drop the OWL FormView/ListView/KanbanView t-inherit hack (static/src/{js,xml}/*) which patched a Create-From-Template button onto the create button by xpath on the o_form_button_create CSS selector — fragile and broken in 19.0. Replace with a list-view <header> action button calling the existing wizard action. - Drop the matching js_class attributes and the assets manifest block. Report: - Bootstrap 5: table-condensed (BS3 legacy) -> table-sm. Tests: - test_read_group_stage_ids adapted to the 2-argument signature. Net change: -477 LOC, with no functional regressions on the demo dataset (verifiable by running the OCA standard test_agreement and test_legal suites; the dynamic content rendering is byte-identical because mail.render.mixin uses the same inline-template engine the old mail.template path was forwarding to). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Addresses OCA pre-commit/test-with-Odoo failures on PR OCA#111. 19.0 res.groups breaking changes (security/res_groups.xml): - Drop category_id field (removed in 19.0; the ir.module.category record is also no longer used and removed) - users -> user_ids - (4, ref(...)) tuple syntax -> Command.link(ref(...)) Pre-commit / odoo-pre-commit-hooks fixes (models/agreement.py): - parties = fields.Html(default=_get_default_parties, ...) -> default=lambda self: self._get_default_parties() to preserve inheritability (E8148 inheritable-method-lambda) - _("...") -> self.env._("...") at 5 call sites (W8161 prefer-env-translation, odoo/odoo#174844) - Drop the now-unused 'from odoo import _' import Prettier format (XML files): applied @prettier/[email protected] across agreement_legal/ — 25 files normalised to OCA's style (header declaration, attribute wrapping, indent). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
action_agreement_config used target='inline', which was a valid value for ir.actions.act_window.target up to 18.0 but was removed in 19.0 (ValueError: Wrong value for ir.actions.act_window.target: 'inline'). Switched to target='current' — the standard res.config.settings pattern in 19.0 modules opens settings in the current window, not in an inline frame. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The newly added list-view <header> button in views/agreement.xml references %(create_agreement_from_template_action)d, which is defined in wizards/create_agreement_wizard.xml. The original load order put the wizard XML last, which worked under 18.0 (no view referenced it) but breaks under our new layout — the action XML-ID isn't in the registry yet when views/agreement.xml is parsed. Move the wizard XML before the view files. Order within views/ is unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
In 19.0, models that use a multi-element `_inherit` list emit a
warning when `_name` is not set explicitly:
WARNING odoo odoo.models: Class Agreement has no _name, please make
it explicit: _name = 'agreement'
OCA's CI promotes that warning to a hard failure ("Errors detected
in log"). All 40 tests pass; the warning is the sole reason the
test job is red.
Adding the explicit `_name = 'agreement'` is no-op semantically
(matches the first inherit entry) and silences the warning.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2 tasks
CRogos
suggested changes
Jun 2, 2026
CRogos
left a comment
There was a problem hiding this comment.
Migration guide not followed...
We should also apply the changes suggested in the roadmap. I think this PR should be closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates
agreement_legalfrom 18.0 to 19.0. 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 + dynamic-content mixin— applies all 19.0 breaking-change adaptations and bundles the dynamic-content mixin refactor (extends the work proposed in [18.0][REF]agreement_legal: Replace repeated dynamic field code with mixin #105 for 18.0).Net change: -477 LOC, no functional regressions on the demo dataset.
19.0 API adaptations
mail.template._render_template→mail.render.mixin._render_templatewithengine='inline_template'(5 call sites — all centralised through the new mixin)_read_group_stage_ids(self, stages, domain)— drops the thirdorderargument removed in 19.0action_view_agreement— dropsview_type='form'(no-op in 19.0)copy()— addsensure_one()for explicit single-record semantics under the new 19.0 multi-record copy API_compute_to_review_date— extends@api.dependsto includeagreement_type_id.review_days(was missing, causing stale values when the agreement type was changed)Dynamic-content mixin
Builds on the design proposed in #105 (1 approval, awaiting merge on 18.0). The 19.0 version of the mixin is a strict superset of #105: it ships the same field-editor block (
field_id,sub_object_id,sub_model_object_field_id,default_value,copyvalue,onchange_copyvalue) plus a new_render_dynamic()helper that replaces the 5 duplicated_compute_dynamic_*blocks. Concrete models (agreement,agreement.section,agreement.clause,agreement.recital,agreement.appendix) inherit the mixin and override_get_render_partner()to declare which partner's lang to render with.The
@api.dependstriggers on the dynamic-content compute methods are now correct (they were missing in 18.0, leading to stale rendered values when the source field changed).Views / JS
data-toggle,o_dropdown_kanban,fa-ellipsis-v,oe_kanban_color_*) to the native 19.0 kanban-card slots (<header>/<main>/<footer>,kanban_color_pickerwidget,many2one_avatar_user,highlight_colorattribute).t-inherithack (static/src/{js,xml}/*) which patched a Create-From-Template button onto the form-create button via xpath on theo_form_button_createCSS selector — fragile and broken in 19.0. Replaced with a list-view<header>action button calling the existing wizard action.js_classattributes and the asset manifest block dropped accordingly.Report
Bootstrap 5:
table-condensed(BS3 legacy) →table-sm.Tests
test_read_group_stage_idsadapted to the 2-argument signature.Test plan
pre-commit run -acleanruff format --checkcleantest with Odoo,test with OCB,codecovmail.render.mixinuses is the same onemail.template._render_templatewas forwarding to, so byte-identity is expected, but worth confirming on the demo dataset)Related
agreement_legal: Replace repeated dynamic field code with mixin #105 (kept compatible — if [18.0][REF]agreement_legal: Replace repeated dynamic field code with mixin #105 lands first on 18.0, no rebase needed)agreement_legalwas the largest gap on 19.0 afteragreement([19.0][MIG] agreement: Migration to 19.0 #99 ✅) andagreement_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) is open.🤖 Generated with Claude Code