Repository navigation
[18.0][FIX] membership_extension: adhered start date default evaluated when the server starts - #240
Open
parabol123654 wants to merge 1 commit into
Conversation
… 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.
Contributor
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.
The default of
membership_start_adheredonres.partnerisfields.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:
The fix uses
fields.Date.context_todayas 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).