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(Expense Claim): get_taxes condition (backport #2077) #2079

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Aug 14, 2024

Issue

After adding a few rows in the expenses table, new ones randomly become uneditable.

a20um1Z

Investigation

It seems to occur because of the following code, which is executed every time the sanctioned amount in an expense is updated. Not entirely sure why, but turns out that making any server side call causes this to happen.

	get_taxes: function (frm) {
		if (frm.doc.taxes) {
			frappe.call({
				method: "calculate_taxes",
				doc: frm.doc,
				callback: () => {
					refresh_field("taxes");
					frm.trigger("update_employee_advance_claimed_amount");
				},
			});
		}
	},

Temporary Solution

The get_taxes function is meant to run only if there are taxes added in the expense claim document. However, an empty array being a truthy value, frm.doc.taxes in if (frm.doc.taxes) always returns true and this call is made for every expense.

Fixing this condition, at the very least, prevents this issue from occurring for most users (who I'm guessing add their taxes after their expenses). However, a more universal fix, involving business logic refactoring, may be in order.


This is an automatic backport of pull request #2077 done by Mergify.

(cherry picked from commit 1a74f41)
@mergify mergify bot requested a review from ruchamahabal as a code owner August 14, 2024 09:35
@krantheman krantheman merged commit 04138ff into version-14-hotfix Aug 14, 2024
5 checks passed
@krantheman krantheman deleted the mergify/bp/version-14-hotfix/pr-2077 branch August 14, 2024 09:40
@frappe-pr-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 14.30.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.

2 participants