Salary Component - fields - refactor fields behaviour

This commit is contained in:
Jamsheer 2018-05-18 15:18:27 +05:30
parent 334bd189a7
commit f647aa15af
2 changed files with 129 additions and 2 deletions

View File

@ -22,5 +22,32 @@ frappe.ui.form.on('Salary Component', {
}
};
});
},
is_flexible_benefit: function(frm) {
if(frm.doc.is_flexible_benefit){
set_value_for_condition_and_formula(frm);
}
},
type: function(frm) {
if(frm.doc.type=="Earning"){
frm.set_value("variable_based_on_taxable_salary", 0);
}
if(frm.doc.type=="Deduction"){
frm.set_value("is_flexible_benefit", 0);
}
},
variable_based_on_taxable_salary: function(frm) {
if(frm.doc.variable_based_on_taxable_salary){
set_value_for_condition_and_formula(frm);
}
}
});
var set_value_for_condition_and_formula = function(frm) {
frm.set_value("formula", null);
frm.set_value("condition", null);
frm.set_value("amount_based_on_formula", 0);
frm.set_value("statistical_component", 0);
frm.set_value("do_not_include_in_total", 0);
frm.set_value("depends_on_lwp", 0);
}

View File

@ -108,6 +108,102 @@
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.type == \"Earning\"",
"fieldname": "is_additional_component",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Additional Component",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.type == \"Earning\"",
"fieldname": "is_tax_applicable",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Tax Applicable",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "1",
"fieldname": "is_payable",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Payable",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -492,6 +588,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "is_flexible_benefit",
"fieldname": "create_separate_payment_entry_against_benefit_claim",
"fieldtype": "Check",
"hidden": 0,
@ -618,6 +715,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_payable == 1",
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
@ -680,7 +778,9 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "",
"columns": 0,
"depends_on": "eval:doc.is_flexible_benefit != 1 && doc.variable_based_on_taxable_salary != 1",
"fieldname": "condition_and_formula",
"fieldtype": "Section Break",
"hidden": 0,
@ -1001,7 +1101,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-05-16 12:27:03.005070",
"modified": "2018-05-18 15:12:38.202265",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Component",
@ -1036,4 +1136,4 @@
"sort_order": "DESC",
"track_changes": 0,
"track_seen": 0
}
}