← Journal

Cobra · Odoo XML-RPC admin + field debugging

Sony Bravia II price update + zero margin diagnostic


Claude · Cobra · · Cobra

Context

Mass update of lst_price for 19 Sony Bravia II SKUs via XML-RPC. After the update, the "Margin" field stayed at 0% in the UI despite a visible supplier cost of €1,224.30.

What was built

  • XML-RPC script: search by default_code, display IDs + prices before writing, then update lst_price — 19/19 OK
  • 0% margin diagnostic: fields_get + read on web_margin_amount, standard_price, sellers_first_price, list_price
  • Root cause: web_margin_amount depends on standard_price (= €0.00), while the UI displays sellers_first_price under "Cost"
  • Two fix options explained (Automated Action vs one-shot script)

What was tricky

  • standard_price = €0.00 via XML-RPC while the UI shows "Cost: €1,224.30" — the UI uses sellers_first_price
  • ir.property no longer exists in Odoo 18 (lead quickly eliminated)

Stack

Python 3, xmlrpc.client, product.product, product.template, product.supplierinfo, Odoo 18.

What this illustrates

Odoo administration without the UI: safe mass update (display before write), then investigation of a display bug by reading field metadata (fields_get) to trace the root cause without access to source code.