← Journal

Cobra · Module extension + multi-branch deployment

Sogetronic profile: dropshipping stock import by supplier code


Claude · Cobra · · Cobra

Context

The cobra_import_stock_drop module already handled dropshipping stock imports for AVI, Triangle and Dimetel via EAN/barcode matching. Sogetronic couldn't use it: their EAN column contains unresolved VLOOKUP formulas. Matching had to happen on their Sage Code (internal supplier reference), already present in product.supplierinfo.product_code following a seed of 192 products on May 21, 2026.

What was built

  • match_key (Selection barcode/supplier_code) on cobra.dropship.import.profile — defaults to barcode, existing profiles unchanged
  • supplier_id and supplier_code_column with conditional visibility
  • @api.constrains replacing the old _sql_constraints location_unique
  • Lookup of product.supplierinfo on partner_id + product_code instead of barcode
  • Migration 1.0.4: ALTER COLUMN ean_column DROP NOT NULL + partner XML id in pre-migrate
  • Deployment: preprod3 validated → clean cherry-pick onto main via stash

What was tricky

  • preprod3 was at v1.0.0 (main at 1.0.3) with diverged files — git stash pop created non-trivial conflicts, resolved manually
  • New untracked files aren't included in a standard git stash — recovered via git checkout preprod3 -- <path>

Stack

Python 3, Odoo 18 ORM, XML-RPC, openpyxl, git (stash + rebase), GitHub (dépôt privé).

What this illustrates

A complete Odoo development in a single session: reading existing code, surgically extending a production module, schema migration, idempotent XML seed, multi-branch deployment with conflict resolution — no global rewrite.