Skip to content

[19.0][ADD] partner_identification_kyc#2230

Open
bosd wants to merge 6 commits into
OCA:19.0from
bosd:19.0-add-partner_identification_kyc
Open

[19.0][ADD] partner_identification_kyc#2230
bosd wants to merge 6 commits into
OCA:19.0from
bosd:19.0-add-partner_identification_kyc

Conversation

@bosd

@bosd bosd commented Nov 28, 2025

Copy link
Copy Markdown
Contributor

Add module to use the partner_identification number model for KYC processes.

#2218
#2224
#2225

@bosd bosd force-pushed the 19.0-add-partner_identification_kyc branch from f531cbc to f17c6ff Compare December 7, 2025 20:55
@bosd bosd force-pushed the 19.0-add-partner_identification_kyc branch 3 times, most recently from d79d992 to 966deb9 Compare December 22, 2025 14:25
@bosd bosd marked this pull request as ready for review December 22, 2025 14:29
@bosd bosd force-pushed the 19.0-add-partner_identification_kyc branch from 966deb9 to 2ab9aae Compare January 26, 2026 15:07
@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label May 31, 2026
Comment thread partner_identification_kyc/data/activity_type_data.xml Outdated
Comment thread partner_identification_kyc/demo/identification_number_demo.xml Outdated
Comment thread partner_identification_kyc/demo/identification_number_demo.xml Outdated
Comment thread partner_identification_kyc/models/res_partner.py Outdated
Comment thread partner_identification_kyc/views/identification_number_views.xml
Comment thread partner_identification_kyc/models/res_partner_id_category.py Outdated
Comment thread partner_identification_kyc/models/res_partner.py Outdated
Comment thread partner_identification_kyc/views/res_partner_id_category_view.xml Outdated
@OCA-git-bot OCA-git-bot added series:19.0 mod:partner_identification_kyc Module partner_identification_kyc labels Jun 6, 2026
bosd added 2 commits June 6, 2026 14:04
Add a module providing Know Your Customer (KYC) identification for
partners, built on top of partner_identification:

- a dedicated "KYC" identification category with its check activity type
- a "Request KYC" button on the partner form and a helper to ensure a
  KYC record exists (e.g. for API-created partners)
- computed KYC validity / button-visibility, optionally enabled on child
  contacts
- a KYC filter on the id_numbers views and demo data
@bosd bosd force-pushed the 19.0-add-partner_identification_kyc branch from ffd19be to 1f0cea6 Compare June 6, 2026 12:04
@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jun 7, 2026

@BhaveshHeliconia BhaveshHeliconia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

enable_on_child_contacts field is currently only being used with KYC category, so we may use one boolean field to distinguish KYC category from others and also restore invisible="code!='KYC'" with corrected condition expression.

ID Number field is not setting with automatically generated sequence while trying to create KYC ID records manually using one2many field.

- Add an is_kyc boolean on res.partner.id_category to mark the KYC category
  instead of hard-coding the 'KYC' code; enable_on_child_contacts is now only
  shown for KYC categories (invisible="not is_kyc"), and the search filter
  matches on is_kyc.
- Auto-assign the identification number from the kyc.identification sequence in
  res.partner.id_number.create, so KYC records created manually via the
  one2many no longer require a hand-typed ID Number (name is relaxed for KYC in
  the form view).
- Drop the duplicated 'KYC-' prefix from the generated ID Number (the category
  already conveys KYC).
- Tests: cover manual auto-sequence and provided-name paths.
@bosd

bosd commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@BhaveshHeliconia thanks for the thorough review! Addressed in a26692c. Point by point:

Design points

  • enable_on_child_contacts only relevant for KYC — added an is_kyc boolean on res.partner.id_category to distinguish the KYC category, and enable_on_child_contacts is now invisible="not is_kyc" (no hard-coded code == 'KYC'). The KYC search filter now matches on is_kyc too.
  • ID Number not auto-set from the sequence on manual creationres.partner.id_number.create now auto-assigns the kyc.identification sequence for KYC records when no name is given, and the form relaxes the name requirement for KYC. Works for both the Request KYC button and manual one2many creation.
  • KYC duplicated in the ID record name — dropped the redundant KYC- prefix; the number now comes purely from the sequence (the category already conveys KYC).

Already fixed in the latest push (the review predates a force-push, so these showed as outdated):

  • noupdate="1" is present on both data/activity_type_data.xml and demo/identification_number_demo.xml.
  • The demo uses the correct base fields (valid_from / valid_until / partner_issued_id).
  • responsible_user_id is no longer present.
  • No method takes a redundant partner argument (all use self).
  • The identification-number search view inherits view_partner_id_numbers_search correctly.

Added tests for the manual auto-sequence and the provided-name paths. Could you re-review when you have a moment? 🙏

test_action_request_kyc_with_custom_sequence still asserted the old
"KYC-" prefixed ID Number; the number now comes purely from the
sequence. Assert the name is set and no longer duplicates the category.

@BhaveshHeliconia BhaveshHeliconia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Keep prefix back in seq_kyc_identification or modify create method logic.
  • ID Number field is required in form view, so unable to save form without it.

…Number

Addresses the second review round:
- Configure the "KYC" prefix on seq_kyc_identification (instead of
  hard-coding it in create), so generated ID Numbers read e.g. KYC001.
- Prefill the (required) ID Number from the sequence via an onchange when
  the KYC category is selected, so a KYC record can be created manually
  through the one2many without typing the number. create() keeps assigning
  it for the Request KYC button and programmatic creation.
- Drop the now-unnecessary form-view required modifier and the unused
  category_is_kyc related field.
- Tests: assert the KYC prefix and add an onchange/Form test.
@bosd

bosd commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@BhaveshHeliconia thanks for testing! Both points addressed in 349dcd1:

  • Prefix — restored the KYC prefix, but on the sequence itself (seq_kyc_identification now has <field name="prefix">KYC</field>) rather than hard-coded in create. Generated ID Numbers now read e.g. KYC001.
  • Required ID Number blocking manual save — instead of trying to relax the (model-level) required field in the view, the ID Number is now prefilled from the sequence via an onchange the moment the KYC category is selected, so the required field is satisfied and you don't have to type it. create() still assigns it for the Request KYC button and programmatic/import creation. I dropped the earlier form-view required modifier and the unused category_is_kyc field since they're no longer needed.

Added a Form-based test covering the onchange prefill. Could you re-test when you have a moment? 🙏

common.Form construction errored in the Odoo 19 CI; call the onchange
method on a new() record instead, which tests the same prefill behaviour.

@BhaveshHeliconia BhaveshHeliconia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:partner_identification_kyc Module partner_identification_kyc series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants