Skip to content

Commit

Permalink
Merge pull request #1562 from frappe/version-15-hotfix
Browse files Browse the repository at this point in the history
chore: release v15
  • Loading branch information
krantheman authored Mar 20, 2024
2 parents fe0d1e7 + c70603b commit bccdc2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions hrms/hr/doctype/employee_advance/employee_advance.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def onload(self):

def validate(self):
validate_active_employee(self.employee)
self.validate_exchange_rate()
self.set_status()

def on_cancel(self):
Expand All @@ -43,6 +44,10 @@ def publish_update(self):
employee_user = frappe.db.get_value("Employee", self.employee, "user_id", cache=True)
hrms.refetch_resource("hrms:employee_advance_balance", employee_user)

def validate_exchange_rate(self):
if not self.exchange_rate:
frappe.throw(_("Exchange Rate cannot be zero."))

def set_status(self, update=False):
precision = self.precision("paid_amount")
total_amount = flt(flt(self.claimed_amount) + flt(self.return_amount), precision)
Expand Down
3 changes: 2 additions & 1 deletion hrms/overrides/employee_payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def set_missing_ref_details(
d.reference_doctype, d.reference_name, self.party_account_currency
)

if ref_exchange_rate:
# Only update exchange rate when the reference is Journal Entry
if ref_exchange_rate and d.reference_doctype == "Journal Entry":
ref_details.update({"exchange_rate": ref_exchange_rate})

for field, value in ref_details.items():
Expand Down

0 comments on commit bccdc2f

Please sign in to comment.