cardinal
Stock

Item variants

Make one template item and its variants by attribute, such as a T-shirt in three sizes and two colours.

A template Item holds what its variants share. Each variant is an ordinary Item with its own code and stock, made from the template and a value per attribute. A template itself cannot go on a voucher.

Attributes

An Item Attribute is a named property with its values.

KindFields
Listed valuesItem Attribute Values rows, each a value and an abbreviation, such as Small / S
NumericNumeric Values on, with From Range, To Range and Increment

A duplicate value or abbreviation, and an increment of zero, are refused.

Make a template and variants

Create Item Attributes Size (Small S, Medium M, Large L) and Colour (Red RED, Blue BLU).

Create the template Item TSHIRT. Tick Has Variants. In Variant Attributes add Size and Colour. Save.

Make the variants with the RPCs below. create_multiple_variants makes every missing combination.

curl -X POST https://erp.acme.com/api/rpc/erp.item.create_multiple_variants \
  -H "Authorization: token $KEY:$SECRET" -H 'Content-Type: application/json' \
  -d '{"item": "TSHIRT", "args": {"Size": ["Small", "Medium", "Large"], "Colour": ["Red", "Blue"]}}'

That makes six items. Each code is the template code and the abbreviations: TSHIRT-S-RED, TSHIRT-M-BLU and so on. The item names follow the same pattern from the template's name.

RPCDoes
erp.item.create_variantReturns one unsaved variant for item and args, for you to save
erp.item.create_multiple_variantsInserts every missing combination and returns the count
erp.item.get_variantReturns the variant whose attributes match args, or nothing

What a variant copies

Item Variant Settings lists the Item fields a template copies onto its variants. On first save it fills the list with every Item field except layout fields and a few others: the code, name, naming series, opening stock, valuation rate and the variant links. Barcodes, Variant Attributes, Has Variants and Variant Of cannot be listed.

Saving the template pushes the listed fields onto its existing variants.

SettingEffect
Do not update variants on saveSaving the template leaves the variants alone
Allow Variant UOM to be different from Template UOMA variant may have its own stock UOM
Allow Rename Attribute ValueStored only

Report

Item Variant Details lists a template's variants with a column per attribute, their stock and their prices.

On this page