fix: reverse linking
This commit is contained in:
parent
1663f66e6d
commit
d319feee9e
@ -163,7 +163,7 @@
|
|||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-03-05 18:54:17.763244",
|
"modified": "2020-03-02 18:06:29.170878",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Additional Salary",
|
"name": "Additional Salary",
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class AdditionalSalary(Document):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_additional_salary_component(employee, start_date, end_date, component_type):
|
def get_additional_salary_component(employee, start_date, end_date, component_type):
|
||||||
additional_components = frappe.db.sql("""
|
additional_components = frappe.db.sql("""
|
||||||
select salary_component, sum(amount) as amount, overwrite_salary_structure_amount, deduct_full_tax_on_selected_payroll_date
|
select name, salary_component, amount, overwrite_salary_structure_amount, deduct_full_tax_on_selected_payroll_date
|
||||||
from `tabAdditional Salary`
|
from `tabAdditional Salary`
|
||||||
where employee=%(employee)s
|
where employee=%(employee)s
|
||||||
and docstatus = 1
|
and docstatus = 1
|
||||||
@ -60,7 +60,6 @@ def get_additional_salary_component(employee, start_date, end_date, component_ty
|
|||||||
from_date <= %(to_date)s and to_date >= %(to_date)s
|
from_date <= %(to_date)s and to_date >= %(to_date)s
|
||||||
)
|
)
|
||||||
and type = %(component_type)s
|
and type = %(component_type)s
|
||||||
group by salary_component, overwrite_salary_structure_amount
|
|
||||||
order by salary_component, overwrite_salary_structure_amount
|
order by salary_component, overwrite_salary_structure_amount
|
||||||
""", {
|
""", {
|
||||||
'employee': employee,
|
'employee': employee,
|
||||||
@ -70,8 +69,11 @@ def get_additional_salary_component(employee, start_date, end_date, component_ty
|
|||||||
}, as_dict=1)
|
}, as_dict=1)
|
||||||
|
|
||||||
additional_components_list = []
|
additional_components_list = []
|
||||||
|
existing_salary_components = []
|
||||||
component_fields = ["depends_on_payment_days", "salary_component_abbr", "is_tax_applicable", "variable_based_on_taxable_salary", 'type']
|
component_fields = ["depends_on_payment_days", "salary_component_abbr", "is_tax_applicable", "variable_based_on_taxable_salary", 'type']
|
||||||
for d in additional_components:
|
for d in additional_components:
|
||||||
|
if d.salary_component in existing_salary_components:
|
||||||
|
frappe.throw(_('Multiple additional Salary is created for Salary Component {0}'.format(d.salary_component)))
|
||||||
struct_row = frappe._dict({'salary_component': d.salary_component})
|
struct_row = frappe._dict({'salary_component': d.salary_component})
|
||||||
component = frappe.get_all("Salary Component", filters={'name': d.salary_component}, fields=component_fields)
|
component = frappe.get_all("Salary Component", filters={'name': d.salary_component}, fields=component_fields)
|
||||||
if component:
|
if component:
|
||||||
@ -79,6 +81,7 @@ def get_additional_salary_component(employee, start_date, end_date, component_ty
|
|||||||
|
|
||||||
struct_row['deduct_full_tax_on_selected_payroll_date'] = d.deduct_full_tax_on_selected_payroll_date
|
struct_row['deduct_full_tax_on_selected_payroll_date'] = d.deduct_full_tax_on_selected_payroll_date
|
||||||
struct_row['is_additional_component'] = 1
|
struct_row['is_additional_component'] = 1
|
||||||
|
struct_row['additional_salary'] = d.name
|
||||||
|
|
||||||
additional_components_list.append(frappe._dict({
|
additional_components_list.append(frappe._dict({
|
||||||
'amount': d.amount,
|
'amount': d.amount,
|
||||||
@ -86,4 +89,5 @@ def get_additional_salary_component(employee, start_date, end_date, component_ty
|
|||||||
'struct_row': struct_row,
|
'struct_row': struct_row,
|
||||||
'overwrite': d.overwrite_salary_structure_amount,
|
'overwrite': d.overwrite_salary_structure_amount,
|
||||||
}))
|
}))
|
||||||
|
existing_salary_components.append(d.salary_component)
|
||||||
return additional_components_list
|
return additional_components_list
|
||||||
@ -51,7 +51,7 @@ def make_employee(user, company=None):
|
|||||||
"doctype": "User",
|
"doctype": "User",
|
||||||
"email": user,
|
"email": user,
|
||||||
"first_name": user,
|
"first_name": user,
|
||||||
"new_password": "qwerty123@12435",
|
"new_password": "password",
|
||||||
"roles": [{"doctype": "Has Role", "role": "Employee"}]
|
"roles": [{"doctype": "Has Role", "role": "Employee"}]
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
"tax_on_flexible_benefit",
|
"tax_on_flexible_benefit",
|
||||||
"tax_on_additional_salary",
|
"tax_on_additional_salary",
|
||||||
"section_break_11",
|
"section_break_11",
|
||||||
|
"additional_salary",
|
||||||
"condition_and_formula_help"
|
"condition_and_formula_help"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
@ -187,11 +188,18 @@
|
|||||||
"fieldtype": "HTML",
|
"fieldtype": "HTML",
|
||||||
"label": "Condition and Formula Help",
|
"label": "Condition and Formula Help",
|
||||||
"options": "<h3>Condition and Formula Help</h3>\n\n<p>Notes:</p>\n\n<ol>\n<li>Use field <code>base</code> for using base salary of the Employee</li>\n<li>Use Salary Component abbreviations in conditions and formulas. <code>BS = Basic Salary</code></li>\n<li>Use field name for employee details in conditions and formulas. <code>Employment Type = employment_type</code><code>Branch = branch</code></li>\n<li>Use field name from Salary Slip in conditions and formulas. <code>Payment Days = payment_days</code><code>Leave without pay = leave_without_pay</code></li>\n<li>Direct Amount can also be entered based on Condtion. See example 3</li></ol>\n\n<h4>Examples</h4>\n<ol>\n<li>Calculating Basic Salary based on <code>base</code>\n<pre><code>Condition: base < 10000</code></pre>\n<pre><code>Formula: base * .2</code></pre></li>\n<li>Calculating HRA based on Basic Salary<code>BS</code> \n<pre><code>Condition: BS > 2000</code></pre>\n<pre><code>Formula: BS * .1</code></pre></li>\n<li>Calculating TDS based on Employment Type<code>employment_type</code> \n<pre><code>Condition: employment_type==\"Intern\"</code></pre>\n<pre><code>Amount: 1000</code></pre></li>\n</ol>"
|
"options": "<h3>Condition and Formula Help</h3>\n\n<p>Notes:</p>\n\n<ol>\n<li>Use field <code>base</code> for using base salary of the Employee</li>\n<li>Use Salary Component abbreviations in conditions and formulas. <code>BS = Basic Salary</code></li>\n<li>Use field name for employee details in conditions and formulas. <code>Employment Type = employment_type</code><code>Branch = branch</code></li>\n<li>Use field name from Salary Slip in conditions and formulas. <code>Payment Days = payment_days</code><code>Leave without pay = leave_without_pay</code></li>\n<li>Direct Amount can also be entered based on Condtion. See example 3</li></ol>\n\n<h4>Examples</h4>\n<ol>\n<li>Calculating Basic Salary based on <code>base</code>\n<pre><code>Condition: base < 10000</code></pre>\n<pre><code>Formula: base * .2</code></pre></li>\n<li>Calculating HRA based on Basic Salary<code>BS</code> \n<pre><code>Condition: BS > 2000</code></pre>\n<pre><code>Formula: BS * .1</code></pre></li>\n<li>Calculating TDS based on Employment Type<code>employment_type</code> \n<pre><code>Condition: employment_type==\"Intern\"</code></pre>\n<pre><code>Amount: 1000</code></pre></li>\n</ol>"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "additional_salary",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Additional Salary ",
|
||||||
|
"options": "Additional Salary",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2019-12-31 17:15:25.646689",
|
"modified": "2020-03-02 18:16:38.571005",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Salary Detail",
|
"name": "Salary Detail",
|
||||||
|
|||||||
@ -442,6 +442,7 @@ class SalarySlip(TransactionBase):
|
|||||||
if amount:
|
if amount:
|
||||||
self.append(key, {
|
self.append(key, {
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
|
'additional_salary': '' if not struct_row.get("additional_salary") else struct_row.get("additional_salary"),
|
||||||
'default_amount': amount if not struct_row.get("is_additional_component") else 0,
|
'default_amount': amount if not struct_row.get("is_additional_component") else 0,
|
||||||
'depends_on_payment_days' : struct_row.depends_on_payment_days,
|
'depends_on_payment_days' : struct_row.depends_on_payment_days,
|
||||||
'salary_component' : struct_row.salary_component,
|
'salary_component' : struct_row.salary_component,
|
||||||
@ -790,14 +791,6 @@ class SalarySlip(TransactionBase):
|
|||||||
"repay_from_salary": 1,
|
"repay_from_salary": 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def update_salary_slip_in_additional_salary(self):
|
|
||||||
salary_slip = self.name if self.docstatus==1 else None
|
|
||||||
frappe.db.sql("""
|
|
||||||
update `tabAdditional Salary` set salary_slip=%s
|
|
||||||
where employee=%s and payroll_date between %s and %s and docstatus=1
|
|
||||||
""", (salary_slip, self.employee, self.start_date, self.end_date))
|
|
||||||
|
|
||||||
def make_loan_repayment_entry(self):
|
def make_loan_repayment_entry(self):
|
||||||
for loan in self.loans:
|
for loan in self.loans:
|
||||||
repayment_entry = create_repayment_entry(loan.loan, self.employee,
|
repayment_entry = create_repayment_entry(loan.loan, self.employee,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user