Merge branch 'responsive' of github.com:webnotes/erpnext into responsive
diff --git a/buying/doctype/supplier_quotation/supplier_quotation.py b/buying/doctype/supplier_quotation/supplier_quotation.py
index f49782f..3e177a1 100644
--- a/buying/doctype/supplier_quotation/supplier_quotation.py
+++ b/buying/doctype/supplier_quotation/supplier_quotation.py
@@ -94,14 +94,15 @@
},
"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": {
diff --git a/hr/doctype/attendance/attendance.js b/hr/doctype/attendance/attendance.js
index 3ba9868..1749a6c 100644
--- a/hr/doctype/attendance/attendance.js
+++ b/hr/doctype/attendance/attendance.js
@@ -14,12 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-cur_frm.add_fetch('employee', 'company', 'company');
+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;
\ No newline at end of file
diff --git a/hr/doctype/attendance/attendance.py b/hr/doctype/attendance/attendance.py
index ac41acf..16e2547 100644
--- a/hr/doctype/attendance/attendance.py
+++ b/hr/doctype/attendance/attendance.py
@@ -26,12 +26,6 @@
def __init__(self, doc, doclist=[]):
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
diff --git a/hr/doctype/attendance/attendance.txt b/hr/doctype/attendance/attendance.txt
index aa917ed..d948d6f 100644
--- a/hr/doctype/attendance/attendance.txt
+++ b/hr/doctype/attendance/attendance.txt
@@ -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"
}
]
\ No newline at end of file
diff --git a/hr/doctype/salary_slip/salary_slip.js b/hr/doctype/salary_slip/salary_slip.js
index fc58271..cfffc5f 100644
--- a/hr/doctype/salary_slip/salary_slip.js
+++ b/hr/doctype/salary_slip/salary_slip.js
@@ -20,13 +20,14 @@
// -------------------------------------------------------------------
cur_frm.cscript.onload = function(doc,dt,dn){
if((cint(doc.__islocal) == 1) && !doc.amended_from){
- 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.month) {
+ var today=new Date();
+ month = (today.getMonth()+01).toString();
+ if(month.length>1) doc.month = month;
+ else doc.month = '0'+month;
+ }
+ 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.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 @@
}
}
-// 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);
diff --git a/hr/doctype/salary_slip/salary_slip.py b/hr/doctype/salary_slip/salary_slip.py
index 1af71d5..2b1d80c 100644
--- a/hr/doctype/salary_slip/salary_slip.py
+++ b/hr/doctype/salary_slip/salary_slip.py
@@ -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,9 +40,7 @@
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()
+ self.get_leave_details()
# check sal structure
struct = self.check_sal_struct()
@@ -59,14 +57,24 @@
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:
diff --git a/hr/doctype/salary_structure/salary_structure.py b/hr/doctype/salary_structure/salary_structure.py
index f890024..37b0b47 100644
--- a/hr/doctype/salary_structure/salary_structure.py
+++ b/hr/doctype/salary_structure/salary_structure.py
@@ -99,14 +99,11 @@
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": {
"doctype": "Salary Slip",
@@ -116,16 +113,19 @@
},
"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)
diff --git a/hr/page/hr_home/hr_home.js b/hr/page/hr_home/hr_home.js
index 517fb77..dadc6fb 100644
--- a/hr/page/hr_home/hr_home.js
+++ b/hr/page/hr_home/hr_home.js
@@ -23,9 +23,14 @@
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 @@
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"),
diff --git a/stock/doctype/material_request/material_request.py b/stock/doctype/material_request/material_request.py
index 861162a..71a9e13 100644
--- a/stock/doctype/material_request/material_request.py
+++ b/stock/doctype/material_request/material_request.py
@@ -254,12 +254,13 @@
},
"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)