[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
This commit is contained in:
Jamsheer 2018-06-25 10:29:06 +05:30 committed by Nabin Hait
parent 3a595d07d0
commit 8044d09d50
4 changed files with 17 additions and 5 deletions

View File

@ -225,6 +225,11 @@ let make_bank_entry = function (frm) {
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......")
});

View File

@ -26,6 +26,12 @@ frappe.ui.form.on('Salary Component', {
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) {

View File

@ -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",

View File

@ -39,12 +39,12 @@ class SalaryStructure(Document):
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()