Skip to content

Commit

Permalink
fix: rename field
Browse files Browse the repository at this point in the history
(cherry picked from commit 6607739)
  • Loading branch information
saurabh6790 authored and mergify[bot] committed May 2, 2023
1 parent 109ba11 commit c55eefa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions hrms/payroll/doctype/payroll_settings/payroll_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"column_break_rnoq",
"define_opening_balance_for_earning_and_deductions",
"process_payroll_accounting_entry_based_on_employee",
"include_zero_value_salary_component_in_salary_slip",
"show_zero_value_components",
"column_break_6",
"max_working_hours_against_timesheet",
"daily_wages_fraction_for_half_day",
Expand Down Expand Up @@ -110,22 +110,22 @@
"fieldtype": "Check",
"label": "Define Opening Balance for Earning and Deductions"
},
{
"default": "0",
"fieldname": "include_zero_value_salary_component_in_salary_slip",
"fieldtype": "Check",
"label": "Include Zero Value Salary Component in Salary Slip"
},
{
"fieldname": "column_break_rnoq",
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "show_zero_value_components",
"fieldtype": "Check",
"label": "Show Zero Value Components in Salary Slip"
}
],
"icon": "fa fa-cog",
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2023-02-22 12:21:31.266958",
"modified": "2023-02-22 15:51:21.796524",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Payroll Settings",
Expand Down
20 changes: 10 additions & 10 deletions hrms/payroll/doctype/salary_slip/salary_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,8 @@ def calculate_component_amounts(self, component_type):

def add_structure_components(self, component_type):
self.data, self.default_data = self.get_data_for_eval()
allow_zero_value_component = frappe.db.get_single_value(
"Payroll Settings", "include_zero_value_salary_component_in_salary_slip"
show_zero_value_components = frappe.db.get_single_value(
"Payroll Settings", "show_zero_value_components"
)

timesheet_component = frappe.db.get_value(
Expand Down Expand Up @@ -978,12 +978,12 @@ def add_structure_components(self, component_type):
component_type,
data=self.data,
default_amount=default_amount,
allow_zero_value_component=allow_zero_value_component,
show_zero_value_components=show_zero_value_components,
)

if allow_zero_value_component:
if show_zero_value_components:
self.update_component_row(
struct_row, amount, component_type, allow_zero_value_component=allow_zero_value_component
struct_row, amount, component_type, show_zero_value_components=show_zero_value_components
)

def get_data_for_eval(self):
Expand Down Expand Up @@ -1165,7 +1165,7 @@ def update_component_row(
is_recurring=0,
data=None,
default_amount=None,
allow_zero_value_component=None,
show_zero_value_components=None,
):
component_row = None
for d in self.get(component_type):
Expand All @@ -1192,7 +1192,7 @@ def update_component_row(
)

if not component_row:
if not amount and not allow_zero_value_component:
if not amount and not show_zero_value_components:
return

component_row = self.append(component_type)
Expand Down Expand Up @@ -1232,21 +1232,21 @@ def update_component_row(

component_row.amount = amount

self.update_component_amount_based_on_payment_days(component_row, allow_zero_value_component)
self.update_component_amount_based_on_payment_days(component_row, show_zero_value_components)

if data:
data[component_row.abbr] = component_row.amount

def update_component_amount_based_on_payment_days(
self, component_row, allow_zero_value_component=None
self, component_row, show_zero_value_components=None
):
joining_date, relieving_date = self.get_joining_and_relieving_dates()
component_row.amount = self.get_amount_based_on_payment_days(
component_row, joining_date, relieving_date
)[0]

# remove 0 valued components that have been updated later
if component_row.amount == 0 and not allow_zero_value_component:
if component_row.amount == 0 and not show_zero_value_components:
self.remove(component_row)

def set_precision_for_component_amounts(self):
Expand Down

0 comments on commit c55eefa

Please sign in to comment.