Cobra · Data script + API
Epson sales report: Odoo export → Google Sheets
Context
Epson requires a vendor sales report across several promotional periods (August 2025 → March 2026) for around ten projectors. The Epson SKUs (V11H...) don't match the internal Odoo codes (EPSO-...) — no mapping, no report.
What was built
- Script
epson_declaratif.py: Odoo XML-RPC → Google Sheets API - Epson SKU → Odoo product mapping via
product.supplierinfo - 7 periods, 10 SKUs,
sale.order.linequeries filtered by period and status - Variant deduplication, auto-formatted "Sales Report" tab, unmapped SKUs handled gracefully
What was tricky
- The Epson SKUs didn't exist anywhere in Odoo — manual entry by creating the EPSON supplier in each product record, back-and-forth during the session
- v1 of the script returned all zeros with no error: wrong field (
supplierinfoinstead ofdefault_code) - Google Sheets API wasn't enabled — reused the
claude-bq-readerservice account (BigQuery)
Stack
Python 3.9, xmlrpc.client, google-auth, google-api-python-client, Odoo XML-RPC, Google Sheets API v4, GCP cobra-analytics.
What this shows
Iterative "diagnose + build" session — the initial script returned 0 with no error, forcing us to investigate the data structure before writing more code. Claude identified the wrong field, suggested the right model, and waited for the human to fill in the missing data.