Replaces the Phase 7 "content to be finalized" placeholder pages with TNCSC's actual site content (captured 2026-08-20), verified against a live Odoo container on a dedicated fresh database (tncsc_site): - Home, About, About/Tamil Nadu, About/Board of Directors (12 real members), Membership hub, Membership Benefits, Tamil Class, and Contact pages, with nav restructured to match tncsc.com's real structure (About and Membership as dropdowns). - Real images downloaded from tncsc.com and self-hosted under static/src/img/ instead of hotlinking the WordPress site. - Home's "Upcoming Events" and the membership pricing tables are wired to live event.event / community.membership.tier records instead of being static copies; Tamil Class links to the real /school/register flow. One real event seeded (Summer Picnic 2026). - Deliberately not reproduced: tncsc.com's own Sponsors page and Contact phone number are unmigrated WordPress theme demo placeholders on the live site itself (generic client-01..09 logos, a non-Canadian demo number) - confirmed by inspection, not assumed. Contact page uses the real, verified email and social links instead. - post_init_hook now also fixes two Odoo website Copy-On-Write gotchas that silently prevented the new homepage and nav dropdowns from rendering at all (auto-forked per-website duplicates winning over this module's records) - see HANDOFF.md for the full explanation.
91 lines
4.4 KiB
Python
91 lines
4.4 KiB
Python
from odoo.tests.common import TransactionCase, tagged
|
|
|
|
|
|
@tagged('post_install', '-at_install')
|
|
class TestTncscDeployment(TransactionCase):
|
|
|
|
def setUp(self):
|
|
super().setUp()
|
|
# Deterministic setup for testing: this Odoo build's own chart-
|
|
# template auto-install can race with post_init_hook's call to this
|
|
# same method within the install transaction (see
|
|
# models/res_company.py) - calling it again here, synchronously,
|
|
# from the test's own transaction avoids the test suite being
|
|
# sensitive to that race. The method is idempotent either way.
|
|
self.env.company._tncsc_setup_accounting()
|
|
|
|
def test_branding_config_seeded(self):
|
|
get_param = self.env['ir.config_parameter'].sudo().get_param
|
|
self.assertEqual(get_param('community_theme_base.primary_color'), '#05091E')
|
|
self.assertEqual(get_param('community_theme_base.secondary_color'), '#F97316')
|
|
self.assertEqual(get_param('community_theme_base.accent_color'), '#0EA5FF')
|
|
|
|
def test_membership_settings_seeded(self):
|
|
get_param = self.env['ir.config_parameter'].sudo().get_param
|
|
self.assertEqual(get_param('community_membership.org_name'), 'Tamil Nadu Cultural Society of Canada')
|
|
self.assertEqual(get_param('community_membership.member_id_format'), 'TNCSC-{year}-{seq}')
|
|
|
|
def test_five_membership_tiers_seeded(self):
|
|
tiers = self.env['community.membership.tier'].search([])
|
|
self.assertEqual(len(tiers), 5)
|
|
by_code = {tier.code: tier for tier in tiers}
|
|
self.assertEqual(by_code['IND'].price, 50.0)
|
|
self.assertEqual(by_code['FAM'].price, 80.0)
|
|
self.assertEqual(by_code['STU'].price, 20.0)
|
|
self.assertEqual(by_code['SEN'].price, 30.0)
|
|
self.assertEqual(by_code['LIFE'].price, 500.0)
|
|
for tier in tiers:
|
|
self.assertEqual(tier.currency_id.name, 'CAD')
|
|
self.assertTrue(tier.product_id, "Every seeded tier should still auto-create its product")
|
|
|
|
def test_chart_of_accounts_loaded(self):
|
|
company = self.env.company
|
|
self.assertEqual(company.currency_id.name, 'CAD')
|
|
self.assertEqual(company.country_id.code, 'CA')
|
|
# The Canadian template seeds thousands of accounts; a small sanity count is enough.
|
|
account_count = self.env['account.account'].search_count([('company_ids', 'in', company.id)])
|
|
self.assertGreater(account_count, 100)
|
|
|
|
def test_custom_nonprofit_accounts_created(self):
|
|
Account = self.env['account.account']
|
|
names = {'Membership Dues Revenue', 'Event Revenue', 'Sponsorship Revenue',
|
|
'School Fees Revenue', 'Donations Revenue', 'Deferred Event Revenue',
|
|
'Stripe Clearing Account'}
|
|
for name in names:
|
|
account = Account.search([('name', '=', name)], limit=1)
|
|
self.assertTrue(account, f"Expected custom account '{name}' to exist")
|
|
|
|
def test_donations_journal_created(self):
|
|
journal = self.env['account.journal'].search([('code', '=', 'DON')], limit=1)
|
|
self.assertTrue(journal)
|
|
self.assertEqual(journal.type, 'sale')
|
|
|
|
def test_membership_tier_products_use_dues_account(self):
|
|
dues_account = self.env['account.account'].search([('name', '=', 'Membership Dues Revenue')], limit=1)
|
|
tiers = self.env['community.membership.tier'].search([])
|
|
for tier in tiers:
|
|
self.assertEqual(tier.product_id.property_account_income_id, dues_account)
|
|
|
|
def test_website_pages_published(self):
|
|
urls = (
|
|
'/', '/about', '/about/tamil-nadu', '/about/board-of-directors',
|
|
'/membership', '/membership/benefits', '/tamil-school',
|
|
'/sponsors', '/contact',
|
|
)
|
|
for url in urls:
|
|
page = self.env['website.page'].search([('url', '=', url)], limit=1)
|
|
self.assertTrue(page, f"Expected a website.page for {url}")
|
|
self.assertTrue(page.is_published)
|
|
|
|
def test_tncsc_role_groups_exist_and_imply_product_groups(self):
|
|
board_admin = self.env.ref('tncsc_deployment.group_tncsc_board_admin')
|
|
self.assertIn(
|
|
self.env.ref('community_membership.group_membership_manager'),
|
|
board_admin.implied_ids,
|
|
)
|
|
treasurer = self.env.ref('tncsc_deployment.group_tncsc_treasurer')
|
|
self.assertIn(
|
|
self.env.ref('community_interac.group_interac_verifier'),
|
|
treasurer.implied_ids,
|
|
)
|