[18.0][REF] agreement_legal: Replace repeated dynamic field code with mixin#105
Open
tarteo wants to merge 1 commit into
Open
[18.0][REF] agreement_legal: Replace repeated dynamic field code with mixin#105tarteo wants to merge 1 commit into
agreement_legal: Replace repeated dynamic field code with mixin#105tarteo wants to merge 1 commit into
Conversation
Contributor
CRogos
approved these changes
Feb 26, 2026
agreement_legal: Replace repeated dynamic field code with mixin
fd16a39 to
d6074c7
Compare
5 tasks
SyncMasta
added a commit
to SyncMasta/agreement
that referenced
this pull request
May 2, 2026
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) <noreply@anthropic.com>
4 tasks
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.
We can also move the rendering to the mixin