CRM 0.2.5: Supplier, client and partner roles
CRM 0.2.5 lets a company or contact hold commercial roles: supplier, client and partner. It also adds a task that brings Catalogue suppliers into the CRM.
The company and contact forms get a Commercial roles section with a checkbox per role, both lists show role badges and a filter tab per role, and granting or removing a role is written to the activity log with who did it. A removed role is kept in the history rather than deleted.
A one-off task, mix phoenix_kit_crm.import_suppliers_from_catalogue, brings the Catalogue’s suppliers into the CRM. Without --apply it only reports. It matches each supplier to a CRM company by email, then by website, creates a company otherwise, grants the supplier role and marks the catalogue row, so a second run changes nothing. A row that fails is reported and the run goes on.
The involved-parties search on interactions now uses core’s search picker. The CRM also works on installs that put PhoenixKit’s tables in their own database schema.
Upgrading
Update PhoenixKit to 1.7.197 or later, whose migration creates the role table, and run mix phoenix_kit.update.
Full release notes: CRM 0.2.5
0.2.5 · 17 July 2026
First release of the CRM v2 party-roles work (PRs #9-#12): companies and
contacts can now hold commercial supplier/client/partner roles, schemas
carry PhoenixKit.SchemaPrefix for named-schema (--prefix) installs, and a
one-time backfill task migrates catalogue suppliers into CRM. Requires
phoenix_kit >= 1.7.197 (the core migration shipping
phoenix_kit_crm_party_roles and phoenix_kit_cat_suppliers.crm_company_uuid).
Added
PhoenixKitCRM.PartyRoles— grant/revokesupplier,client,partnerroles on a company or contact (soft-ref polymorphic rows, idempotent grant, revoke keeps history instead of deleting). Roles checkboxes on both company/contact forms; role badges + filter tabs on both list pages. Mutations logcrm.party_role_granted/crm.party_role_revokedwith the acting user’sactor_uuid.mix phoenix_kit_crm.import_suppliers_from_catalogue— one-time, dry-run-by-default backfill: matches eachphoenix_kit_cat_suppliersrow to an existing CRM company by email then normalized website, creates a company otherwise, grants thesupplierrole, and stampscrm_company_uuidback onto the catalogue row. Idempotent; guarded against a missing catalogue table or an out-of-date core (crm_company_uuidcolumn absent).use PhoenixKit.SchemaPrefixon every table-backed schema (RoleSetting,Company,CompanyMembership,Contact,Interaction,InteractionParty,UserRoleViewConfig,PartyRole) — a no-op unless the host app configures:phoenix_kit, :prefix. A conformance test enforces it repo-wide.dev_docs/design/crm_v2_parties_suppliers_clients.md— the design spec this release implements Phases 1 and 3 of (Phase 2’s catalogue-side resolver and Phase 4’s client/warehouse seam are future work).
Changed
- Involved-parties search (
interactions_component.ex) switched from a hand-rolledPartyPickerJS hook to core’s<.search_picker>component; the old hook’s static asset was deleted. phoenix_kitdependency floor raised~> 1.7 and >= 1.7.189→>= 1.7.197.
Fixed
- Party-role grant/revoke activity log entries now record the acting user’s
actor_uuidinstead of always loggingnil. ContactFormLive’s partial-role-failure path re-reads persisted role state from the DB before re-rendering (was showing stale checkbox state;CompanyFormLivealready did this correctly).- Supplier-import email matching lowercases both sides of the comparison (works
whether the core migration has promoted the column to
citextor not), excludes trashed companies, and resolves duplicate emails to the oldest match instead of raising; website matching lowercases before stripping the scheme/www.prefix so uppercase stored URLs normalize the same as the Elixir-side helper. - Supplier-import per-row processing: a grant/stamp/match failure on one row
records an
:errorrow and the run continues instead of aborting — the report always prints. The report’serrors:total previously only counted failed company-creation (:error_creating), silently dropping these rescued-exception rows from the summary; it now counts both. mix dialyzer— added:mixtoplt_add_apps(mix.exs). The supplier backfill task is this repo’s first file underlib/mix/tasks/, and without:mixin the PLT, dialyzer couldn’t resolveMix.Task’s callbacks orMix.shell/0/Mix.Task.run/1, failing the release gate.mix credo --strict— a test call site spelled out the task’s fully qualified module name instead of using the alias already in scope, tripping Credo’s nested-module-aliasing check and (like the dialyzer issue above) failing the release gate.
Notes
- Integration tests (the CRM DB round-trips, including all of
party_roles_test.exsand the supplier-import task’s DB-backed cases) could not run in this release’s build environment (no Postgres available); per this repo’s documented stance they auto-exclude and only the pure-logic unit tests ran. They’re expected to run in CI / against a real core checkout before this reaches production installs. - Review docs:
dev_docs/pull_requests/2026/{10-crm-party-roles, 11-schema-prefix,12-import-suppliers-backfill}/CLAUDE_REVIEW.md.
CRM 0.2.5. Install or update: {:phoenix_kit_crm, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.