Cancel expense claim error | IntegrityError: (1048, u"Column ‘claimed_amount’ cannot be null")

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 45, in cancel
doc.cancel()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 839, in cancel
self._cancel()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 829, in _cancel
self.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 259, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 310, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 895, in run_post_save_methods
self.run_method(“on_cancel”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 758, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1027, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1010, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 752, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/hr/doctype/expense_claim/expense_claim.py”, line 88, in on_cancel
self.update_claimed_amount_in_employee_advance()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/hr/doctype/expense_claim/expense_claim.py”, line 92, in update_claimed_amount_in_employee_advance
frappe.get_doc(“Employee Advance”, d.employee_advance).update_claimed_amount()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/hr/doctype/employee_advance/employee_advance.py”, line 63, in update_claimed_amount
frappe.db.set_value(“Employee Advance”, self.name, “claimed_amount”, claimed_amount)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 678, in set_value
values, debug=debug)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 166, in sql
self._cursor.execute(query, values)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py”, line 165, in execute
result = self._query(query)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py”, line 321, in _query
conn.query(q)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 860, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1061, in _read_query_result
result.read()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1349, in read
first_packet = self.connection._read_packet()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1018, in _read_packet
packet.check_error()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 384, in check_error
err.raise_mysql_exception(self._data)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/err.py”, line 107, in raise_mysql_exception
raise errorclass(errno, errval)
IntegrityError: (1048, u"Column ‘claimed_amount’ cannot be null")

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 939, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 45, in cancel
doc.cancel()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 839, in cancel
self._cancel()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 829, in _cancel
self.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 259, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 310, in _save
self.run_post_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 895, in run_post_save_methods
self.run_method(“on_cancel”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 758, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1027, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1010, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 752, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/hr/doctype/expense_claim/expense_claim.py”, line 88, in on_cancel
self.update_claimed_amount_in_employee_advance()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/hr/doctype/expense_claim/expense_claim.py”, line 92, in update_claimed_amount_in_employee_advance
frappe.get_doc(“Employee Advance”, d.employee_advance).update_claimed_amount()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/hr/doctype/employee_advance/employee_advance.py”, line 63, in update_claimed_amount
frappe.db.set_value(“Employee Advance”, self.name, “claimed_amount”, claimed_amount)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 678, in set_value
values, debug=debug)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 166, in sql
self._cursor.execute(query, values)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py”, line 165, in execute
result = self._query(query)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py”, line 321, in _query
conn.query(q)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 860, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1061, in _read_query_result
result.read()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1349, in read
first_packet = self.connection._read_packet()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1018, in _read_packet
packet.check_error()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 384, in check_error
err.raise_mysql_exception(self._data)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/err.py”, line 107, in raise_mysql_exception
raise errorclass(errno, errval)
IntegrityError: (1048, u"Column ‘claimed_amount’ cannot be null")

actually iam trying to cancel submitted expense claim giving me can’t cancel and give me this error

any update

There is some field called Claimed Amount and the traceback shows that this value cannot be empty, so feed the correct value. Just a simple entry error that’s all.

Can you share the version of your erpnext app

it is already had value

As a temporary fix (although not ideal), you could try something similar to this

1 Like

Your erpnext app version is 10.1.37, where as current stable erpnext version is v10.1.54. You need to update your erpnext app to v10.1.54 to fix this issue

2 Likes

Hi @rohit_w

Trust you’re doing great. We are encountering the same issue:

ERPNext: v10.1.64 (master)
Frappe Framework: v10.1.56 (master)

Please advise

Kind regards,

Hi @wale

Can you check the employee_advance.json file has the field claimed_amount or not, if the field is there then just changed the modified date to today’s date and run the “bench --site your_site_name migrate” command

Hi @rohit_w

Thanks for your response. The claimed_amount field is present in the employee_advance.json

I updated the modified date and ran the bench migrate command as advised but the error persists!

Any suggestions pls?

Hi @wale

The same field is available in the doctype employee advance?

Hi @rohit_w

Are you referring to js or py file? Please clarify

Thanks

Hi @rohit_w

In case you were referring to the DocType list, yes the field is in Employee Advance. It is a Currency type field with options set as Company:company:default_currency

Hi @rohit_w

Trust you’re doing great. Any update here please? We really need a fix

Thanks

Still awaiting a response on this please!

Thanks

Hi @rohit_w

Trust you’re doing well. Really need some feedback on this. It’s affecting our operations significantly!

Thanks

Sent fix for this issue

1 Like

Many thanks @rohit_w

I hope this gets merged asap

Kind regards,