Skip to content

[18.0][FIX] membership_extension: adhered start date default evaluated when the server starts - #240

Open
parabol123654 wants to merge 1 commit into
OCA:18.0from
parabol123654:18.0-fix-membership_extension-adhered-start
Open

parabol123654 wants to merge 1 commit into
OCA:18.0from
parabol123654:18.0-fix-membership_extension-adhered-start

Conversation

@parabol123654

Copy link
Copy Markdown

The default of membership_start_adhered on res.partner is fields.Date.today(). The call runs once, when the module is imported, so every partner created later gets the day the Odoo server (or worker) was started. For an adhered member this date becomes the Membership Start Date, so it is wrong as soon as the server has been running for more than a day.

Steps to reproduce:

  1. Start Odoo on day D.
  2. On day D+3, create a contact, set an associate member and tick Adhered member.
  3. Membership Start Date is D.

The fix uses fields.Date.context_today as the default.

The new test (the test class is frozen on 2025-01-01) creates an adhered member. Without the fix it fails with datetime.date(2026, 10, 31) != FakeDate(2025, 1, 1).

… the server starts

fields.Date.today() was called when the module was imported, so new
adhered members got the date the Odoo server was started as their
membership start date.
@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

@OCA-git-bot OCA-git-bot added series:18.0 mod:membership_extension Module membership_extension labels Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:membership_extension Module membership_extension series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants