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: Removed set_status after cancel from Expense Claim and Employee Advance #25901

Conversation

pateljannat
Copy link
Contributor

Issue

  1. From Expense Claim and Employee Advance, the set_status function is called explicitly.
  2. This is not needed as the Status gets updated to Cancelled even without calling these functions on cancel.

@ankush
Copy link
Member

ankush commented May 31, 2021

Semgrep failure is not false positive, though it may seem so because set_status is also called from validate.

If it's required in on_submit use self.db_set.

@pateljannat pateljannat added the HR label Jun 1, 2021
elif self.docstatus == 1 and self.approval_status == 'Rejected':
self.status = 'Rejected'
status = 'Rejected'
self.db_set("status", status)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since set_status is also called on validate when changes are not committed to the db, we can use a flag update=False in the method to understand whether to use db_set or not. Pass True to set_status when called from on_submit. Keep it false by default.

@ruchamahabal ruchamahabal merged commit 6c48a2e into frappe:version-13-hotfix Jul 27, 2021
@ruchamahabal
Copy link
Member

@pateljannat port this to develop too?

@ruchamahabal ruchamahabal added the backport develop instructs mergify to frontport PR to develop branch label Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport develop instructs mergify to frontport PR to develop branch HR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants