Skip to content

[19.0][IMP] membership & membership_variable_period: update membership line data when updating invoice line + code cleaning - #241

Open
arnaudlayec wants to merge 6 commits into
OCA:19.0from
akretion:19.0-membership-imp-lines-create-update-disable
Open

arnaudlayec wants to merge 6 commits into
OCA:19.0from
akretion:19.0-membership-imp-lines-create-update-disable

Conversation

@arnaudlayec

@arnaudlayec arnaudlayec commented Nov 7, 2026 •

Copy link
Copy Markdown

This is mainly a technical code-improvement + bug fix of edge cases
The goal was to reduce the module membership_variable_period to a clean minimum, and put shared code in base membership
Sorry for putting 2 modules in the same PR but they are closely interdependent

Changes in membership

Code refactor:

  • account.move.line: more inheritable for other modules of the repo, especially membership_variable_period
  • add a constrain to ensure 1 membership line per invoice. Even though account.move.membership_line_ids is a O2m, it's like a M2o for business logics.
  • membership.line: simplify _compute_state (more linear to read)

Better manage edge cases like:

  • updating move line's product to another membership product
  • updating move line's product to a non-membership product
  • updating invoice's partner

Changes in membership_variable_period

  • Code is way more light. Removed create and write --> the create/update logics should now live in membership
  • Replaced the logics around dates to set to False by 1 clean _compute method

Inspirations

Note: I can squash some commits if needed

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @yajo, @rafaelbn,
some modules you are maintaining are being modified, check this out!

…move lines

Examples:
- updating invoice's partner moves the membership line to target partner
- updating invoice line's product update the product in membership line (bronze / silver / gold)
- changing the product to a non-membership one in the move line deletes the membership line
@arnaudlayec
arnaudlayec force-pushed the 19.0-membership-imp-lines-create-update-disable branch from 52a255a to b00a635 Compare November 7, 2026 04:48
@OCA-git-bot OCA-git-bot added the mod:membership_variable_period Module membership_variable_period label Nov 7, 2026
@arnaudlayec
arnaudlayec force-pushed the 19.0-membership-imp-lines-create-update-disable branch from b00a635 to 2a678ec Compare November 7, 2026 04:55
@arnaudlayec arnaudlayec changed the title [19.0][IMP] membership: manage move line's update + small refactor [19.0][IMP] membership & membership_variable_period: update membership line data when updating invoice line + small refactor Nov 7, 2026
@arnaudlayec arnaudlayec changed the title [19.0][IMP] membership & membership_variable_period: update membership line data when updating invoice line + small refactor [19.0][IMP] membership & membership_variable_period: update membership line data when updating invoice line + code cleaning Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:membership_variable_period Module membership_variable_period mod:membership Module membership series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants