community_membership: - Tiers get a fixed-term period (term_years), minimum age, a proof-document flag, a family-member flag and a signup description. - Members get first/last name (composing the contact name), month and year of birth with computed age, board approval state with approve/reject buttons, terms acceptance, a proof-of-eligibility upload and an inline family members list. Birth date and proof document are restricted to Membership Managers. - Constraints: plausible birth year; a tier's minimum age is enforced when the birth year is known. - Fix pre-existing tests that collided with deployment-seeded tier codes and member ID format. tncsc_deployment: - Five Yes/No eligibility questions from the tncsc.com registration form (manager-only), shown in an Eligibility section of the member form. - Tiers now match tncsc.com/membership-registration: Annual/Family $30, Long-Term (10 yr) $250, Life $500, Senior Annual (65+) $15, Senior Life (60+) $250, Student Annual $10 (CAD). - 19.0.1.1.0 post-migrate rewrites existing tiers (noupdate data) and archives the unused Individual tier. scripts/migrate_wp_members.py maps WordPress levels to the new LONG and SENLIFE tiers. .mcp.json (holds credentials) is now gitignored. Verified on the local Docker stack: -u on tncsc_site ran the migration cleanly, and a fresh install with --test-enable passed 32/32 tests for community_membership and tncsc_deployment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.8 KiB
Python
43 lines
1.8 KiB
Python
"""Bring an existing database's membership tiers in line with the six plans
|
|
on tncsc.com/membership-registration.
|
|
|
|
data/membership_data.xml is noupdate="1", so an upgrade creates the new
|
|
tiers (Long-Term, Senior Life Term) but leaves existing ones untouched.
|
|
This script rewrites those, and archives the old "Individual" tier, which
|
|
TNCSC doesn't offer. Archiving, not deleting, keeps it on any member
|
|
already holding it.
|
|
"""
|
|
from odoo import SUPERUSER_ID, api
|
|
|
|
TIER_VALUES = {
|
|
'membership_tier_family': {
|
|
'name': 'Annual/Family', 'price': 30.0, 'period': 'annual', 'sequence': 10,
|
|
'allows_family_members': True, 'min_age': 0, 'requires_proof': False,
|
|
'description': 'Covers the member, his/her spouse and kids living at the same address.',
|
|
},
|
|
'membership_tier_life': {
|
|
'name': 'Life Term Membership', 'price': 500.0, 'period': 'one_time', 'sequence': 30,
|
|
},
|
|
'membership_tier_senior': {
|
|
'name': 'Senior Annual Membership', 'price': 15.0, 'period': 'annual', 'sequence': 40,
|
|
'min_age': 65, 'requires_proof': True,
|
|
'description': 'For seniors over 65 years. Documents may be requested to confirm.',
|
|
},
|
|
'membership_tier_student': {
|
|
'name': 'Student Annual Membership', 'price': 10.0, 'period': 'annual', 'sequence': 60,
|
|
'requires_proof': True,
|
|
'description': 'For full-time students. Documents may be requested to confirm.',
|
|
},
|
|
}
|
|
|
|
|
|
def migrate(cr, version):
|
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
for xmlid, values in TIER_VALUES.items():
|
|
tier = env.ref(f'tncsc_deployment.{xmlid}', raise_if_not_found=False)
|
|
if tier:
|
|
tier.write(values)
|
|
individual = env.ref('tncsc_deployment.membership_tier_individual', raise_if_not_found=False)
|
|
if individual:
|
|
individual.active = False
|