Skip to content

Commit

Permalink
refactor: combine nested if
Browse files Browse the repository at this point in the history
  • Loading branch information
rs-rethik authored and venkat102 committed Jan 8, 2025
1 parent 8e2d9f1 commit 5d3e23b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions hrms/hr/doctype/expense_claim/expense_claim.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ def set_status(self, update=False):
self.status = status

def validate_company_and_department(self):
if self.department:
if self.company != frappe.db.get_value("Department", self.department, "company"):
frappe.throw(
_("Department {0} does not belong to company: {1}").format(self.department, self.company),
exc=MismatchError,
)
if self.department and self.company != frappe.db.get_value("Department", self.department, "company"):
frappe.throw(
_("Department {0} does not belong to company: {1}").format(self.department, self.company),
exc=MismatchError,
)

def on_update(self):
share_doc_with_approver(self, self.expense_approver)
Expand Down

0 comments on commit 5d3e23b

Please sign in to comment.