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

fix: expire_allocation api endpoint by fetching allocation object (backport #1576) #2194

Merged
merged 2 commits into from
Sep 16, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Sep 16, 2024

Add the code to fetch allocation in expire_allocation endpoint so that after code not break.

Traceback of error which is fixed

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, 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
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, 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 1682, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/hr/doctype/leave_ledger_entry/leave_ledger_entry.py", line 193, in expire_allocation
    leaves = get_remaining_leaves(allocation)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/hrms/hrms/hr/doctype/leave_ledger_entry/leave_ledger_entry.py", line 178, in get_remaining_leaves
    "employee": allocation.employee,
                ^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'employee'
```<hr>This is an automatic backport of pull request #1576 done by [Mergify](https://mergify.com).

)

* fix: expire_allocation api endpoint by fetching allocation object

* fix: add a check to fetch allocation only if the allocation type is str in the expire_allocation endpoint

* feat: add a test case test_expire_allocation for leave ledger entry doctype

(cherry picked from commit 6ddfdac)

# Conflicts:
#	hrms/hr/doctype/leave_allocation/leave_allocation.js
@mergify mergify bot added the conflicts label Sep 16, 2024
Copy link
Contributor Author

mergify bot commented Sep 16, 2024

Cherry-pick of 6ddfdac has failed:

On branch mergify/bp/version-14-hotfix/pr-1576
Your branch is up to date with 'origin/version-14-hotfix'.

You are currently cherry-picking commit 6ddfdac36.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   hrms/hr/doctype/leave_ledger_entry/leave_ledger_entry.py
	modified:   hrms/hr/doctype/leave_ledger_entry/test_leave_ledger_entry.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   hrms/hr/doctype/leave_allocation/leave_allocation.js

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@ruchamahabal ruchamahabal merged commit 8e8380e into version-14-hotfix Sep 16, 2024
7 checks passed
@mergify mergify bot deleted the mergify/bp/version-14-hotfix/pr-1576 branch September 16, 2024 07:38
frappe-pr-bot pushed a commit that referenced this pull request Sep 18, 2024
# [14.31.0](v14.30.1...v14.31.0) (2024-09-18)

### Bug Fixes

* expire_allocation api endpoint by fetching allocation object (backport [#1576](#1576)) ([#2194](#2194)) ([8e8380e](8e8380e))
* **Income Tax Computation:** consideration of new employees without prexisting salary slips ([ceb718f](ceb718f))
* **Monthly Attendance Sheet:** consideration of None values while grouping ([cdbce8e](cdbce8e))
* remove default from Employee Leave Balance report (backport [#2172](#2172)) ([#2190](#2190)) ([967b4bd](967b4bd))
* show shift for month full of leaves ([1a00af0](1a00af0))
* year_start_date in Employee Advance Summary (backport [#2165](#2165)) ([#2192](#2192)) ([51cb889](51cb889))

### Features

* **Monthly Attendance Sheet:** add Include Company Descendants filter ([bf0970c](bf0970c))
@frappe-pr-bot
Copy link
Collaborator

🎉 This PR is included in version 14.31.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants