mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-28 11:08:32 +00:00
Merge branch 'master' of github.com:webnotes/erpnext into wsgi
Conflicts: accounts/doctype/purchase_invoice/purchase_invoice.py accounts/doctype/sales_invoice/sales_invoice.txt selling/doctype/lead/lead.txt selling/doctype/opportunity/opportunity.txt stock/doctype/warehouse/warehouse.py
This commit is contained in:
@@ -14,6 +14,7 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
||||
onload: function() {
|
||||
this.frm.toggle_display(["esic_card_no", "gratuity_lic_id", "pan_number", "pf_number"],
|
||||
wn.control_panel.country==="India");
|
||||
if(this.frm.doc.__islocal) this.frm.set_value("employee_name", "");
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
|
||||
@@ -58,11 +58,12 @@ cur_frm.cscript.onload = function(doc,cdt,cdn) {
|
||||
query:"controllers.queries.employee_query"
|
||||
}
|
||||
}
|
||||
|
||||
var exp_approver = doc.exp_approver;
|
||||
return cur_frm.call({
|
||||
method:"hr.utils.get_expense_approver_list",
|
||||
callback: function(r) {
|
||||
cur_frm.set_df_property("exp_approver", "options", r.message);
|
||||
if(exp_approver) cur_frm.set_value("exp_approver", exp_approver);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -79,26 +80,39 @@ cur_frm.cscript.clear_sanctioned = function(doc) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
cur_frm.cscript.set_help(doc);
|
||||
|
||||
if(!doc.__islocal) {
|
||||
cur_frm.toggle_enable("exp_approver", (doc.owner==user && doc.approval_status=="Draft"));
|
||||
cur_frm.toggle_enable("approval_status", (doc.exp_approver==user && doc.docstatus==0));
|
||||
|
||||
if(!doc.__islocal && user!=doc.exp_approver && cur_frm.frm_head.appframe.buttons.Submit)
|
||||
cur_frm.frm_head.appframe.buttons.Submit.toggle(false);
|
||||
|
||||
if(doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
|
||||
cur_frm.savesubmit();
|
||||
|
||||
if(doc.docstatus==1 && wn.model.can_create("Journal Voucher"))
|
||||
cur_frm.add_custom_button("Make Bank Voucher", cur_frm.cscript.make_bank_voucher);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.set_help = function(doc) {
|
||||
cur_frm.set_intro("");
|
||||
if(doc.__islocal && !in_list(user_roles, "HR User")) {
|
||||
cur_frm.set_intro("Fill the form and save it")
|
||||
} else {
|
||||
if(doc.docstatus==0 && doc.approval_status=="Draft") {
|
||||
if(user==doc.exp_approver) {
|
||||
cur_frm.set_intro("You are the Expense Approver for this record. Please Update the 'Status' and Save");
|
||||
cur_frm.toggle_enable("approval_status", true);
|
||||
cur_frm.set_intro("You are the Expense Approver for this record. \
|
||||
Please Update the 'Status' and Save");
|
||||
} else {
|
||||
cur_frm.set_intro("Expense Claim is pending approval. Only the Expense Approver can update status.");
|
||||
cur_frm.toggle_enable("approval_status", false);
|
||||
if(!doc.__islocal && cur_frm.frm_head.appframe.buttons.Submit)
|
||||
cur_frm.frm_head.appframe.buttons.Submit.toggle(false);
|
||||
cur_frm.set_intro("Expense Claim is pending approval. \
|
||||
Only the Expense Approver can update status.");
|
||||
}
|
||||
} else {
|
||||
if(doc.approval_status=="Approved") {
|
||||
cur_frm.set_intro("Expense Claim has been approved.");
|
||||
if(doc.docstatus==0) cur_frm.savesubmit();
|
||||
if(doc.docstatus==1) cur_frm.add_custom_button("Make Bank Voucher",
|
||||
cur_frm.cscript.make_bank_voucher);
|
||||
} else if(doc.approval_status=="Rejected") {
|
||||
cur_frm.set_intro("Expense Claim has been rejected.");
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
cur_frm.set_value("status", "Open");
|
||||
cur_frm.cscript.calculate_total_days(doc, dt, dn);
|
||||
}
|
||||
|
||||
var leave_approver = doc.leave_approver;
|
||||
return cur_frm.call({
|
||||
method:"hr.utils.get_leave_approver_list",
|
||||
callback: function(r) {
|
||||
@@ -17,6 +19,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
function(profile) {
|
||||
return {value: profile, label: wn.user_info(profile).fullname};
|
||||
}));
|
||||
if(leave_approver) cur_frm.set_value("leave_approver", leave_approver);
|
||||
cur_frm.cscript.get_leave_balance(cur_frm.doc);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user