Setup · branches
Branches and the operating models.
Every shop is a branch. What makes Opticops different is the model underneath: a single branch carries three separate organisation references that let mixed COCO / COFO / FOFO / FICO chains work without spreadsheets.
Adding a branch
Org owners and regional managers can create branches.
- Sidebar → Branches → + New branch.
- Pick the operating model (next section). This is the most important field and it's hard to change later.
- Type the branch code (3-6 letters, e.g. TRI for Tri Nagar) and name (full display name).
- Fill the address — at minimum line 1, city, state, pincode. The state matters for GST: the place-of-supply field on every invoice from this branch defaults to this state.
- Optional: contact phone, contact email, branch-level GST number, opening hours.
- For non-COCO branches: pick the owner organisation, inventory owner, and capital provider. For COCO leave them as your own org.
- Save. The branch appears in every operator's branch picker immediately.
The four operating models
| Model | Who owns the building | Who runs day-to-day | Who funds opex |
|---|---|---|---|
| COCO — Company-Owned, Company-Operated | Parent brand | Parent brand | Parent brand |
| COFO — Company-Owned, Franchisee-Operated | Parent brand | Franchisee | Mix (varies by contract) |
| FOFO — Franchisee-Owned, Franchisee-Operated | Franchisee | Franchisee | Franchisee |
| FICO — Franchisee-Invested, Company-Operated | Franchisee (or co-invested) | Parent brand | Parent brand |
Indian optical chains often run a mix. The branch row has four org references so each one is captured explicitly:
| Reference on branches table | What it means |
|---|---|
| organization_id | The org that operates this branch day-to-day. The org whose staff log in and run the counter. |
| owner_organization_id | The org that owns this branch financially — gets the upside, takes the downside. |
| inventory_owner_organization_id | The org that owns the stock sitting in this branch. For consignment models, this is the supplier brand, not the operator. |
| capital_provider_organization_id | The org that put the money in to build / fit out this branch. For FICO, this is the franchisee even though the brand operates. |
| parent_brand_organization_id | The brand-owning org. Same as owner for COCO; the franchisor for everyone else. |
Why the model matters at runtime
Inventory writes
When you receive stock at a branch, the system stamps the receipt with that branch's inventory_owner_organization_id. For a consignment FICO branch, that's the franchisee even though parent-brand staff did the work — so the asset sits on the franchisee's books, not yours.
Sales accruals
Every sale stamps organization_id (operator) + parent_brand_organization_id (whose brand was sold) on the order. The royalty report joins these two and computes what the operator owes the brand for the period.
RLS visibility
A franchisee's customer records, prescriptions, and operational expenses are visible only to the franchisee's org. The parent brand can see aggregated inventory + royalty- relevant sales totals but not who bought what. See franchisee data sovereignty.
Inter-org transactions
Any time value moves across organisation boundaries — franchisee royalty owed to the brand, stock transferred from a parent warehouse to a franchisee branch on consignment, co-op marketing reimbursement, management fee — a row goes into inter_org_transactions automatically. This is the ledger that makes royalty calculations defensible to franchisees: they can ask “why is this number?” and you can show them the exact transactions that built it.
Surfaced in /reports/finance grouped by agreement and period.
Archiving a branch
You can soft-delete a branch from its detail page. The branch stops appearing in pickers and dropdowns; existing orders and inventory remain queryable but the branch is read-only. We snapshot inventory + financial position at the moment of archive so trends reports always include the “branch closed” event.