Read BOM WorkCenters
Choose what to display
The work centers and operations both depend on mpr.bom.operation_ids. You'll want to display one of the following:
The mapped work center or stations, read-only (e.g. Drill Station 1, Galvanization, Powder Coating)
The mapped operation names (e.g. Drill, Galvanize, Powder Coat)
For more complicated mappings, please contact us through the support portal.
Create a new Property Mapping with the following settings:
Property Name / Header
Operation WorkCenters
Accessor
operationWorkCenters
Primary Property
(Unmapped)
Secondary Property
mrp.bom.operation_ids
Update Odoo on Submit
false
[not here, we'll do it for the individual operations]
List Name
mrp.workcenter
List Value Selector
{id}:{resource_id[1]}
Rendering Type
Advanced Multi Select List
List Display Selector
name
List Value Selector
id
List items
Copied from the List Value (and formatted as a JSON array) but should look something like this
[
{ "id": 1, "name": "Galvanizing Station" },
{ "id": 2, "name": "Drill Station 1" }
]Enabled
true
Prefer Odoo Value
true
Productivity Tip
To easily convert the list into a list of values, go to your favourite GPT and type the following prompt, pasting the values with it:
Convert the following text into a list of json objects the number as the "id" and the text as the "name"After adding the new Property Mapping, add an import rule
Type
import
Name
Text Manipulation
Process for {Primary}
false
Process for Odoo
true
JavaScript expression
if (!s)
return [];
if (Array.isArray(s))
return s.map((item) => item.workcenter_id["id"]);
if (typeof s === "string") {
try {
const parsed = JSON.parse(s);
if (Array.isArray(parsed)) {
return parsed.map((item) => item.workcenter_id["id"]);
} else {
console.log("Parsed operationWorkCenters JSON is not an array, it is " + typeof parsed, parsed);
return [];
}
} catch (e) {
console.log("Invalid operationWorkCenters JSON string:", s, "Error:", e.message);
return [];
}
}
console.log("Input string for operationWorkCenters is not an array or valid JSON string, it is " + typeof s, s);
return [];
Last updated