You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The line uses a variable d.return_amount before assigning a value to it ( presumably from ref_doc.return_amount )
I changed line 351 to flt(d.unclaimed_amount) - flt(ref_doc.return_amount) and the bug disappeared, but I guess it is more elegant to add a line d.return_amount = ref_doc.return_amount before line 351.
Relevant log output / Stack trace / Full Error Message.
### Route
Form/Expense Claim/HR-EXP-2025-00368
### Traceback
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 114, in application
response = frappe.api.handle(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/api/__init__.py", line 49, in handle
data = endpoint(**arguments)
^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
returnfrappe.handler.handle()
^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/handler.py", line 50, in handle
data = execute_cmd(cmd)
^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
return frappe.call(method, **frappe.form_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/__init__.py", line 1726, in call
return fn(*args, **newargs)
^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/desk/form/save.py", line 37, in savedocs
doc.submit()
File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/model/document.py", line 1060, in submit
returnself._submit()
^^^^^^^^^^^^^^
File "apps/frappe/frappe/model/document.py", line 1043, in _submit
returnself.save()
^^^^^^^^^^^
File "apps/frappe/frappe/model/document.py", line 342, in save
return self._save(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/model/document.py", line 378, in _save
self.run_before_save_methods()
File "apps/frappe/frappe/model/document.py", line 1106, in run_before_save_methods
self.run_method("validate")
File "apps/frappe/frappe/model/document.py", line 974, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/model/document.py", line 1334, in composer
return composed(self, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/model/document.py", line 1316, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/model/document.py", line 971, in fn
return method_object(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/hrms/hrms/hr/doctype/expense_claim/expense_claim.py", line 50, in validate
self.validate_advances()
File "apps/hrms/hrms/hr/doctype/expense_claim/expense_claim.py", line 351, in validate_advances
flt(d.unclaimed_amount) - flt(d.return_amount)
^^^^^^^^^^^^^^^
AttributeError: 'ExpenseClaimAdvance' object has no attribute 'return_amount'### Response Data
{
"exception": "AttributeError: 'ExpenseClaimAdvance' object has no attribute 'return_amount'",
"exc_type": "AttributeError",
"_exc_source": "hrms (app)"
}
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Information about bug
Variable d.return_amount is not properly assigned with value.
Line 351 of https://github.com/frappe/hrms/blob/develop/hrms/hr/doctype/expense_claim/expense_claim.py
flt(d.unclaimed_amount) - flt(d.return_amount)
The line uses a variable d.return_amount before assigning a value to it ( presumably from ref_doc.return_amount )
I changed line 351 to
flt(d.unclaimed_amount) - flt(ref_doc.return_amount)
and the bug disappeared, but I guess it is more elegant to add a lined.return_amount = ref_doc.return_amount
before line 351.Thank you very reading.
Module
HR
Version
Installation method
None
Relevant log output / Stack trace / Full Error Message.
Code of Conduct
The text was updated successfully, but these errors were encountered: