erpnext icon indicating copy to clipboard operation
erpnext copied to clipboard

TypeError: 'NoneType' object is not iterable on saving JE of type credit note

Open nidhipurohit11 opened this issue 2 years ago • 0 comments

Information about bug

While checking - https://github.com/frappe/erpnext/pull/27451

  • Creating a new journal entry >> type "Credit Note"
  • Checked the "Apply Tax Withholding Amount" checkbox, and filled required details in the child table (as shown in screenshot below)
  • Saving the JE is showing an error - "TypeError: 'NoneType' object is not iterable"

Screenshot 2022-07-22 at 5 13 43 PM

Module

accounts

Version

ERPNext: v14.0.0-dev (HEAD) Frappe Framework: v14.0.0-dev (HEAD)

Installation method

FrappeCloud

Relevant log output / Stack trace / Full Error Message.

request.js:438 Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 69, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 45, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 83, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1579, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 298, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 320, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 252, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1053, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 925, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1265, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1247, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 922, in fn
    return method_object(*args, **kwargs)
  File "apps/erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py", line 74, in validate
    self.apply_tax_withholding()
  File "apps/erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.py", line 187, in apply_tax_withholding
    tax_withholding_details = get_party_tax_withholding_details(inv, self.tax_withholding_category)
  File "apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 112, in get_party_tax_withholding_details
    tax_amount, tax_deducted, tax_deducted_on_advances = get_tax_amount(
  File "apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 232, in get_tax_amount
    tax_deducted_on_advances = get_taxes_deducted_on_advances_allocated(inv, tax_details)
  File "apps/erpnext/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py", line 333, in get_taxes_deducted_on_advances_allocated
    advances = [d.reference_name for d in inv.get("advances")]
TypeError: 'NoneType' object is not iterable

nidhipurohit11 avatar Jul 22 '22 11:07 nidhipurohit11

Fixed Via: https://github.com/frappe/erpnext/pull/32204

deepeshgarg007 avatar Sep 16 '22 08:09 deepeshgarg007