From Spreadsheets to an Integrated ERP

A Saudi trading and manpower-contracting group ran its books on spreadsheets. I moved it onto Odoo 19 with validated migration scripts, rule-based profitability reporting and ZATCA e-invoicing controls built in.

customers.xlsxvalidate()dry run, then applyOdoo 193 companies4 analytic plansZATCA cleared

Client screenshots are confidential. The visuals on this page are illustrative representations of the implemented workflows, built with fictional data.

My role
ERP Engineer
Industry
Material trading & manpower contracting, Saudi Arabia
Project type
ERP migration & compliance
Timeline
May 2026 – Present
Core stack
Odoo 19, Python, XML-RPC

The starting point

The group ran its accounts, customer and vendor lists and employee records across disconnected Excel workbooks, with a separate tool producing invoice QR codes. Material trading and manpower contracting shared one set of books, so leadership could not see which business line was actually earning the margin.

Years of free-form entry had left the same supplier recorded under several spellings, and VAT numbers missing or malformed. That mattered more than usual: under ZATCA Phase 2, every B2B invoice must be cleared by the Saudi tax authority before the customer receives it, and clearance depends on clean buyer data.

My contribution

I was the engineer on the implementation, working alongside the chartered accountant who owned the accounting policy. I built the migration and cleanup scripts, configured the analytic, VAT and automation rules inside Odoo, took ZATCA e-invoicing from a readiness assessment to production, and wrote the guides the client's staff use day to day.

Engineering approach

Four decisions shaped the build. Each traded a little speed for a ledger the client could trust.

  1. Data migration & validation

    Every import script reads the master-data template and runs a validation pass first: Iqama numbers, IBANs, phone formats, duplicate tax IDs. If one row fails, nothing is written. Scripts default to a dry run and only write with an explicit flag; bulk edits to posted entries save a snapshot first and ship with a rollback.

    Why: On a live ledger, a half-finished import is worse than none.

  2. Analytic accounting & reporting

    Four analytic plans run on every transaction: segment, client or contract, unit, and project. Automation rules fill the segment and unit from the employee contract, the product or the overhead vendor, so nobody picks tags by hand. Overhead sits in its own admin cost pool instead of being allocated, which keeps each segment's margin clean.

    Why: Manual tagging is where analytic reporting breaks first. Rules make segment P&L a by-product of normal data entry.

    Profit and LossAnalytic: SegmentJan – Jun 2026 · SAR thousandsTradingManpowerAdmin poolTotalRevenue2,4803,915—6,395Direct costs(1,904)(3,055)—(4,959)Segment margin576860—1,436Overhead——(412)(412)Net profit576860(412)1,024Margin23.2%22.0%—16.0%Overhead pooled separately, not allocated to segments
    Segment P&L, straight from the ledger.Illustration · fictional data
    One journal item, four dimensionsAnalytic distributionCustomer invoice lineINV/2026/0142Manpower services · MarchAccount4200 Manpower revenueEmployeeE-0218AmountSAR 46,000.00Rule: employee contractSegmentManpowerrule100%Client / ContractC-014 Contract100%UnitEmployee E-0218rule100%ProjectPRJ-031 Site work100%Other rulesProduct → Trading segmentOverhead vendor → Admin pool
    Four plans: segment, client or contract, unit, project.Illustration · fictional data
  3. Compliance & data quality

    ZATCA Phase 2 clearance runs on the operating company's sales journal, rehearsed end to end on a test replica before production. Upstream, VAT checks run at the point of entry: a customer can't be saved without a valid 15-digit Saudi VAT number, and a vendor without one creates a follow-up task.

    Why: Once ZATCA accepts an invoice, only a credit note can reverse it. Stopping bad data at creation is far cheaper than correcting it after clearance.

    Standard (B2B) invoice · clearancePost in OdooNumber assigned; UBL 2.1 XML builtSign and chainHash + previous invoice hash (PIH),counter (ICV), signed with the CSIDSend to ZATCAClearance API, in real timeClearedStamped XML and QR returned;only now shared with the customerRejected: fix the data and resendTax Invoiceفاتورة ضريبيةINV/2026/0142Subtotal46,000.00VAT 15%6,900.00Total SAR52,900.00ClearedZATCA stampin the QRSimplified (B2C) invoices are reported within 24 hours instead; not used in this project.
    Invoices clear ZATCA before they reach the customer.Illustration · fictional data
    Contacts / New customerSaveDiscardCustomer nameAl Noor Trading Co.CountrySaudi ArabiaVAT number31045678912003Needs 15 digits, starting and ending with 3VAT checkStarts with 3Ends with 315 digits (found 14)ResultSave blockedCustomer not saved.Enter a valid Saudi VAT number, or set a country outside Saudi Arabia.
    Invalid VAT numbers are stopped at creation.Illustration · fictional data
  4. Data cleanup & operational tooling

    A double-click toolkit lets accounting staff find likely duplicate vendors, customers and products. They mark each group Keep, Archive or Not a duplicate in a review workbook. The apply step snapshots every linked bill, payment and journal line, merges through Odoo's native wizard, then checks that the surviving record's totals equal both sides combined.

    Why: Master data decays after go-live. Cleanup had to be something the team could repeat safely without me.

    ReviewGulf Steel Supply CoGULF STEEL SUPPLY CO.Gulf Steel SuppliesApplySnapshotMergeVerifyResultOdoo contactGulf Steel Supply Co23 bills · 31 paymentsTotals match
    Staff decide; the script only carries out reviewed actions.Illustration · fictional data

Architecture & workflows

Excel was the source for the initial load; after that, everything lives in Odoo. Python sits between the two as a gate rather than a pipe: data reaches Odoo only after it validates.

  1. Excel source data

    • Master-data templates
    • Customers, vendors, products, employees
    • Legacy ledgers & bank statements
  2. Python migration layer

    • Validation before any write
    • Dry run by default
    • Snapshots & rollback
    • Odoo API over XML-RPC
  3. Odoo 19, multi-company

    • Group companies, shared contacts
    • Test replica for rehearsals
    • Automation & VAT rules
  4. Reporting & compliance

    • Analytic plans → segment P&L
    • VAT checks at entry
    • ZATCA Phase 2 clearance

Cleanup loop: The toolkit reads Odoo, staff review duplicates in Excel, and verified merges are written back.

Simplified view of the implementation.

Results

The numbers come from the first master-data cleanup. The rest are controls that now run on every transaction.

Vendor records
181 → 164
14 duplicate groups merged
Customer records
55 → 47
Empty duplicates archived, 3 merged
Duplicate products
11 archived
Unused templates only
Merge verification
All passed
Totals matched before and after every merge
  • Segment P&L for trading and manpower comes straight from Odoo, not a spreadsheet consolidation.
  • Customer invoices clear ZATCA Phase 2 from the operating company's sales journal.
  • Invalid customer VAT numbers are blocked at creation in every company.
  • Staff run duplicate cleanup themselves, with a backup taken before every merge.

Technology stack

  • Odoo 19
  • Python
  • XML-RPC
  • ZATCA e-invoicing
  • Analytic Accounting
  • Excel