ERPNext Error when creating Purchase Receipt

Hi Experts,

I am struggling with the following error (AttributeError: ‘NoneType’ object has no attribute ‘get’)when i am trying to create a Purchase Receipt from the Purchase Orders. Everything was working fine earlier, but lately this error seems to come in many of the ERPNext operations. I am adding the following snapshots below to better describe the errors. Your help is highly appreciated as we are having some downtime due to this error.

Error Report:
Please type some additional information that could help us reproduce this issue:
App Versions
{
“erpnext”: “13.18.0”,
“erpnext_support”: “0.0.3”,
“frappe”: “13.18.0”
}
Route
Form/Purchase Order/PO-QW2021-00019
Error Report
Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 68, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 31, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 67, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1208, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/model/mapper.py”, line 36, in make_mapped_doc
return method(source_name)
File “apps/erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py”, line 434, in make_purchase_receipt
}, target_doc, set_missing_values)
File “apps/frappe/frappe/model/mapper.py”, line 127, in get_mapped_doc
postprocess(source_doc, target_doc)
File “apps/erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py”, line 397, in set_missing_values
target.run_method(“calculate_taxes_and_totals”)
File “apps/frappe/frappe/model/document.py”, line 866, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 1159, in composer
return composed(self, method, *args, **kwargs)
File “apps/frappe/frappe/model/document.py”, line 1142, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “apps/frappe/frappe/model/document.py”, line 860, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “apps/erpnext/erpnext/controllers/accounts_controller.py”, line 259, in calculate_taxes_and_totals
calculate_taxes_and_totals(self)
File “apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 27, in init
self.calculate()
File “apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 34, in calculate
self._calculate()
File “apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 54, in _calculate
self.calculate_taxes()
File “apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 279, in calculate_taxes
current_tax_amount = self.get_current_tax_amount(item, tax, item_tax_map)
File “apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 368, in get_current_tax_amount
self.set_item_wise_tax(item, tax, tax_rate, current_tax_amount)
File “apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 376, in set_item_wise_tax
if tax.item_wise_tax_detail.get(key):
AttributeError: ‘NoneType’ object has no attribute ‘get’
Request Data
{
“type”: “POST”,
“args”: {
“method”: “erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt”,
“source_name”: “PO-QW2021-00019”,
“args”: null,
“selected_children”: “{}”
},
“freeze”: true,
“freeze_message”: “Creating Purchase Receipt …”,
“headers”: {},
“error_handlers”: {},
“url”: “/api/method/frappe.model.mapper.make_mapped_doc”
}
Response JSON
{
“exception”: “AttributeError: ‘NoneType’ object has no attribute ‘get’”
}

obviously you got an error right here :

File “apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 376, in set_item_wise_tax
if tax.item_wise_tax_detail.get(key):

apparently tax_item_wise_tax_detail does not exists

Hi Bahaou,

Thanks for the answer. Since i am quite new to ERPNext, can you elaborate a bit more on what parameter it might be? (Sorry if its a stupid question) :slight_smile:

Regards
Vishal Sharma

it’s just a variable related to the function that calculate taxes . it’s a very long function and no one should change it . you are not supposed to get this kind of errors in erpnext . if something is missing , you will get notified before the script is running . did you changed anything in the core ?
also are you using api to create this receipt ? and why the json request has no args and children ?

Hi Bahaou, I have not changed anything in the script. I am just using the standard interface to create the functionalities. Are you able to have a look at the interface and see if you can fix the issue? vsharma@qwave.no