I have a Custom field (Select field with certain set of Statuses) on PO for tracking Progress of PO, which is allowed to change after submit.
PO value is 2451.60 (3qty*817.20) when I try to change the Status after submission, I get an error saying “Not allowed to change Amount after submission”
My guess on what is happening here
- When I try to update the status, the system calculate the Amount again (on update), this value comes out to be 817.20*3=2451.6
- Since this value (2451.6) is not equal to the value in DB (2451.60), the system tries to replace it which is leading to this error [The calculated amount has only 1 decimal point as the 0 after decimal is not considered after calculation, where as the value in db has two decimal points]
I verified this theory by changing the rate on a duplicated PO to 817.21, therefore the amount is 2451.63. When I try to change the value in custom status field on this PO, there is no error.
Has anyone else faced this error before? How did you handle this?
Thanks
Full traceback for reference
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 60, in application
response = frappe.api.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 55, in handle
return 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 61, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1042, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 19, in savedocs
doc.submit()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 859, in submit
self._submit()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 848, in _submit
self.save()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 272, in save
return self._save(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 314, in _save
self.validate_update_after_submit()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 716, in validate_update_after_submit
d._validate_update_after_submit()
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 621, in _validate_update_after_submit
frappe.UpdateAfterSubmitError)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 364, in throw
msgprint(msg, raise_exception=exc, title=title, indicator='red')
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 350, in msgprint
_raise_exception()
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 316, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.UpdateAfterSubmitError: Not allowed to change Amount after submission
Number format in System settings and Currency is #,###.##
Float Precision and Currency Precision in System settings is unset
Precision via Customize form is unset