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