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

Salary Structure Employee custom field can be used in Formula and Condition #7615

Merged
merged 1 commit into from Feb 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions erpnext/hr/doctype/salary_slip/salary_slip.py
Expand Up @@ -89,8 +89,8 @@ def eval_condition_and_formula(self, d, data):
frappe.throw(_("Name error: {0}".format(err)))
except SyntaxError as err:
frappe.throw(_("Syntax error in formula or condition: {0}".format(err)))
except:
frappe.throw(_("Error in formula or condition"))
except Exception, e:
frappe.throw(_("Error in formula or condition: {0}".format(e)))
raise

def get_data_for_eval(self):
Expand All @@ -99,7 +99,7 @@ def get_data_for_eval(self):

for d in self._salary_structure_doc.employees:
if d.employee == self.employee:
data.base, data.variable = d.base, d.variable
data.update(frappe.get_doc("Salary Structure Employee", {"employee": self.employee}).as_dict())

data.update(frappe.get_doc("Employee", self.employee).as_dict())
data.update(self.as_dict())
Expand All @@ -108,7 +108,6 @@ def get_data_for_eval(self):
salary_components = frappe.get_all("Salary Component", fields=["salary_component_abbr"])
for salary_component in salary_components:
data[salary_component.salary_component_abbr] = 0

return data


Expand Down