[Enhance] Refactor (#14647)
* Payroll Entry - Make Bank Entry button routes to Journal Entry list view
* Salary Component - additional component and flexi not comes in same component
* Salary Structure - refactor validation messages
diff --git a/erpnext/hr/doctype/payroll_entry/payroll_entry.js b/erpnext/hr/doctype/payroll_entry/payroll_entry.js
index 297c3d0..26008d9 100644
--- a/erpnext/hr/doctype/payroll_entry/payroll_entry.js
+++ b/erpnext/hr/doctype/payroll_entry/payroll_entry.js
@@ -225,6 +225,11 @@
return frappe.call({
doc: cur_frm.doc,
method: "make_payment_entry",
+ callback: function() {
+ frappe.set_route(
+ 'List', 'Journal Entry', {posting_date: frm.doc.posting_date}
+ );
+ },
freeze: true,
freeze_message: __("Creating Bank Entries......")
});
diff --git a/erpnext/hr/doctype/salary_component/salary_component.js b/erpnext/hr/doctype/salary_component/salary_component.js
index fa06ebb..a7e2899 100644
--- a/erpnext/hr/doctype/salary_component/salary_component.js
+++ b/erpnext/hr/doctype/salary_component/salary_component.js
@@ -26,6 +26,12 @@
is_flexible_benefit: function(frm) {
if(frm.doc.is_flexible_benefit){
set_value_for_condition_and_formula(frm);
+ frm.set_value("is_additional_component", 0);
+ }
+ },
+ is_additional_component: function(frm) {
+ if(frm.doc.is_additional_component){
+ frm.set_value("is_flexible_benefit", 0);
}
},
type: function(frm) {
diff --git a/erpnext/hr/doctype/salary_component/salary_component.json b/erpnext/hr/doctype/salary_component/salary_component.json
index e3543bf..b92098f 100644
--- a/erpnext/hr/doctype/salary_component/salary_component.json
+++ b/erpnext/hr/doctype/salary_component/salary_component.json
@@ -118,7 +118,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "",
+ "depends_on": "eval:doc.is_flexible_benefit != 1",
"fieldname": "is_additional_component",
"fieldtype": "Check",
"hidden": 0,
@@ -443,6 +443,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "eval:doc.is_additional_component != 1",
"fieldname": "is_flexible_benefit",
"fieldtype": "Check",
"hidden": 0,
@@ -1002,7 +1003,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-06-19 11:37:37.521796",
+ "modified": "2018-06-22 17:27:08.334858",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Component",
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py
index 35df8df..9fec473 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.py
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.py
@@ -39,12 +39,12 @@
max_of_component = frappe.db.get_value("Salary Component", earning_component.salary_component, "max_benefit_amount")
flexi_amount += max_of_component
if have_a_flexi and self.max_benefits == 0:
- frappe.throw(_("Max benefits should be greater than zero to despense flexi"))
+ frappe.throw(_("Max benefits should be greater than zero to dispense benefits"))
if have_a_flexi and self.max_benefits > flexi_amount:
- frappe.throw(_("Total flexi component amount {0} should not be less \
+ frappe.throw(_("Total flexible benefit component amount {0} should not be less \
than max benefits {1}").format(flexi_amount, self.max_benefits))
if not have_a_flexi and self.max_benefits > 0:
- frappe.throw(_("Flexi component require to add max benefit"))
+ frappe.throw(_("Salary Structure should have flexible benefit component(s) to dispense benefit amount"))
@frappe.whitelist()