Modules / Business partner
Customers & suppliers (shared)
One record per company or person you do business with, shared by every other module — so sales, invoicing and purchasing all mean the same customer.
People ask for it as: “one customer list”, “our customers and suppliers”, “the same client in sales and accounting”
Who uses it
| Role | Does | Sees |
|---|---|---|
| Whoever keeps the customer list clean | merges duplicates, fixes names, links subsidiaries to parents | every partner |
| Other modules (sales, invoicing, purchasing) | create-or-reuse a partner, read partners and families | every partner |
| The people module (hr), through its service identity | the SINGLE writer of person partners (name, work contact, roles employee / worker / supplier, the works_for edge), and anonymises them on erasure | person partners, and organisation partners as any module does |
| Roles that deal with people as parties (contracts, finance) | reads person partners, for a contract counterparty or a supplier payment | person partners and organisation partners |
| The system | derives ids and enforces the sole-writer rule on every write | every partner, through its own service account |
What it has to do
Reference user stories. Each has a test written into it — the given / when / then — which becomes an automated check once it is built. Expect to keep some, change some and drop some.
Things people do
BP-01As the person who keeps the customer list, I want one record per real company however many modules use it, so that reports agree.
Given sales and invoicing both refer to Acme · when I open Acme · then I see one partner with two roles (customer, and supplier if we also buy from them)
Whoever keeps the customer list clean · reference: implemented
BP-03As the data steward, I want to link subsidiaries to their parent, so that group-level reporting is possible.
Given Acme UK and Acme DE · when I link both to Acme Group as subsidiary_of · then the family walk returns both; a framework-agreement link does not leak into the ownership tree
Whoever keeps the customer list clean · reference: implemented (typed edges)
BP-06As anyone signed in without bp:person:read, I should not see people in the partner list, so that a starter's name is not visible to the whole company before they start.
Given an organisation partner Acme and a person partner for a starter hired today · when I list partners or open the person partner by id · then I see Acme; the person partner is not in the list and opening it is not found (404, not 403); a caller with bp:person:read sees both
Other modules (sales, invoicing, purchasing) · screen: Partners · reference: not built
Things that happen on their own
BP-02whenever any module creates a partnerThe system derives the partner id from a stable business key, so that importing the same company twice creates it once.
Given a partner with key acme.com · when it is created twice, by two modules · then one row, the same id both times
· reference: implemented (bp_id = blake2b(bp_key), 56-bit)
Things that cross into other modules
BP-04when sales converts a new companySales promotes a company into the shared list instead of keeping its own.
Given a CRM organization row · when promote is called · then a partner exists (created or reused) with the customer role
· owned by business-partner · reference: implemented (POST /partners/promote)
BP-05when hr hires a person, changes their name or work contact, or a role-bearing event takes effecthr keeps the person's partner right, as its only writer, so that every module addresses a person with one key.
Given a person in hr with person_id 812…, and no partner for them · when hr calls bp:person:sync with bp_key 'person:<person_id>', the legal and preferred name, the work email and phone, the roles and, for a company freelancer, works_for → the company's partner · then one partner of kind person exists (bp_id derived from the bp_key, so hr knows it without asking), with exactly those fields; a second identical call changes nothing; a payload carrying a personal email, phone, home address, tax or bank field is refused ("a person partner carries a name and a work contact only"); bp:partner:write cannot edit a person partner ("people are written by hr")
· owned by business-partner · reference: not built
BP-07when hr applies an erasure or a retention rule to a personhr anonymises the person's partner, so that erasure reaches the shared record too.
Given a person partner whose person is erased in hr · when hr calls bp:person:sync with anonymise=true · then the name and work contact are replaced with a fixed placeholder, the bp_id and roles history stay (other modules' records still join), and a second call changes nothing
· owned by business-partner · reference: not built
What it keeps
| Thing | Meaning | Identified by | Shared? |
|---|---|---|---|
| business partner | a company or person you do business with | bp_id derived from bp_key (a domain, a legacy customer number, a VAT id; for a person, 'person:<person_id>') | SHARED — this module is the sole writer |
| bp role | what the partner is to us — customer, supplier, carrier; and for a person, employee or worker | bp_idrole | SHARED — sole writer |
| bp edge | a typed relationship between partners (subsidiary_of, framework_governs, works_for — a person to the company they freelance through) | srcdstrel | SHARED — sole writer |
DataK3 accepts foreign keys but does not enforce them. "Only this module writes partners" IS the integrity mechanism — other modules call its routes, never its tables.
Questions that shape your version
Read these out and let the customer correct one — people rarely recall a policy on demand and can always react to one. Standard is a named authority you can look up and hold us to. Commonly seen is exactly that: arrangements we have met, with no survey behind them. A customer doing none of them is not doing it wrong.
- What identifies a customer for you — a website, a customer number, a tax id?
- b2b services
- a customer number they already use in their old system
- vat registered trade
- the tax id, because it is what the invoice must carry anyway
- warning
- a web domain looks stable and is not — it moves on a rename or acquisition
- Do you buy from any of the companies you sell to?
- Do you deal with groups of companies?
What you can change yourself
These are settings, not code: someone in your team changes them on a screen, without a developer and without a release.
- the roles a partner can have to you — customer, supplier, carrier, and any of your own (employee and worker are hr's, for person partners)
For builders
- Module spec — this page, for agents
- The lifecycle and the design template
Code
Public repositories, anonymous clone, one release tag each. Read README.md and AGENTS.md first.
- brick-business-partner (brick, v0.4.0)
git clone --depth 1 --branch v0.4.0 https://git.dodil.io/dodil/erp-brick-business-partner.git
ssh:[email protected]:dodil/erp-brick-business-partner.git - erp-platform (platform, v0.9.13)
git clone --depth 1 --branch v0.9.13 https://git.dodil.io/dodil/erp-platform.git
ssh:[email protected]:dodil/erp-platform.git
Known gaps in the reference
- no merge-duplicates (a person asking to merge two partners cannot yet)
- no addresses; contacts (people at a partner) are the CRM's, held by brick-activity, not here
- no screen: API and MCP only
- sync_person takes no version: hr is a person partner's single writer, and a sync that lost a race is re-run
- invoicing's column named bp_id holds what this module calls a bp_KEY, not a bp_id, so the cross-module join needs a CAST. This module is right; the naming downstream is not - design/ar-bp-id-change-request.md