Work Professional services
Quote-to-invoice software where two people editing at once never lose each other's work
We rebuilt a quoting and invoicing system. When people edit at the same time, conflicts are resolved field by field, every version is kept, totals are checked on the server, and the accounting integration can be tested without touching real accounts.
The problem
A UK services company prices its work as detailed, grouped line items. A job starts life as a quote, becomes a purchase order request and ends up as an invoice, often with several revisions at each stage. The system behind all that had become hard to maintain. It had no department tracking, no role-based access and no accounting integration, and it coped badly with revisions and with people editing at the same time.
The risk
Several people often work on the same document at once. The usual shortcut is to let the last save win, which means one person’s changes silently overwrite somebody else’s. On a commercial document, that can mean a wrong price going out to a customer, with nobody able to say how it happened.
The other easy mistakes are trusting totals worked out in the browser, and wiring the accounting integration straight into the code, so that the only way to test it is against the live accounts.
The decision
We built conflict handling into the data model itself. Every document has a revision counter and an append-only change log, and each save carries the revision the user last saw. If other edits have arrived in the meantime, the server compares them field by field: changes to different fields merge automatically, and a true collision is put in front of the user to resolve, because only a person can know which price is the right one. Each change runs in a single database transaction along with its revision update and log entry, so they succeed or fail together. Presence indicators and live updates over WebSockets show who else is editing.
Totals (discounts, tax, fees and part payments) update live on screen, and the server works them out again independently. Invoices sync to the client’s accounting system over OAuth, with tokens stored encrypted. We treated the accounting system as the source of truth for invoice status, kept current by signed webhooks plus scheduled checks to catch anything that slips through. The integration sits behind an interface with a stand-in used in tests, so it can be tested properly without going anywhere near real accounts.
The outcome
Several people can now edit the same document without losing work. There is a complete history from quote to invoice that can be audited, and the accounts stay in step without anyone re-keying figures. Unit, integration and end-to-end tests (including concurrent editing and each role’s permissions) run automatically on every change.