[fix][hr] pull salary structure in salary slip

This commit is contained in:
Nabin Hait 2013-07-10 14:16:59 +05:30
parent 96b8acb9da
commit 749b37f4f5
3 changed files with 17 additions and 57 deletions

View File

@ -31,12 +31,8 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
var me = this; var me = this;
erpnext.hide_naming_series(); erpnext.hide_naming_series();
if(!this.frm.doc.__islocal) { if(!this.frm.doc.__islocal) {
cur_frm.add_custom_button('View Active Salary Structure', function() {
me.view_active_salary_structure(this); });
cur_frm.add_custom_button('Make Salary Structure', function() { cur_frm.add_custom_button('Make Salary Structure', function() {
me.make_salary_structure(this); }); me.make_salary_structure(this); });
} }
}, },
@ -45,7 +41,8 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
this.frm.call({ this.frm.call({
method:"hr.utils.get_leave_approver_list", method:"hr.utils.get_leave_approver_list",
callback: function(r) { callback: function(r) {
me.frm.fields_dict.employee_leave_approvers.grid.get_field("leave_approver").df.options = me.frm.fields_dict.employee_leave_approvers.grid
.get_field("leave_approver").df.options =
$.map(r.message, function(profile) { $.map(r.message, function(profile) {
return {value: profile, label: wn.user_info(profile).fullname}; return {value: profile, label: wn.user_info(profile).fullname};
}); });
@ -75,9 +72,9 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
if(r.message) { if(r.message) {
msgprint(wn._("Employee") + ' "' + me.frm.doc.name + '": ' msgprint(wn._("Employee") + ' "' + me.frm.doc.name + '": '
+ wn._("An active Salary Structure already exists. \ + wn._("An active Salary Structure already exists. \
If you want to create new one, please ensure that no active Salary Structure \ If you want to create new one, please ensure that no active \
exists for this Employee. Go to the active Salary Structure and set \ Salary Structure exists for this Employee. \
\"Is Active\" = \"No\"")); Go to the active Salary Structure and set \"Is Active\" = \"No\""));
} else if(!r.exc) { } else if(!r.exc) {
wn.model.map({ wn.model.map({
source: wn.model.get_doclist(me.frm.doc.doctype, me.frm.doc.name), source: wn.model.get_doclist(me.frm.doc.doctype, me.frm.doc.name),

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-03-07 09:04:18", "creation": "2013-03-07 09:04:18",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-05 14:36:19", "modified": "2013-07-10 12:52:17",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -31,7 +31,9 @@
"parent": "Employee", "parent": "Employee",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0,
"read": 1, "read": 1,
"report": 1,
"submit": 0 "submit": 0
}, },
{ {
@ -55,7 +57,7 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "image_view", "fieldname": "image_view",
"fieldtype": "Image", "fieldtype": "Image",
"in_list_view": 1, "in_list_view": 0,
"label": "Image View", "label": "Image View",
"options": "image" "options": "image"
}, },
@ -562,6 +564,12 @@
"fieldtype": "Data", "fieldtype": "Data",
"label": "Place of Issue" "label": "Place of Issue"
}, },
{
"doctype": "DocField",
"fieldname": "column_break6",
"fieldtype": "Column Break",
"width": "50%"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "marital_status", "fieldname": "marital_status",
@ -576,12 +584,6 @@
"label": "Blood Group", "label": "Blood Group",
"options": "\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-" "options": "\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-"
}, },
{
"doctype": "DocField",
"fieldname": "column_break6",
"fieldtype": "Column Break",
"width": "50%"
},
{ {
"description": "Here you can maintain family details like name and occupation of parent, spouse and children", "description": "Here you can maintain family details like name and occupation of parent, spouse and children",
"doctype": "DocField", "doctype": "DocField",
@ -748,17 +750,6 @@
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "employee", "match": "employee",
"permlevel": 0,
"report": 1,
"role": "Employee",
"write": 0
},
{
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"report": 0,
"role": "Employee", "role": "Employee",
"write": 0 "write": 0
}, },
@ -767,8 +758,6 @@
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"match": "company", "match": "company",
"permlevel": 0,
"report": 1,
"role": "HR User", "role": "HR User",
"write": 1 "write": 1
}, },
@ -776,27 +765,7 @@
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "HR Manager", "role": "HR Manager",
"write": 1 "write": 1
},
{
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"report": 0,
"role": "HR User",
"write": 0
},
{
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"report": 0,
"role": "HR Manager",
"write": 0
} }
] ]

View File

@ -21,7 +21,7 @@ from webnotes.utils import add_days, cint, cstr, flt, getdate
from webnotes.model.doc import make_autoname from webnotes.model.doc import make_autoname
from webnotes.model.bean import getlist from webnotes.model.bean import getlist
from webnotes.model.code import get_obj from webnotes.model.code import get_obj
from webnotes import msgprint from webnotes import msgprint, _
from setup.utils import get_company_currency from setup.utils import get_company_currency
sql = webnotes.conn.sql sql = webnotes.conn.sql
@ -65,12 +65,6 @@ class DocType(TransactionBase):
from hr.doctype.salary_structure.salary_structure import make_salary_slip from hr.doctype.salary_structure.salary_structure import make_salary_slip
make_salary_slip(struct, self.doclist) make_salary_slip(struct, self.doclist)
basic_info = sql("select bank_name, bank_ac_no, esic_card_no, pf_number from `tabEmployee` where name ='%s'" % self.doc.employee)
self.doc.bank_name = basic_info[0][0]
self.doc.bank_account_no = basic_info[0][1]
self.doc.esic_no = basic_info[0][2]
self.doc.pf_no = basic_info[0][3]
def get_leave_details(self, lwp=None): def get_leave_details(self, lwp=None):
m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month) m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month)