
📍Skutr Docs — Day 12. Multi-organizations
Yesterday — legal precision of prompts and mobile adaptation. Today — a freelancer is no longer tied to a single sole proprietorship.
—
🏢 Organizations as a separate entity
Previously, details were stored in the user profile. One TIN, one name, one bank account. But a freelancer can be a self-employed Ivanov I.I. for small orders and a sole proprietor Ivanov for large ones. Or close the sole proprietorship and switch to self-employment — but old documents must retain the previous details.
I moved organizations to a separate table. 12 fields, 1:N relationship with the user, a "default" flag. The migration automatically transferred existing data from the profile to the first organization — no user lost anything.
CRUD API, management page in the dashboard, organization selection in all four document forms. Bot: "My details" became "My organizations" — a list with ⭐️ for the primary one, adding new ones, switching between them.
—
🔀 Organization selection when creating a document
If there is one organization — everything works as before, the user doesn't notice anything. If there are two or more — before creating an invoice, act, quotation, or contract, a step "Select the executing organization" appears with inline buttons.
The selected organization is passed to the generator and saved in the document.
Architecturally: _maybe_choose_org() — a single helper for all four FSMs. One pattern, four call points, zero duplication.
—
✏️ Editing all documents in the dashboard
Invoices and acts could be edited after creation. Quotations and contracts — only during creation in the preview modal. After saving — read-only. Why? Because canEdit only checked invoice and act.
I moved the full editing logic from the modal to the document page. Quotation: title, introduction, sections with items, cost per item with auto-calculation, validity period, next steps. Contract: preamble, sections with paragraphs (add/delete), total amount. Now a document created by voice in the bot at 2 AM can be easily edited in the dashboard in the morning.
—
🧹 Three minor annoyances
Badges without labels. Documents from the bot via "quick documents" were created with source="quick". The frontend only knew "bot" and "web". 27 documents were left without a label. Changed to "bot", updated existing ones with a single UPDATE.
Back navigation. You go to the "Invoices" section, open a specific invoice, click "To documents" — you end up in "All". Now the button says "To invoices" and returns to the invoices section. Query parameter ?tab=invoice — simple and reliable.
Search in the bot. The button "🔍 Search document" in "My documents". But documents are already divided into sections, and the dashboard has full search with filters. Removed it. Fewer buttons — less cognitive load.
—
💡 Insight of the day
Multi-organizations is not a feature for corporations. It's the reality of freelancing. A self-employed person opens a sole proprietorship — and they need both sets of details. A designer works as an individual for Russian clients and as a sole proprietor for foreign ones. If a product ties a person to one legal entity — it doesn't understand its audience.
—
🎯 Summary for the day: Organization model with CRUD API and migration, organization selection in the bot when 2+ orgs, full editing of quotations and contracts in the dashboard, fix for source badges, tab navigation, UI cleanup.
—
#buildinpublic #skutrdocs #AI #freelance #selfemployed #startup #SaaS #product #UX
Comments
0No comments yet.