Merge branch 'responsive' of github.com:webnotes/erpnext into responsive
This commit is contained in:
commit
69c1858c24
@ -94,14 +94,15 @@ def make_purchase_order(source_name, target_doclist=None):
|
||||
},
|
||||
"Supplier Quotation Item": {
|
||||
"doctype": "Purchase Order Item",
|
||||
"field_map": {
|
||||
"name": "supplier_quotation_item",
|
||||
"parent": "supplier_quotation",
|
||||
"uom": "stock_uom",
|
||||
"prevdoc_detail_docname": "prevdoc_detail_docname",
|
||||
"prevdoc_doctype": "prevdoc_doctype",
|
||||
"prevdoc_docname": "prevdoc_docname",
|
||||
},
|
||||
"field_map": [
|
||||
["name", "supplier_quotation_item"],
|
||||
["parent", "supplier_quotation"],
|
||||
["uom", "stock_uom"],
|
||||
["uom", "uom"],
|
||||
["prevdoc_detail_docname", "prevdoc_detail_docname"],
|
||||
["prevdoc_doctype", "prevdoc_doctype"],
|
||||
["prevdoc_docname", "prevdoc_docname"]
|
||||
],
|
||||
"postprocess": update_item
|
||||
},
|
||||
"Purchase Taxes and Charges": {
|
||||
|
@ -15,11 +15,10 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cur_frm.add_fetch('employee', 'company', 'company');
|
||||
cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
|
||||
|
||||
//get employee's name based on employee id selected
|
||||
cur_frm.cscript.employee = function(doc,cdt,cdn){
|
||||
if(doc.employee) get_server_fields('get_emp_name', '', '', doc, cdt, cdn, 1);
|
||||
refresh_field('employee_name');
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(doc.__islocal) cur_frm.set_value("att_date", get_today());
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query;
|
@ -27,12 +27,6 @@ class DocType:
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def get_emp_name(self):
|
||||
return {
|
||||
"employee_name": webnotes.conn.get_value("Employee",
|
||||
self.doc.employee_name, "employee_name")
|
||||
}
|
||||
|
||||
def validate_duplicate_record(self):
|
||||
res = sql("""select name from `tabAttendance` where employee = %s and att_date = %s
|
||||
and name != %s and docstatus = 1""",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:13",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:25:19",
|
||||
"modified": "2013-07-10 17:39:22",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "ashwini@webnotestech.com"
|
||||
},
|
||||
@ -25,6 +25,7 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
@ -33,6 +34,8 @@
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
@ -80,6 +83,7 @@
|
||||
"oldfieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"default": "Present",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
@ -157,15 +161,15 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"doctype": "DocPerm",
|
||||
"report": 1,
|
||||
"role": "HR User",
|
||||
"submit": 1
|
||||
"role": "System Manager"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"match": "owner",
|
||||
"role": "Employee"
|
||||
"role": "HR User"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "HR Manager"
|
||||
}
|
||||
]
|
@ -20,13 +20,14 @@ cur_frm.add_fetch('employee', 'company', 'company');
|
||||
// -------------------------------------------------------------------
|
||||
cur_frm.cscript.onload = function(doc,dt,dn){
|
||||
if((cint(doc.__islocal) == 1) && !doc.amended_from){
|
||||
if(!doc.month) {
|
||||
var today=new Date();
|
||||
month = (today.getMonth()+01).toString();
|
||||
if(month.length>1) doc.month = month;
|
||||
else doc.month = '0'+month;
|
||||
doc.fiscal_year = sys_defaults['fiscal_year'];
|
||||
}
|
||||
if(!doc.fiscal_year) doc.fiscal_year = sys_defaults['fiscal_year'];
|
||||
refresh_many(['month', 'fiscal_year']);
|
||||
cur_frm.cscript.fiscal_year(doc, dt, dn);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,8 +43,6 @@ cur_frm.cscript.fiscal_year = function(doc,dt,dn){
|
||||
|
||||
cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year;
|
||||
|
||||
// Calculate total if lwp exists
|
||||
// ------------------------------------------------------------------------
|
||||
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
|
||||
if (doc.employee && doc.fiscal_year && doc.month) {
|
||||
$c_obj(make_doclist(doc.doctype,doc.name), 'get_leave_details',doc.leave_without_pay,function(r, rt) {
|
||||
@ -54,16 +53,12 @@ cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate all
|
||||
// ------------------------------------------------------------------------
|
||||
var calculate_all = function(doc, dt, dn) {
|
||||
calculate_earning_total(doc, dt, dn);
|
||||
calculate_ded_total(doc, dt, dn);
|
||||
calculate_net_pay(doc, dt, dn);
|
||||
}
|
||||
|
||||
// Trigger on earning modified amount and depends on lwp
|
||||
// ------------------------------------------------------------------------
|
||||
cur_frm.cscript.e_modified_amount = function(doc,dt,dn){
|
||||
calculate_earning_total(doc, dt, dn);
|
||||
calculate_net_pay(doc, dt, dn);
|
||||
|
@ -17,7 +17,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, cint, cstr, flt, getdate
|
||||
from webnotes.utils import add_days, cint, cstr, flt, getdate, nowdate
|
||||
from webnotes.model.doc import make_autoname
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
@ -40,8 +40,6 @@ class DocType(TransactionBase):
|
||||
|
||||
def get_emp_and_leave_details(self):
|
||||
if self.doc.employee:
|
||||
# Get payment days
|
||||
if self.doc.fiscal_year and self.doc.month:
|
||||
self.get_leave_details()
|
||||
|
||||
# check sal structure
|
||||
@ -59,14 +57,24 @@ class DocType(TransactionBase):
|
||||
|
||||
|
||||
def pull_sal_struct(self, struct):
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'earning_details')
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'deduction_details')
|
||||
|
||||
from hr.doctype.salary_structure.salary_structure import make_salary_slip
|
||||
make_salary_slip(struct, self.doclist)
|
||||
self.doclist = make_salary_slip(struct, self.doclist)
|
||||
|
||||
def pull_emp_details(self):
|
||||
emp = webnotes.conn.get_value("Employee", self.doc.employee,
|
||||
["bank_name", "bank_ac_no", "esic_card_no", "pf_number"], as_dict=1)
|
||||
if emp:
|
||||
self.doc.bank_name = emp.bank_name
|
||||
self.doc.bank_ac_no = emp.bank_ac_no
|
||||
self.doc.esic_no = emp.esic_card_no
|
||||
self.doc.pf_no = emp.pf_number
|
||||
|
||||
def get_leave_details(self, lwp=None):
|
||||
if not self.doc.fiscal_year:
|
||||
self.doc.fiscal_year = webnotes.get_default("fiscal_year")
|
||||
if not self.doc.month:
|
||||
self.doc.month = "%02d" % getdate(nowdate()).month
|
||||
|
||||
m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month)
|
||||
|
||||
if not lwp:
|
||||
|
@ -99,13 +99,10 @@ def make_salary_slip(source_name, target_doclist=None):
|
||||
from webnotes.model.mapper import get_mapped_doclist
|
||||
|
||||
def postprocess(source, target):
|
||||
emp = webnotes.conn.get_value("Employee", source.doc.employee,
|
||||
["bank_name", "bank_ac_no", "esic_card_no", "pf_number"], as_dict=1)
|
||||
if emp:
|
||||
target[0].bank_name = emp.bank_name
|
||||
target[0].bank_ac_no = emp.bank_ac_no
|
||||
target[0].esic_no = emp.esic_card_no
|
||||
target[0].pf_no = emp.pf_number
|
||||
sal_slip = webnotes.bean(target)
|
||||
sal_slip.run_method("pull_emp_details")
|
||||
sal_slip.run_method("get_leave_details")
|
||||
sal_slip.run_method("calculate_net_pay")
|
||||
|
||||
doclist = get_mapped_doclist("Salary Structure", source_name, {
|
||||
"Salary Structure": {
|
||||
@ -116,16 +113,19 @@ def make_salary_slip(source_name, target_doclist=None):
|
||||
},
|
||||
"Salary Structure Deduction": {
|
||||
"doctype": "Salary Slip Deduction",
|
||||
"field_map": {
|
||||
"depend_on_lwp": "d_depends_on_lwp"
|
||||
}
|
||||
"field_map": [
|
||||
["depend_on_lwp", "d_depends_on_lwp"],
|
||||
["d_modified_amt", "d_amount"],
|
||||
["d_modified_amt", "d_modified_amount"]
|
||||
]
|
||||
},
|
||||
"Salary Structure Earning": {
|
||||
"doctype": "Salary Slip Earning",
|
||||
"field_map": {
|
||||
"depend_on_lwp": "e_depends_on_lwp",
|
||||
"modified_value": "e_modified_amount"
|
||||
}
|
||||
"field_map": [
|
||||
["depend_on_lwp", "e_depends_on_lwp"],
|
||||
["modified_value", "e_modified_amount"],
|
||||
["modified_value", "e_amount"]
|
||||
]
|
||||
}
|
||||
}, target_doclist, postprocess)
|
||||
|
||||
|
@ -23,9 +23,14 @@ wn.module_page["HR"] = [
|
||||
doctype:"Expense Claim"
|
||||
},
|
||||
{
|
||||
label: wn._("Job Applicant"),
|
||||
description: wn._("Applicant for a Job."),
|
||||
doctype:"Job Applicant"
|
||||
label: wn._("Salary Slip"),
|
||||
description: wn._("Monthly salary statement."),
|
||||
doctype:"Salary Slip"
|
||||
},
|
||||
{
|
||||
label: wn._("Attendance"),
|
||||
description: wn._("Attendance record."),
|
||||
doctype:"Attendance"
|
||||
},
|
||||
]
|
||||
},
|
||||
@ -34,14 +39,9 @@ wn.module_page["HR"] = [
|
||||
icon: "icon-copy",
|
||||
items: [
|
||||
{
|
||||
label: wn._("Attendance"),
|
||||
description: wn._("Attendance record."),
|
||||
doctype:"Attendance"
|
||||
},
|
||||
{
|
||||
label: wn._("Salary Slip"),
|
||||
description: wn._("Monthly salary statement."),
|
||||
doctype:"Salary Slip"
|
||||
label: wn._("Job Applicant"),
|
||||
description: wn._("Applicant for a Job."),
|
||||
doctype:"Job Applicant"
|
||||
},
|
||||
{
|
||||
label: wn._("Appraisal"),
|
||||
|
@ -254,12 +254,13 @@ def make_purchase_order(source_name, target_doclist=None):
|
||||
},
|
||||
"Material Request Item": {
|
||||
"doctype": "Purchase Order Item",
|
||||
"field_map": {
|
||||
"name": "prevdoc_detail_docname",
|
||||
"parent": "prevdoc_docname",
|
||||
"parenttype": "prevdoc_doctype",
|
||||
"uom": "stock_uom"
|
||||
},
|
||||
"field_map": [
|
||||
["name", "prevdoc_detail_docname"],
|
||||
["parent", "prevdoc_docname"],
|
||||
["parenttype", "prevdoc_doctype"],
|
||||
["uom", "stock_uom"],
|
||||
["uom", "uom"]
|
||||
],
|
||||
"postprocess": update_item
|
||||
}
|
||||
}, target_doclist, set_missing_values)
|
||||
|
Loading…
x
Reference in New Issue
Block a user