Payment Days Dependency
Row #2: The House Rent Allowance Component has the options Amount based on formula and Depends On Payment Days enabled.
v14–>
In Version - 13 it was working well. !!
Row #2: The House Rent Allowance Component has the options Amount based on formula and Depends On Payment Days enabled.
v14–>
In Version - 13 it was working well. !!
How can write the formula as per the below scenario
HRA = ( base - B ) / total_working_days * payment_days
# abbreviations = self.get_component_abbreviations()
# for component_type in ("earnings", "deductions"):
# for row in self.get(component_type):
# if (
# row.formula
# and row.depends_on_payment_days
# # check if the formula contains any of the payment days components
# and any(re.search(r"\b" + abbr + r"\b", row.formula) for abbr in abbreviations)
# ):
# message = _("Row #{0}: The {1} Component has the options {2} and {3} enabled.").format(
# row.idx,
# frappe.bold(row.salary_component),
# frappe.bold("Amount based on formula"),
# frappe.bold("Depends On Payment Days"),
# )
# message += "<br><br>" + _(
# "Disable {0} for the {1} component, to prevent the amount from being deducted twice, as its formula already uses a payment-days-based component."
# ).format(
# frappe.bold("Depends On Payment Days"), frappe.bold(row.salary_component)
# )
# frappe.throw(message, title=_("Payment Days Dependency"))