Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Not able Submit Material Request on v12

while creating Material Request above fatal error coming on one of our site which hosted on frappecloud.com. Not able to resolve fatal error below traceback is generating on console

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 67, in application
    response = frappe.api.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 59, in handle
    return frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 24, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 64, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1071, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 21, in savedocs
    doc.save()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 273, in save
    return self._save(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 296, in _save
    self.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 230, in insert
    self.run_before_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 896, in run_before_save_methods
    self.run_method("validate")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 797, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1073, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1056, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 791, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/material_request/material_request.py", line 62, in validate
    super(MaterialRequest, self).validate()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/buying_controller.py", line 38, in validate
    super(BuyingController, self).validate()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py", line 21, in validate
    super(StockController, self).validate()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py", line 112, in validate
    validate_einvoice_fields(self)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/__init__.py", line 129, in caller
    return frappe.get_attr(regional_overrides[region][fn_name])(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 26, in validate_einvoice_fields
    no_taxes_applied = len(doc.get('taxes', [])) == 0
TypeError: object of type 'NoneType' has no len()

Thanks for help in advance

I am also facing the same issue on a fresh site. Can anyone guide me to fix the issue

This issue already fixed. Merged into version12-hotfix branch. If you can change in your code will solve your problem or wait for next version 12 release.

https://github.com/frappe/erpnext/pull/24617/commits/08e7df2f77e3f037963d36dd29e2703da4884b05

2 Likes

Thanks ,

This fixes the issue for raising the Material request , But I get the same error when I submit that Material Request on the same line. Any thoughts.

return composed(self, method, *args, **kwargs) File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1056, in runner add_to_return_value(self, fn(self, *args, **kwargs)) File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 791, in <lambda> fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs) File "/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/material_request/material_request.py", line 62, in validate super(MaterialRequest, self).validate() File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/buying_controller.py", line 38, in validate super(BuyingController, self).validate() File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py", line 21, in validate super(StockController, self).validate() File "/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py", line 112, in validate validate_einvoice_fields(self) File "/home/frappe/frappe-bench/apps/erpnext/erpnext/__init__.py", line 129, in caller return frappe.get_attr(regional_overrides[region][fn_name])(*args, **kwargs) File "/home/frappe/frappe-bench/apps/erpnext/erpnext/regional/india/e_invoice/utils.py", line 26, in validate_einvoice_fields no_taxes_applied = not doc.get('taxes') TypeError: object of type 'NoneType' has no len()

@Maheshwari_Bhavesh after updating the code it will resolve hopefully.
@thaveedu if you are in Frappe Cloud then you need to update the setup to version-13 or you need to create a version-12 setup and restore the old DB on the new site.