Skip to content

Conversation

@gonzalesedwin1123
Copy link
Member

@gonzalesedwin1123 gonzalesedwin1123 commented Dec 1, 2025

Why is this change needed?

An optional module for adding a suffix in the individual registrant name needs to be created to support implementations that requires it. A series of suffixes can also be added to the name of individual to support for example "DELA CRUZ, JUAN X, SR., PHD". This series cannot be set with suffixes belonging to the same group. Example: "JR" and "SR" cannot be assigned to an individual.

How was the change implemented?

Created a new module named spp_registry_name_suffix.

New unit tests

  • TestNameSuffix

Unit tests executed by the author

  • TestNameSuffix

How to test manually

  • Install the module spp_registry_name_suffix
  • Create a new individual
  • The "Suffix" must be available after the "Additional Name" field.
  • To add a new suffix, in the configuration menu click the menu "Name Suffixes".
  • Add a new suffix.
  • The new suffix must be selectable in the individual registrant form view.

Related links


Note

Introduces a new module adding configurable name suffixes and UI integration for individuals, with validation, data, and tests.

  • Module: spp_registry_name_suffix
    • Models:
      • New spp.name.suffix with fields (name, code, sequence, active, description, is_generational) and unique constraints; custom name_get.
      • Extend res.partner with suffix_ids (Many2many) and constraint allowing only one generational suffix; enhance name_change to append ordered suffixes to name for individuals.
    • Views/UI:
      • Config pages for spp.name.suffix (tree/form/search), window action, and menu under Registry > Configuration.
      • Add suffix_ids to individual form (after addl_name) and list views as tags.
    • Data/Security:
      • Seed common suffixes (generational I–XV, Jr./Sr./Jra., and PhD/MD/Esq.).
      • Access rules for registrar/admin in ir.model.access.csv.
    • Tests:
      • Transaction tests covering model creation, data load, name generation with/without multiple suffixes, ordering, name_get, and generational exclusivity.
    • Misc:
      • Manifest, build config (pyproject.toml), and documentation (README, static description).

Written by Cursor Bugbot for commit 5dd04cd. This will update automatically on new commits. Configure here.

- Add spp.name.suffix model for configurable suffixes (Jr., Sr., III, PhD, etc.)
- Extend res.partner with suffix_id field and name_change method
- Add configuration menu under Registry > Configuration > Name Suffixes
- Include default suffix data and unit tests
- Extend name_change method from g2p_registry_individual instead of
  _compute_name from spp_registrant_import (optional module)
- Fix tests to use env.ref() for existing suffix data records
- Update tests to use Form() helper for onchange simulation
Fix SonarQube issue: Remove this deprecated 'tt' element
in static/description/index.html
@gonzalesedwin1123 gonzalesedwin1123 marked this pull request as ready for review December 1, 2025 03:18
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Add PhD, MD, and Esq. suffix records that were missing from the data file.
Tests were failing because env.ref('spp_registry_name_suffix.suffix_phd')
could not find the record.
- Remove uniqueness tests that caused transaction/savepoint issues
- Add test to verify default suffix data is loaded correctly
- SQL unique constraints are still enforced by the database
… constraint

Tests were failing because res.partner has a check constraint
(res_partner_check_name) requiring a non-empty name at INSERT time.
Since name_change() is an onchange method that doesn't run during
programmatic create, we provide a temporary placeholder name that
gets overwritten when name_change() is called.
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 99.32432% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.35%. Comparing base (aef0602) to head (5dd04cd).

Files with missing lines Patch % Lines
spp_registry_name_suffix/models/res_partner.py 95.45% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             17.0     #879      +/-   ##
==========================================
+ Coverage   81.26%   81.35%   +0.08%     
==========================================
  Files         815      821       +6     
  Lines       24957    25105     +148     
  Branches     2914     2928      +14     
==========================================
+ Hits        20281    20423     +142     
- Misses       3944     3946       +2     
- Partials      732      736       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…eve 100% coverage

Add tests for the name_get method to cover:
- Display with different code than name (shows 'Name (CODE)')
- Display when code equals name (shows only 'Name')
- Handling of multiple records in recordset
Copy link

@aldnav aldnav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gonzalesedwin1123. Thank you for considering this feature. Real great use for us.
I reviewed the PR and left some comments. Please let me know what you think. 🙏

Change suffix field from Many2one to Many2many to allow selecting
multiple suffixes (e.g., 'Jr., PhD'). Suffixes are displayed in
sequence order. Updated views to use many2many_tags widget and
added comprehensive tests for multiple suffix scenarios.
…lusive suffixes

Add exclusion_group field to prevent incompatible suffixes from being
selected together. Generational suffixes (Jr., Sr., Jra., I-XV) are
now in the 'generational' group and cannot coexist. Academic/professional
suffixes (PhD, MD, Esq.) have no exclusion group and can be freely combined.
…rational field

Replace exclusion_group (Char) with is_generational (Boolean) to prevent
typographical errors in configuration. Generational suffixes (Jr., Sr.,
I-XV) are now marked with a simple checkbox, and the constraint ensures
only one generational suffix can be selected per individual.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 9, 2025

@gonzalesedwin1123 gonzalesedwin1123 merged commit 306320e into 17.0 Dec 16, 2025
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants