Merge pull request #6202 from KanchanChauhan/component-type-added

'Type' field added to Salary Component
This commit is contained in:
Nabin Hait 2016-08-29 16:19:05 +05:30 committed by GitHub
commit d260602cae
4 changed files with 63 additions and 1 deletions

View File

@ -15,6 +15,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "salary_component",
"fieldtype": "Data",
"hidden": 0,
@ -40,6 +41,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "salary_component_abbr",
"fieldtype": "Data",
"hidden": 0,
@ -67,6 +69,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "description",
"fieldtype": "Small Text",
"hidden": 0,
@ -92,6 +95,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "accounts",
"fieldtype": "Table",
"hidden": 0,
@ -113,6 +117,33 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Type",
"length": 0,
"no_copy": 0,
"options": "Earning\nDeduction",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
@ -126,7 +157,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-07-27 17:40:18.335540",
"modified": "2016-08-29 05:33:22.495594",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Component",

View File

@ -13,6 +13,23 @@ cur_frm.cscript.onload = function(doc, dt, dn){
}
frappe.ui.form.on('Salary Structure', {
onload: function(frm) {
frm.set_query("salary_component", "earnings", function() {
return {
filters: {
type: "earning"
}
}
})
frm.set_query("salary_component", "deductions", function() {
return {
filters: {
type: "deduction"
}
}
})
},
refresh: function(frm) {
frm.trigger("toggle_fields")
frm.fields_dict['earnings'].grid.set_column_disp("default_amount", false);

View File

@ -316,3 +316,4 @@ erpnext.patches.v7_0.fix_duplicate_icons
erpnext.patches.v7_0.move_employee_parent_to_child_in_salary_structure
erpnext.patches.v7_0.repost_gle_for_pos_sales_return
erpnext.patches.v7_1.update_total_billing_hours
erpnext.patches.v7_1.update_component_type

View File

@ -0,0 +1,13 @@
import frappe
from frappe.utils import flt
def execute():
sal_components = frappe.db.sql("""
select DISTINCT salary_component, parentfield from `tabSalary Detail`""", as_dict=True)
if sal_components:
for sal_component in sal_components:
if sal_component.parentfield == "earnings":
frappe.db.sql("""update `tabSalary Component` set type='Earning' where salary_component=%(sal_comp)s""",{"sal_comp": sal_component.salary_component})
else:
frappe.db.sql("""update `tabSalary Component` set type='Deduction' where salary_component=%(sal_comp)s""",{"sal_comp": sal_component.salary_component})