AttributeError: 'NoneType' object has no attribute 'fieldtype' in Sales and Purchase Invoice

Hi all, this is my first time posting anything so I must say thanks to all involved with the system. It is really a great product you have here.

I have installed a couple of instances of ErpNext on different machines but have never come up with this error, however today I installed a new ErpNext instance on a machine with another instance running, everything went well enough except on the new installtion whenever I try to create a Sales or Purchase Invoice I get this error.

AttributeError: ‘NoneType’ object has no attribute ‘fieldtype’.

Here is the full errror:
Traceback (most recent call last):
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/app.py”, line 57, in application
response = frappe.handler.handle()
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/init.py”, line 923, in call
return fn(*args, **newargs)
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/model/document.py”, line 230, in save
return self._save(*args, **kwargs)
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/model/document.py”, line 253, in _save
self.insert()
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/model/document.py”, line 192, in insert
self.run_before_save_methods()
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/model/document.py”, line 772, in run_before_save_methods
self.run_method(“validate”)
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/model/document.py”, line 666, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/model/document.py”, line 887, in composer
return composed(self, method, *args, **kwargs)
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/model/document.py”, line 870, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/model/document.py”, line 660, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/aisenyi/frappe-bench-pos/apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py”, line 45, in validate
super(PurchaseInvoice, self).validate()
File “/home/aisenyi/frappe-bench-pos/apps/erpnext/erpnext/controllers/buying_controller.py”, line 31, in validate
super(BuyingController, self).validate()
File “/home/aisenyi/frappe-bench-pos/apps/erpnext/erpnext/controllers/stock_controller.py”, line 17, in validate
super(StockController, self).validate()
File “/home/aisenyi/frappe-bench-pos/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 37, in validate
self.calculate_taxes_and_totals()
File “/home/aisenyi/frappe-bench-pos/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 88, in calculate_taxes_and_totals
calculate_taxes_and_totals(self)
File “/home/aisenyi/frappe-bench-pos/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 15, in init
self.calculate()
File “/home/aisenyi/frappe-bench-pos/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 19, in calculate
self._calculate()
File “/home/aisenyi/frappe-bench-pos/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 38, in _calculate
self.calculate_totals()
File “/home/aisenyi/frappe-bench-pos/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 303, in calculate_totals
self._set_in_company_currency(self.doc, [“total_taxes_and_charges”, “rounding_adjustment”])
File “/home/aisenyi/frappe-bench-pos/apps/erpnext/erpnext/controllers/taxes_and_totals.py”, line 81, in set_in_company_currency
val = flt(flt(doc.get(f), doc.precision(f)) * self.doc.conversion_rate, doc.precision("base
" + f))
File “/home/aisenyi/frappe-bench-pos/apps/frappe/frappe/model/base_document.py”, line 692, in precision
if df.fieldtype in (“Currency”, “Float”, “Percent”):
AttributeError: ‘NoneType’ object has no attribute ‘fieldtype’

Could anybody help?

Seems like there are no fields called "base_total_taxes_and_charges” or “base_rounding_adjustment” in Sales Invoice doctype. Can you confirm?

If that is the case, try to execute bench reload-doc accounts doctype sales_invoice from frappe-bench directory.

2 Likes

Hi, thanks for the reply. This issue was fixed with a simple update. Not really sure what the problem was but on my next update it fixed itself. Thanks.