How to enable batch from Item Master? ValidationError: The selected item cannot have Batch

I’m having with all the permissions & having with Administrator privileges. But, still I’m not able to create batch no. for any product, I had referred docs & tutorials as well. But still, no luck.

Can anyone help me to create batch no., with the correct procedure? Might be, there are lots of upgrades & validations, which might be affecting the functionality, before validations get completed. I have no option to enable this from Item Master, If I go through Stock Settings > Batch > Create Batch. This process also, producing a validation message, “The selected item cannot have Batch”.

& Also, console is generating traceback, as follows: (Kindly help If I had missed something)

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/app.py", line 62, in application
    response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/handler.py", line 22, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/handler.py", line 53, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/__init__.py", line 939, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/client.py", line 135, in insert
    doc = frappe.get_doc(doc).insert()
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/model/document.py", line 218, in insert
    self.run_before_save_methods()
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/model/document.py", line 859, in run_before_save_methods
    self.run_method("validate")
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/model/document.py", line 755, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/model/document.py", line 1024, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/model/document.py", line 1007, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/model/document.py", line 749, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/nightly/apps/erpnext/erpnext/stock/doctype/batch/batch.py", line 33, in validate
    self.item_has_batch_enabled()
  File "/home/frappe/frappe-bench/nightly/apps/erpnext/erpnext/stock/doctype/batch/batch.py", line 37, in item_has_batch_enabled
    frappe.throw(_("The selected item cannot have Batch"))
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/__init__.py", line 323, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red')
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/__init__.py", line 309, in msgprint
    _raise_exception()
  File "/home/frappe/frappe-bench/nightly/apps/frappe/frappe/__init__.py", line 282, in _raise_exception
    raise raise_exception(encode(msg))
ValidationError: The selected item cannot have Batch

Here are the screenshot:(someone can reproduce?)


&

Have you checked “Has Batch No” check box in the Item setup?

Thanks @Pawan for looking into this!! I updated the question with screenshots !! Actually, I’m not able to enable checkbox “Has Batch No”. There might be some validation, not helping me to do so. Can you check into this?

Make the item as “Stock Item”

1 Like

Has Batch No only work, till Item not yet saved. If you saved an item, and after that, you want to update Batch, you won’t be able to add/update to enable/disable the feature “Has Batch No”.

Kindly all, make sure. If you want to enable Has Batch No feature, you should avoid using “Quick Entry”, because once you saved item, you won’t be able to revert !! Eventhough, Item is “Stock Item”.

@Pawan, You’re one of the senior contributors, don’t you look this fishy part? Just gaining knowledge, why we can’t enable/disable Has Batch No checkbox, after Item get saved? Any reason, just want to learn. Or, it’s just usual bug?

Actually I am vegetarian :slight_smile: so I stay away from fish :slight_smile:

If you have stock entries against the item or transactions against it you won’t be able to change it back. However if you don’t you will be able to change the set up.

1 Like