Cannot create Item Variants Version 13

With the latest release of version 13. I am not able to create variants from item template. Apparently when we click create variant and enter the attributes value. It does not copy the attributes value to the new item creation.
Any ones else facing the same issue?

please provide installed frappe , erpnext app version, and also the error message screenshot.

ERPNext: v13.1.0 (version-13)
Frappe Framework: v13.1.2 (version-13)

Attribute Values not being added

Traceback (most recent call last):
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/", line 67, in application
    response = frappe.api.handle()
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/", line 58, in handle
    return frappe.handler.handle()
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/", line 32, in handle
    data = execute_cmd(cmd)
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/", line 68, in execute_cmd
    return, **frappe.form_dict)
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/", line 1166, in call
    return fn(*args, **newargs)
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/desk/form/", line 21, in savedocs
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/model/", line 284, in save
    return self._save(*args, **kwargs)
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/model/", line 306, in _save
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/model/", line 232, in insert
    self.set_new_name(set_name=set_name, set_child_names=set_child_names)
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/model/", line 422, in set_new_name
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/model/", line 55, in set_new_name
    frappe.throw(_("{0} is required").format(doc.meta.get_label(fieldname)))
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/", line 424, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/", line 403, in msgprint
  File "/Users/ahmad/frappe/bench-13/apps/frappe/frappe/", line 357, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Item Code is required

refer to this github issue

this is caused by incorrectly added attribute field into the item variant setting fields list.
related code is at erpnext.controllers.item_variant.copy_attribute_to_variant
allow_fields = [d.field_name for d in frappe.get_all(“Variant Field”, fields = [‘field_name’])]

make sure both 2 fields: attribute and has_variants not among the fields list.


Thanks. Deleting these fields resolved the issue.

I also suggest to add it in the code to make it fail safe. In the exclude_fields