List Names

Common List names

When setting up an Odoo source, it is useful to query the Odoo instance for lists of values for use in nestedObject property mappings. This provides a way for you to keep the values that users can select in sync with those in Odoo.

List name
Returns
Sample data

mrp.workcenter

List of work centers operations (will show duplicates

[ 1, "Assembly Line 1"], [ 2, "Drilling" ]

mrp.workcenter.tag

List of work center tags

[ 1, "Finishes" ]

product.category

Product template categories

[ 1, "All" ], [ 9, "All / Consumable" ]

product.attribute **

Returns registered attributes

[ "Color", "Duration", "Finish" ]

product.tag

Tags assigned on the General Information tab

[ 11, "Kit" ], [ 12, "Assemble" ], [ 81, "Switches" ]

res.company

List of registered companies in your Odoo instance

[ 3, "SharpSync CA"], [1, "SharpSync USA"]

res.users

List of registered users in your Odoo instance

[ 5, "Andrew Crumbs"], [12, "Joe Soap"]

resource.resource

Lists all the registered Odoo resources. Can include people and workcenters

[ 5, "Andrew Crumbs"], [12, "Work Center 1"]

stock.location

Locations you can assign for warehouses

[ 14986, "MP" ], [ 14995, "MP/Assemble" ], [ 14990, "MP/Output" ],

stock.route

Routes available for selection [2]

[ 1, "Replenish on Order (ROO)" ], [ 2, "Receive in 1 step (RIS)" ]

uom.uom

Units of measure for BOM line items or individual products

[ 'Each', 'Dozens']

You can view and configure all the attributes by navigating to Inventory > Configuration > Attributes

** The list product.attribute is special in that you can expand upon the query by adding attribute name at the end in square brackets. Example, by looking at the list values above, you can use the value

product.attribute["Finish"]

This will query all the values of the Finish attribute.

However this may return complex values which you could refine with a value selector such as

{id} : {name}

The result returned from this may look something like this

1 : |10 : Powder Blue|2 : |3 : |4 : |9 : Satin Black

List data (e.g. Stock Routes)

List data values (in this case Stock routes) are represented as integer values in Odoo. You can query list values with the following POSTMan request

{
  "id": 27,
  "jsonrpc": "2.0",
  "method": "call",
  "params": {
    "args": [ ],
    "model": "stock.route",
    "method": "name_search",
    "kwargs": {
      "context": {
        "lang": "en_US",
        "tz": false,
        "uid": 1,
        "allowed_company_ids": [ 1 ] // leave blank for all companies
      }
    }
  }
}

A typical list of values for this request returned from Odoo looks like this:

{
    "jsonrpc": "2.0",
    "id": 27,
    "result": [
        [
            1,
            "Route 1 - Supply Product from MP"
        ],
        [
            2,
            "Route 1 - Product from WS"
        ],
        [
            3,
            "Route 1 - Supply from VH"
        ],
        //...etc
}

A typical cell value returned from Odoo looks like this:

[1,5,7]

or

[7]

Not very user friendly, but we can fix that in the next step

Setting up the list on screen

Now that we know how to get the values, lets setup the list displayed onscreen. Lists like this can be cached in SharpSync, so the setup is done once and refreshed from time to time.

List name: stock.route List Value Selector: {id} : {display_name}

Once this is done, click the copy button

So we need to convert the ids into a proper string to display onscreen. For that we'll use a Text Manipulation Rule to do the trick.

Make sure that the following Text Manipulation rule is applied for stock routes

  • Rule Type: Text manipulation

  • Applies to: Odoo

  • Rule Value:

const jsonArr = JSON.parse(s); 
return jsonArr.map(ss => ss.toString());

Last updated