Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repay from salary #146

Open
1 task done
adhennon opened this issue Dec 1, 2023 · 2 comments · May be fixed by #195
Open
1 task done

repay from salary #146

adhennon opened this issue Dec 1, 2023 · 2 comments · May be fixed by #195
Labels
bug Something isn't working

Comments

@adhennon
Copy link

adhennon commented Dec 1, 2023

Information about bug

repay from salary checkbox was removed from loan doctype in erp next version 14 but we still get issues when submitting loan doctype like this one

AttributeError: 'Loan' object has no attribute 'repay_from_salary'

Module

Loan Management

Version

ERPNext: v14.46.1 (version-14)

Frappe Framework: v14.54.0 (version-14)

Installation method

docker

Relevant log output / Stack trace / Full Error Message.

### App Versions

{
	"erpnext": "14.46.1",
	"frappe": "14.54.0",
	"hrms": "16.0.0-dev"
}

Route

Form/Loan/new-loan-myogzjlkmu

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 95, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 47, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1622, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/desk/form/save.py", line 31, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 309, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 331, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 262, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1055, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 919, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1281, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1265, in runner
    add_to_return_value(self, f(self, method, *args, **kwargs))
  File "apps/hrms/hrms/hr/utils.py", line 687, in validate_loan_repay_from_salary
    if doc.applicant_type == "Employee" and doc.repay_from_salary:
AttributeError: 'Loan' object has no attribute 'repay_from_salary'

Code of Conduct

  • I agree to follow this project's Code of Conduct
@adhennon adhennon added the bug Something isn't working label Dec 1, 2023
@kittiu
Copy link
Contributor

kittiu commented Feb 14, 2024

I got the same error on Version 15

image

Currently, I have to add back this field to remove the error from my productoin.

nirzaf added a commit to nirzaf/lending that referenced this issue Aug 14, 2024
Fixes frappe#146

Add `repay_from_salary` attribute to Loan object in Loan Management module.

* **lending/loan_management/doctype/loan/loan.json**
  - Add `repay_from_salary` attribute to the fields list.
  - Set the `fieldtype` to "Check".
  - Set the `label` to "Repay From Salary".
  - Set the `default` to "0".

* **lending/loan_management/doctype/loan/loan.py**
  - Add the `repay_from_salary` attribute to the `Loan` class.
  - Update the `validate` method to handle the `repay_from_salary` attribute.
  - Update the `set_missing_fields` method to handle the `repay_from_salary` attribute.

* **lending/loan_management/doctype/loan/loan.js**
  - Add the `repay_from_salary` attribute to the `setup` method.
  - Update the `loan_application` method to handle the `repay_from_salary` attribute.

* **lending/loan_management/doctype/loan/loan_dashboard.py**
  - Add the `repay_from_salary` attribute to the `get_data` method.

* **lending/loan_management/doctype/loan/loan_list.js**
  - Add the `repay_from_salary` attribute to the `get_indicator` method.

* **lending/loan_management/doctype/loan_repayment/loan_repayment.js**
  - Add the `repay_from_salary` attribute to the `setup` method.
@nirzaf nirzaf linked a pull request Aug 14, 2024 that will close this issue
@mohsinalimat
Copy link

Facing same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants