Skip to content

Commit

Permalink
fix(Salary Structure): sanitize expression fields on `before_update_a…
Browse files Browse the repository at this point in the history
…fter_submit` too

- multiline formula updates error out on submitted doc because sanitization was only done on `before_validate`
  • Loading branch information
ruchamahabal committed Aug 31, 2024
1 parent 3057298 commit f95da27
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hrms/payroll/doctype/salary_structure/salary_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class SalaryStructure(Document):
def before_validate(self):
self.sanitize_condition_and_formula_fields()

def before_update_after_submit(self):
self.sanitize_condition_and_formula_fields()

def validate(self):
self.set_missing_values()
self.validate_amount()
Expand All @@ -30,6 +33,9 @@ def validate(self):
def on_update(self):
self.reset_condition_and_formula_fields()

def on_update_after_submit(self):
self.reset_condition_and_formula_fields()

def validate_formula_setup(self):
for table in ["earnings", "deductions"]:
for row in self.get(table):
Expand Down

0 comments on commit f95da27

Please sign in to comment.