Skip to content

[19.0][MIG] agreement_legal: Migration to 19.0 + Refactoring - #121

Open
CRogos wants to merge 87 commits into
OCA:19.0from
c4a8-odoo:19.0-ref-agreement_legal
Open

[19.0][MIG] agreement_legal: Migration to 19.0 + Refactoring#121
CRogos wants to merge 87 commits into
OCA:19.0from
c4a8-odoo:19.0-ref-agreement_legal

Conversation

@CRogos

@CRogos CRogos commented Jul 8, 2026

Copy link
Copy Markdown

@tarteo, @ygol, @max3903 I mention you because you were active in #104

I would like to take the opportunity to split the agreement_legal into several modules with the migration to odoo 19.

Changes in agreement and agreement_sale are not part of this PR. There is a separate PR to set the foundations: #122

Currently I've identified the follwing modules:
agreement_legal
agreement_signature
agreement_termination
agreement_legal_content
agreement_product
agreement_revision
agreement_stage
agreement_type

(There is a screenshot in each module, that shoes the change if each module individually)
image

The goal is to keep the current functionality when all modules are installed, but make it possible to only install a subset if the functions.

This PR will replace: #120
This PR depends on: #122

@OCA-git-bot OCA-git-bot added series:19.0 mod:agreement_legal Module agreement_legal mod:agreement_legal_product Module agreement_legal_product mod:agreement_legal_stage Module agreement_legal_stage mod:agreement_legal_revision Module agreement_legal_revision mod:agreement_signature Module agreement_signature mod:agreement_legal_type Module agreement_legal_type mod:agreement_legal_content Module agreement_legal_content mod:agreement_legal_termination Module agreement_legal_termination mod:agreement_termination Module agreement_termination and removed mod:agreement_legal_termination Module agreement_legal_termination labels Jul 8, 2026
@CRogos
CRogos force-pushed the 19.0-ref-agreement_legal branch from fb71bba to de81649 Compare July 8, 2026 20:51
@max3903

max3903 commented Jul 9, 2026

Copy link
Copy Markdown
Member

@CRogos We don't need to split the module. We can use group_* settings to activate/show features.

@CRogos

CRogos commented Jul 9, 2026

Copy link
Copy Markdown
Author

@max3903 I understand your argument, and it is a valid approach. But is this the better solution? It would still blow up the database, and also the complexity of the module is still high.

With the current split it is also possible to use agreement_signature and agreement_termination without agreement_legal. My goal would be to achive this also for agreement_legal_revision, agreement_legal_stage and agreement_legal_type, but I am currently struggling with the access groups.

Do you disagree with splitting the module? (and how strong ;) )

@OCA-git-bot OCA-git-bot added mod:agreement Module agreement mod:agreement_parent Module agreement_parent labels Jul 10, 2026
@CRogos
CRogos force-pushed the 19.0-ref-agreement_legal branch from 4561579 to 3d17e51 Compare July 10, 2026 16:54
@OCA-git-bot OCA-git-bot removed the mod:agreement_parent Module agreement_parent label Jul 10, 2026
@CRogos
CRogos force-pushed the 19.0-ref-agreement_legal branch from 3d17e51 to 0639989 Compare July 10, 2026 17:47
@CRogos
CRogos marked this pull request as ready for review July 10, 2026 18:04
@CRogos
CRogos force-pushed the 19.0-ref-agreement_legal branch from 0639989 to 875197b Compare July 10, 2026 19:12
@OCA-git-bot OCA-git-bot added the mod:agreement_project Module agreement_project label Jul 10, 2026
@max3903

max3903 commented Jul 11, 2026

Copy link
Copy Markdown
Member

@CRogos Yes, I disagree with the split. Experience shows me that:

  1. if you split the module, it will age pretty badly across migrations.
  2. you may be implementing and supporting those modules now, but what about in 1+ year?

When version 20.0 will be released, those 8 modules will not get migrated or they will, but not the way you expect. Worst thing is you may not be available to review those.

Same thing will happen with version 21, 22, etc... as you may not be financed to support them anymore.

So when you will look at those modules in 3+ versions, you will not recognize them: you will think you can use them for a new project and save some money, but you will end up putting the effort again or losing the opportunity or both.

@max3903

max3903 commented Jul 11, 2026

Copy link
Copy Markdown
Member

@CRogos Also, I didn't build the OCA to be a module factory, I built it to provide long-term solutions.

@max3903 max3903 self-assigned this Jul 11, 2026
@max3903 max3903 added this to the 19.0 milestone Jul 11, 2026
@max3903

max3903 commented Jul 11, 2026

Copy link
Copy Markdown
Member

/ocabot migration agreement_legal

@OCA-git-bot OCA-git-bot mentioned this pull request Jul 11, 2026
6 tasks
Saran440 and others added 7 commits July 27, 2026 11:42
Currently translated at 100.0% (263 of 263 strings)

Translation: agreement-18.0/agreement-18.0-agreement_legal
Translate-URL: https://translation.odoo-community.org/projects/agreement-18-0/agreement-18-0-agreement_legal/sv/
Co-authored-by: CRogos <1799080+CRogos@users.noreply.github.com>
Co-authored-by: CRogos <1799080+CRogos@users.noreply.github.com>
Co-authored-by: CRogos <1799080+CRogos@users.noreply.github.com>
@CRogos
CRogos force-pushed the 19.0-ref-agreement_legal branch from f4a1ee7 to 9347661 Compare July 27, 2026 11:44
@OCA-git-bot OCA-git-bot removed mod:agreement Module agreement mod:agreement_sale Module agreement_sale labels Jul 27, 2026
@peluko00

Copy link
Copy Markdown

Hi @CRogos , can you please include this FW #124?

Thank you

@CRogos
CRogos force-pushed the 19.0-ref-agreement_legal branch from 9347661 to 77d6666 Compare July 30, 2026 09:18
@OCA-git-bot OCA-git-bot added the mod:agreement Module agreement label Jul 30, 2026
@CRogos
CRogos force-pushed the 19.0-ref-agreement_legal branch 3 times, most recently from c946cf1 to 62d385a Compare July 30, 2026 12:19
@CRogos
CRogos force-pushed the 19.0-ref-agreement_legal branch from 62d385a to 35a2afd Compare July 30, 2026 12:54
@CRogos

CRogos commented Jul 30, 2026

Copy link
Copy Markdown
Author

@peluko00 could you have a look into the update?
I had some trouble to implement this reset, because child_agreements_ids is now part of agreement_revision which does not depend on agreement_legal and I did not want to move recompute_from_template() to agreement.

If we want to achive this, we maybe need to extract the template part into agreement_template and create additional bridging moduls agreement_revision_template and agreement_product_template?

agreement_revision

    @api.model
    def recompute_from_template(self):
        res = super().recompute_from_template()
        agreements = self.browse(self.env.context.get("active_ids", [])).filtered(
            lambda a: a.template_id
        )
        for agreement in agreements:
            template = agreement.template_id
            agreement.child_agreements_ids.unlink()
            for child in template.child_agreements_ids:
                child.copy({"parent_agreement_id": agreement.id})
            return res

agreement_product

    @api.model
    def recompute_from_template(self):
        res = super().recompute_from_template()
        agreements = self.browse(self.env.context.get("active_ids", [])).filtered(
            lambda a: a.template_id
        )
        for agreement in agreements:
            template = agreement.template_id
            agreement.line_ids.unlink() # product
            for line in template.line_ids:
                line.copy({"agreement_id": agreement.id})
        return res

There is also a lot of improvement potential in agreement_legal_content (which I am not using). I think instead of the "field" placeholders, we should use the email template editor. I think the change is not complicated but the migration script could be more complicated.

@max3903 max3903 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't split. Use group_ settings to achieve the same result.

@CRogos

CRogos commented Jul 31, 2026

Copy link
Copy Markdown
Author

Don't split. Use group_ settings to achieve the same result.

I know you like the group_ solution very much, but I am not convinced to add so many groups. Yes this would bypass the problem, but in my opinion this is not the right way, and only a work around and not solving the problem behind.

Maybe we should move template_id to agreement and activate the template feature by group_ ?

@CRogos
CRogos force-pushed the 19.0-ref-agreement_legal branch 2 times, most recently from 44a9354 to 35a2afd Compare July 31, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

migration mod:agreement_legal_content Module agreement_legal_content mod:agreement_legal Module agreement_legal mod:agreement_product Module agreement_product mod:agreement_project Module agreement_project mod:agreement_revision Module agreement_revision mod:agreement_signature Module agreement_signature mod:agreement_stage Module agreement_stage mod:agreement_termination Module agreement_termination mod:agreement_type Module agreement_type mod:agreement Module agreement needs review series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.