A short Python script reads the register record through the Prometiam REST API and writes one Odoo partner. It is a script, not an Odoo app and not a marketplace listing: the channels Prometiam publishes are on the integrations page.
The recipe is one Python file of about 170 lines, standard library only. It takes a country and a company number, calls GET /companies/by-identifier (1 credit) and creates or updates one res.partner through Odoo's external API: name, is_company, street, zip, city, country, the register number, and the VAT number only when the register itself states it. Prometiam has no Odoo connector and no app in Odoo's store.
The Prometiam half ran against the live API on 26 November 2026 with the public demo key. The Odoo half has not run against an Odoo database: the Odoo calls follow Odoo's documented external API and were exercised against a local test double on 26 November 2026; run it against a test database before production.
These come from Odoo's own developer documentation (the pages "External JSON-2 API" for 19.0 and "External API" for 17.0 and 18.0), read on 26 November 2026. Odoo can change them; read the page for your version.
/json/2/<model>/<method> with the header Authorization: bearer <API key>. 17.0 and 18.0 document XML-RPC (execute_kw on /xmlrpc/2/object). The 19.0 page states that the XML-RPC and JSON-RPC endpoints are scheduled for removal in Odoo 22 (fall 2028) and Odoo Online 21.1 (winter 2027). The script is written against 19.0 and keeps XML-RPC behind --transport xmlrpc for 17.0 and 18.0.Save it as odoo_partner_from_register.py. It reads its keys from environment variables and writes nothing else. It asks Odoo (fields_get) which of the fields exist in your database, and skips with a printed note any it does not find.
#!/usr/bin/env python3
"""Create or update an Odoo partner from a company number, using the Prometiam API.
Written against Odoo 19.0 (JSON-2 API, /json/2/<model>/<method>, bearer API key).
For Odoo 17.0 and 18.0 use --transport xmlrpc (execute_kw on /xmlrpc/2/object).
Standard library only.
PROMETIAM_API_KEY=rk_live_... ODOO_URL=https://mycompany.example.com ODOO_DB=mycompany \
ODOO_API_KEY=... python3 odoo_partner_from_register.py NO 923609016 --role vendor
XML-RPC also needs ODOO_LOGIN and ODOO_PASSWORD instead of ODOO_API_KEY.
"""
import argparse
import json
import os
import sys
import urllib.error
import urllib.parse
import urllib.request
import xmlrpc.client
PROMETIAM = os.environ.get("PROMETIAM_BASE_URL", "https://api.prometiam.com/functions/v1/risk-api")
def get_company(country, number):
"""GET /companies/by-identifier (1 credit). Returns the company object."""
url = "%s/companies/by-identifier?type=company_number&country=%s&value=%s" % (
PROMETIAM, urllib.parse.quote(country), urllib.parse.quote(number))
req = urllib.request.Request(url, headers={
"Authorization": "Bearer " + os.environ["PROMETIAM_API_KEY"],
"User-Agent": "odoo-partner-recipe/1.0"})
try:
with urllib.request.urlopen(req, timeout=30) as r:
return json.load(r)["data"]
except urllib.error.HTTPError as e:
body = json.loads(e.read() or b"{}")
sys.exit("Prometiam answered %s: %s" % (e.code, body.get("error", body)))
class Json2:
"""Odoo 19.0: POST /json/2/<model>/<method>, every argument named."""
def __init__(self, url, db, key):
self.url, self.db, self.key = url.rstrip("/"), db, key
def call(self, model, method, ids=None, **params):
body = dict(params)
if ids is not None:
body["ids"] = ids
req = urllib.request.Request(
"%s/json/2/%s/%s" % (self.url, model, method),
data=json.dumps(body).encode(),
headers={"Authorization": "bearer " + self.key,
"X-Odoo-Database": self.db,
"Content-Type": "application/json; charset=utf-8",
"User-Agent": "odoo-partner-recipe/1.0"})
try:
with urllib.request.urlopen(req, timeout=30) as r:
return json.load(r)
except urllib.error.HTTPError as e:
err = json.loads(e.read() or b"{}")
sys.exit("Odoo answered %s: %s" % (e.code, err.get("message", err)))
class XmlRpc:
"""Odoo 17.0 and 18.0: execute_kw on /xmlrpc/2/object (removal is scheduled, see the page)."""
def __init__(self, url, db, login, password):
self.db, self.password = db, password
common = xmlrpc.client.ServerProxy(url.rstrip("/") + "/xmlrpc/2/common")
self.uid = common.authenticate(db, login, password, {})
if not self.uid:
sys.exit("Odoo refused the login")
self.obj = xmlrpc.client.ServerProxy(url.rstrip("/") + "/xmlrpc/2/object", allow_none=True)
def call(self, model, method, ids=None, **params):
args = [ids] if ids is not None else []
if method == "create": # create([vals]) answers a list of ids
args = [params.pop("vals_list")]
elif method == "write":
args.append(params.pop("vals"))
return self.obj.execute_kw(self.db, self.uid, self.password, model, method, args, params)
def connect(a):
url, db = os.environ["ODOO_URL"], os.environ["ODOO_DB"]
if a.transport == "json2":
return Json2(url, db, os.environ["ODOO_API_KEY"])
return XmlRpc(url, db, os.environ["ODOO_LOGIN"], os.environ["ODOO_PASSWORD"])
def build_values(co, odoo, role):
"""Map the Prometiam company object to res.partner values. Returns (values, notes)."""
wanted = ["name", "is_company", "street", "zip", "city", "country_id", "company_registry",
"vat", "comment", "customer_rank", "supplier_rank"]
have = odoo.call("res.partner", "fields_get", allfields=wanted, attributes=["type"])
vals = {"name": co["company_name"], "is_company": True, "street": co.get("address"),
"zip": co.get("postal_code"), "city": co.get("city"),
"company_registry": co["company_number"]}
notes = []
code = co.get("address_country") or co["country"]
found = odoo.call("res.country", "search_read", domain=[["code", "=", code]], fields=["id"], limit=1)
if found:
vals["country_id"] = found[0]["id"]
else:
notes.append("Odoo has no country with code %s: country_id left empty." % code)
# The VAT number: only when the register itself states it.
if co.get("vat_number") and co.get("vat_number_source") == "register":
vals["vat"] = co["vat_number"]
elif co.get("vat_number"):
notes.append("VAT number %s was built from the register identifier in the format the law gives "
"(vat_number_source=%s). The format is right; the registration is not confirmed. "
"Check it with GET /vat/{number} before you use it." % (co["vat_number"], co.get("vat_number_source")))
else:
notes.append("The register publishes no VAT number for this company.")
if role in ("customer", "both") and "customer_rank" in have:
vals["customer_rank"] = 1
if role in ("vendor", "both") and "supplier_rank" in have:
vals["supplier_rank"] = 1
missing = [k for k in vals if k not in have]
for k in missing:
notes.append("This database has no res.partner field %s: skipped." % k)
del vals[k]
return {k: v for k, v in vals.items() if v not in (None, "")}, notes
def main():
p = argparse.ArgumentParser()
p.add_argument("country", help="two-letter country code, for example NO")
p.add_argument("number", help="the company's register number")
p.add_argument("--role", choices=["customer", "vendor", "both"], default="vendor")
p.add_argument("--transport", choices=["json2", "xmlrpc"], default="json2")
p.add_argument("--company-json", help="read the company object from a saved answer instead of calling the API")
a = p.parse_args()
if a.company_json:
co = json.load(open(a.company_json))["data"]
else:
co = get_company(a.country.upper(), a.number)
if co.get("status_group") == "inactive":
print("Warning: the register status is %s (%s)." % (co["status"], co.get("local_status")))
odoo = connect(a)
vals, notes = build_values(co, odoo, a.role)
# One partner per register number and country (a number can repeat across countries).
domain = [["company_registry", "=", co["company_number"]]]
if "country_id" in vals:
domain.append(["country_id", "=", vals["country_id"]])
existing = odoo.call("res.partner", "search_read", domain=domain, fields=["id", "name", "comment"], limit=2)
if len(existing) > 1:
sys.exit("More than one partner has this register number: merge them first, nothing written.")
# Notes go to the internal note (comment), appended once, never over what a person wrote.
note = "Prometiam check: " + " ".join(notes) if notes else ""
old = (existing[0].get("comment") or "") if existing else ""
if note and note not in old:
vals["comment"] = (old + "\n" if old else "") + note
if existing:
odoo.call("res.partner", "write", ids=[existing[0]["id"]], vals=vals)
print("Updated partner %s (%s)" % (existing[0]["id"], co["company_name"]))
else:
pid = odoo.call("res.partner", "create", vals_list=[vals])[0]
print("Created partner %s (%s)" % (pid, co["company_name"]))
for n in notes:
print("Note:", n)
if __name__ == "__main__":
main()
export PROMETIAM_API_KEY=... # your Prometiam key export ODOO_URL=https://mycompany.example.com export ODOO_DB=mycompany export ODOO_API_KEY=... # Odoo 19: Preferences, Account Security, New API Key python3 odoo_partner_from_register.py NO 923609016 --role vendor # Odoo 17.0 or 18.0 (XML-RPC): set ODOO_LOGIN and ODOO_PASSWORD instead of ODOO_API_KEY python3 odoo_partner_from_register.py NO 923609016 --role vendor --transport xmlrpc
Running it twice for the same number and country updates the partner instead of creating a second one. The match is the register number in company_registry together with the country, because a register number can repeat across countries.
On 26 November 2026 GET /companies/by-identifier?type=company_number&country=NO&value=923609016 answered with the company object (Equinor ASA); only the fields the script reads are shown, the others are cut:
{
"data": {
"company_number": "923609016",
"company_name": "EQUINOR ASA",
"status": "active",
"status_group": "active",
"vat_number": "NO923609016MVA",
"vat_number_source": "register",
"address": "FORUSBEEN 50",
"postal_code": "4035",
"city": "STAVANGER",
"address_country": "NO",
"country": "NO",
...
},
"meta": { "resolved_by": "company_number", ... }
}
The same call for Spain (country=ES&value=A28015865, Telefonica) answered the same fields with "vat_number": "ESA28015865" and "vat_number_source": "rule". How the script maps them:
| Prometiam field | Odoo res.partner field | Note |
|---|---|---|
company_name | name | As the register writes it, often in capitals. |
| (fixed) | is_company | Always true: the register holds legal entities. |
address | street | One line, as the register gives it. It is not split into street and number, and for some countries it holds the town too (the Spanish answer above does). |
postal_code, city | zip, city | Left out when the register gives none. |
address_country (else country) | country_id | Looked up in res.country by its two-letter code. |
company_number | company_registry | Odoo's Contacts page calls this field Company ID. |
vat_number | vat | Only when vat_number_source is register. Otherwise it goes into the internal note, see below. |
--role | customer_rank, supplier_rank | Set to 1 for the chosen role, if your database has the field. |
vat_number_source says how the number was found. register means the register publishes it, or confirms the registration and the number has the law's format of its identifier (Norway, above). rule means it was built from the company's identifier (Spain: ES plus the NIF): the format is right, the registration is not confirmed. For several countries there is no number at all.
Odoo's VAT page (19.0, read 26 November 2026) says Odoo checks the format of a contact's VAT against the format of that country whether or not "Verify VAT Numbers" is enabled. A rule-built number always passes a format check, so Odoo cannot tell it from a confirmed one. That is why the script keeps it out of vat and writes this into the internal note (comment) instead, once, never over what a person wrote:
Created partner 1001 (TELEFONICA SA)
Note: VAT number ESA28015865 was built from the register identifier in the format the law gives (vat_number_source=rule). The format is right; the registration is not confirmed. Check it with GET /vat/{number} before you use it.
To confirm an EU number, call GET /vat/{number} (1 credit, answered live by VIES; see the VIES guide). VIES has no Norwegian or Swiss numbers.
The test double is a small local HTTP server written for this page. It answers /json/2/<model>/<method> and /xmlrpc/2/object, keeps res.partner and res.country in memory and records every call. It is not Odoo: it proves the script sends the calls it means to send and handles the answers it expects, nothing about your database. On 26 November 2026 the script, using the live Prometiam answer, created the Norwegian partner over JSON-2; the calls the double recorded were:
POST /json/2/res.partner/fields_get {"allfields": ["name", "is_company", "street", ...], "attributes": ["type"]}
POST /json/2/res.country/search_read {"domain": [["code", "=", "NO"]], "fields": ["id"], "limit": 1}
POST /json/2/res.partner/search_read {"domain": [["company_registry", "=", "923609016"], ["country_id", "=", 161]], ...}
POST /json/2/res.partner/create {"vals_list": [{"name": "EQUINOR ASA", "is_company": true, "street": "FORUSBEEN 50",
"zip": "4035", "city": "STAVANGER", "company_registry": "923609016",
"country_id": 161, "vat": "NO923609016MVA", "supplier_rank": 1}]}
The Spanish company was also created over JSON-2 with no vat and the note above. The XML-RPC path ran separately, from a saved copy of the same answer: it created the Norwegian partner and, on a second run, updated it with write. A number the register does not hold (NO 999999999) printed the API's 404 not_found and wrote nothing.
vals_list for create, vals for write, domain, fields, limit, allfields, attributes) follow the method signatures, because the 19.0 page says the request body carries the method's arguments by name. Its "Dynamic Documentation" section reads "Under construction", so check them on your database's /doc page.company_registry, vat, customer_rank and supplier_rank are checked at run time with fields_get; one your database lacks is skipped with a note.vat value in a wrong format can be refused by Odoo; the script then stops with Odoo's message.One run costs 1 credit (GET /companies/by-identifier); an error costs nothing. Filling 500 partners costs 500 credits, which is the whole allowance of the 14-day trial (card required, nothing charged during it); Starter is EUR 9.99 for 1,000 credits a month, Professional EUR 29.99 for 10,000, Scale EUR 99.99 for 50,000. For a long list, POST /companies/lookup resolves up to 100 companies in one call at 1 credit an item; this script does one at a time.
409 ambiguous_company_number; the script stops and prints it.vat.Norwegian data: Contains data from the Brønnøysund Register Centre, NLOD 2.0. Not legal or tax advice; the script writes what the register states, and a person decides what a partner record is used for.
The free trial lasts 14 days and includes 500 credits. A card is required and nothing is charged during the trial; it then continues as Starter (EUR 9.99/month) unless you cancel.