Manufacturing Sub Service - Nioron07/Easy-Acumatica GitHub Wiki
This guide covers the ManufacturingService
, which is your primary tool for interacting with manufacturing-specific entities like ConfigurationEntry
.
1. Understanding the Service's Purpose
The ManufacturingService
is designed for working with product configurations. It allows you to retrieve existing configurations and update them, which is essential for managing customizable products within Acumatica's manufacturing modules. Note that this service uses the MANUFACTURING
endpoint prefix instead of Default
.
2. Importing Helpers
Before you start, import the necessary builder for creating configuration payloads.
from easy_acumatica.models.configuration_entry_builder import ConfigurationEntryBuilder
3. Retrieving a Configuration
The service provides a method to fetch a complete configuration entry by its ID.
get_configuration_entry(api_version, configuration_id)
This method retrieves a single ConfigurationEntry
record. It automatically expands the Attributes
and Features/Options
to give you a complete view of the configuration.
Parameters
api_version
(str): The API version segment (e.g., '25.100.001').configuration_id
(str): The unique ID of the configuration entry to retrieve.
Returns
Dict[str, Any]
: A dictionary representing the complete configuration entry.
Example: Fetching a configuration and listing its features
# The ID of the configuration to fetch
config_id = "MYCONFIG001"
try:
# 1. Call the get_configuration_entry method
config_entry = client.manufacturing.get_configuration_entry("25.100.001", config_id)
# 2. Process and display the results
print(f"--- Configuration Details for {config_id} ---")
features = config_entry.get('Features', [])
for feature in features:
feature_id = feature.get('FeatureID', {}).get('value', 'N/A')
print(f"\nFeature: {feature_id}")
options = feature.get('Options', [])
for option in options:
option_id = option.get('OptionID', {}).get('value', 'N/A')
selected = option.get('Selected', {}).get('value', False)
print(f" - Option: {option_id} (Selected: {selected})")
except Exception as e:
print(f"Failed to retrieve configuration entry: {e}")
Example JSON Response
The config_entry
variable in the example above would contain a JSON object similar to this:
{
"id": "...",
"rowNumber": 1,
"note": "",
"ConfigurationID": { "value": "MYCONFIG001" },
"Attributes": [
{
"id": "...",
"rowNumber": 1,
"AttributeID": { "value": "FINISH" },
"Value": { "value": "MATTE" }
}
],
"Features": [
{
"id": "...",
"rowNumber": 1,
"FeatureID": { "value": "COLOR" },
"Options": [
{
"id": "...",
"rowNumber": 1,
"OptionID": { "value": "RED" },
"Selected": { "value": false }
},
{
"id": "...",
"rowNumber": 2,
"OptionID": { "value": "BLUE" },
"Selected": { "value": false }
}
]
}
],
"custom": {},
"$type": "ConfigurationEntry"
}
4. Updating a Configuration
To update a configuration, you must first build a payload using the ConfigurationEntryBuilder
.
update_configuration_entry(api_version, builder)
This method sends your changes to a ConfigurationEntry
. You must provide the ConfigurationID
within the builder to identify the record to update.
Parameters
api_version
(str): The API version segment (e.g., '25.100.001').builder
(ConfigurationEntryBuilder): A builder instance containing the ID of the configuration and the fields to update.
Example: Updating a feature option for a configuration
from easy_acumatica.models.configuration_entry_builder import ConfigurationEntryBuilder
# 1. Build the configuration payload
# This assumes a builder with methods to set the ID and update options.
config_update_payload = (
ConfigurationEntryBuilder()
.id("MYCONFIG001")
.set_option_selected("COLOR", "BLUE", True) # FeatureID, OptionID, Selected
.set_attribute("FINISH", "GLOSS") # AttributeID, Value
)
# 2. Use the payload with the ManufacturingService to update the record
try:
updated_config = client.manufacturing.update_configuration_entry(
"25.100.001",
builder=config_update_payload
)
print(f"Successfully updated configuration: {updated_config['ConfigurationID']['value']}")
except Exception as e:
print(f"Failed to update configuration: {e}")
Example JSON Response
The updated_config
variable would contain the full configuration object reflecting the changes, similar to the get
method's response:
{
"id": "...",
"rowNumber": 1,
"note": "",
"ConfigurationID": { "value": "MYCONFIG001" },
"Attributes": [
{
"id": "...",
"rowNumber": 1,
"AttributeID": { "value": "FINISH" },
"Value": { "value": "GLOSS" }
}
],
"Features": [
{
"id": "...",
"rowNumber": 1,
"FeatureID": { "value": "COLOR" },
"Options": [
{
"id": "...",
"rowNumber": 1,
"OptionID": { "value": "RED" },
"Selected": { "value": false }
},
{
"id": "...",
"rowNumber": 2,
"OptionID": { "value": "BLUE" },
"Selected": { "value": true }
}
]
}
],
"custom": {},
"$type": "ConfigurationEntry"
}