Config to order: ERPNext version of SAP’s variant configuration
Background
For product with lot of configuration options(item with variants) such as computer, the current system does not support creating master/super BOM with all possible components,instead variant item with assigned attribute values and corresponding BOM to be created, then it can be selected/used in sales and production process, creating a large number of item variants for each combination of attribute values in advance is inherently not efficient and practical, because on one hand it will generate a lot of redundant items and BOM master data which is difficult to manage when relevant changes happened, on the other hand, without knowing the real customer’s requirement (configuration) on the configurable product, most of the item variants and BOM created in advance will never be used in the end.
Proposed solution: order based variant configuration
- Define configuration template(like menu in restaurant): adding needed attributes/fields, and define rules( mandatory, conditional mandatory, dynamic dropdown list base on other field value
(Hint: used the custom doctype feature, which can be easily linked to sales order item as dynamic link field, support out of box mandatory, depends on, mandatory depends on feature, and form layout, most importantly support complex logic by custom script)
-
create configurable item: in item master mark it as is configurable and assign the configuration template
-
Create configurable item’s super BOM with all possible components(options), assign selection condition(either by link field(item as option) or python expression), quantity field to configurable components, leave selection condition empty to denote a default component.
- Make configurable item as valid/sellable item in relevant transactions(quotation,sales order,work order),force user to complete the configuration by filling the configuration template.
Generate order BOM based on the configuration details and super BOM(selection condition), calculate the configurable item’s sales price based on order BOM component
- Auto assign a serial number to the configurable sales order item, thus enable it to be booked and tracked by various stock movements.
Benefits
- No redundant item and BOM data
- R&D can focus on production definition: item, super BOM and configuration template, while business users focus on choose the options per customer requirement, system will enforce configuration rule (mandatory, dynamic dropdown list etc) and auto generate order BOM accordingly, also calculate the price.
Design Highlight
Meta (data structure)
-
Item doctype
New fields: is configurable(check),configuration doctype(depends on and mandatory depends on eval: doc.is_configurable)
Script Validation: if is_configurable, auto activate has_serial_no -
BOM doctype
New Fields: configuration doctype(readonly,fetch from item.configuration_doctype) -
BOM Item/Explosion Item Doctype
New fields:select condition(code field), item from configuration, qty from configuration(Data field with options: custom query)
*enhance the base control.js needed
depends on parent item is configurable
show only the valid configuration doctype’s fields for item from configuration, qty from configuration -
quotation item, sales order item, purchase order item, work order,
purchase receipt item, delivery note item, stock entry item doctypes:
New fields: configuration doctype(fetch from item, readonly/hidden), configuration docname(dynamic link, mandatory depends on configuration doctype),
*fix the mandatory depends on child table bug
config(button field, to directly invoke the config detail screen), configuration print template
after create/select configuration, return back to the orginal form after save and auto fill the docname field- fix the create new doc from link field dropdown menu return back to original form, only return to main form
-
serial number doctype
New fields: add sales order item field -
new doctypes
dynamic selection dropdown list per selected value on other attribute
conditional mandatory
conditional default value
conditional display/hideconfiguration rules: name, rule type(
configuration rule details
Business logic
-
Item
script set configuration doctype filter by custom
frappe.ui.form.on(‘Item’, {
onload(frm) {
frm.set_query(‘configuration_doctype’, function(){
return{
filters:{‘custom’: 1}
}
})
}
})
configuration doctype change auto set has serial -
sales order
ensure quantity is 1.
ensure only based on produced serial number.
generate configurable item’s description based on configuration doc’s print layout
calculate configurable item’s price based on configuration detail.
price logic: get item variant price, if not get template item price -
work order
modify make bom , only copy bom item when config.item_field=current item or selection condition is true
(frappe.safe_eval(“doc.name==‘nongye’ and doc.idx”, None,{“doc”:doc} ) )
overwrite quantity by config.qty_field
ensure qty is 1 -
BOM
ensure quantity is 1
custom script to set query based on configuration doctype for item from configuration, qty from configuration -
when goods receipt against work order and create delivery note for sales order, auto create and assign serial number
when submit, auto create serial number=so-item(or wo)+configuration doctype+configuration docname
APP is now available for testing and feedback
szfisher/config_to_order
Config To Order, ERPNext’s SAP variant configuration - szufisher/config_to_order
any comments, ideas are welcomed, if enough interest and positive feedback