Skip to content

Commit

Permalink
fix: Retention Bonus doc cancellation. (backport #1189) (#1208)
Browse files Browse the repository at this point in the history
* Fix (retention_bonus): doctype cancellation.
On cancellation, the user encounters the following error:
    AttributeError - 'RetentionBonus' object has no attribute 'additional_salary'.

* fix(retention_bonus): convert all of 'self.additional_salary' to 'additional_salary'  in cancel function

(cherry picked from commit e64cbde)

Co-authored-by: Sajad Alimoradi <[email protected]>
  • Loading branch information
mergify[bot] and SajadAlimoradi authored Dec 26, 2023
1 parent 77e0917 commit a8a1341
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hrms/payroll/doctype/retention_bonus/retention_bonus.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def on_submit(self):
def on_cancel(self):

additional_salary = self.get_additional_salary()
if self.additional_salary:
if additional_salary:
bonus_removed = (
frappe.db.get_value("Additional Salary", self.additional_salary, "amount") - self.bonus_amount
frappe.db.get_value("Additional Salary", additional_salary, "amount") - self.bonus_amount
)
if bonus_removed == 0:
frappe.get_doc("Additional Salary", self.additional_salary).cancel()
frappe.get_doc("Additional Salary", additional_salary).cancel()
else:
frappe.db.set_value("Additional Salary", self.additional_salary, "amount", bonus_removed)
frappe.db.set_value("Additional Salary", additional_salary, "amount", bonus_removed)

# self.db_set('additional_salary', '')

Expand Down

0 comments on commit a8a1341

Please sign in to comment.