Item Variants: Ability to define select fields in Template

Ref:

  1. [Item Variant]: Ability to Limit the Selection Options in Template · Issue #3932 · frappe/erpnext · GitHub

I would like to know if its possible to define the select fields in a template so that when we are creating a variant from that template then we could only choose the defined select fields.

Example: I have an attribute named Tool Type with the following values defined in the attribute table:

  1. Square
  2. Round
  3. Rectangular

Now when we are defining a template then I should have the ability to define the which options can be chosen in the variant. Like in our case we only want to show 2 options in a particular template but that is not possible in the current setup so is there a way we could do it via a customization.

What I am trying to do:

  1. Make a custom field in Item Variant table which would be allowed values as shown below:

  2. Now we should be able to define the tool type with Allowed values as “Square” and “Rectangular” in the template (the problem here is that there is a validation at server end which does not allow an attribute to be selected multiple times in a template)

  3. Currently we are able to choose all the values from the select fields as below:

Please let me know how should this kind of a problem be resolved either by a custom code or via a standard feature.

You can restrict by custom script

or create separate attributes for separate types of items. In your case Tool Type for Square Tool Bits

Can you help me what custom script i could write to show only a specified list of attribute values.

I have created a custom table inside the item master where I would define the allowed_values for the attribute, now I just want to show those values which are inside that table.

Try the second option :wink: