mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 23:49:19 +00:00
[mapper] removed old mapper from files and database
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "ashwini@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2010-09-01 15:47:59",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:50"
|
||||
},
|
||||
{
|
||||
"match_id": 0,
|
||||
"parent": "Appraisal Template-Appraisal",
|
||||
"from_field": "kra_sheet",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"to_table": "Appraisal Goal",
|
||||
"name": "__common__",
|
||||
"to_field": "appraisal_details",
|
||||
"parenttype": "DocType Mapper",
|
||||
"from_table": "Appraisal Template Goal",
|
||||
"validation_logic": "name is not Null",
|
||||
"parentfield": "table_mapper_details"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"to_doctype": "Appraisal",
|
||||
"module": "HR",
|
||||
"doctype": "DocType Mapper",
|
||||
"from_doctype": "Appraisal Template"
|
||||
},
|
||||
{
|
||||
"name": "Appraisal Template-Appraisal",
|
||||
"doctype": "DocType Mapper"
|
||||
},
|
||||
{
|
||||
"doctype": "Table Mapper Detail"
|
||||
}
|
||||
]
|
||||
@@ -1,100 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "harshada@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2010-12-14 10:33:11",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2011-09-15 15:04:44"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Salary Structure-Salary Slip",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"parenttype": "DocType Mapper",
|
||||
"validation_logic": "name is not null",
|
||||
"parentfield": "table_mapper_details"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"name": "__common__",
|
||||
"parent": "Salary Structure-Salary Slip",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"parenttype": "DocType Mapper",
|
||||
"parentfield": "field_mapper_details"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"to_doctype": "Salary Slip",
|
||||
"module": "HR",
|
||||
"doctype": "DocType Mapper",
|
||||
"from_doctype": "Salary Structure"
|
||||
},
|
||||
{
|
||||
"name": "Salary Structure-Salary Slip",
|
||||
"doctype": "DocType Mapper"
|
||||
},
|
||||
{
|
||||
"to_field": "gross_pay",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"match_id": 0,
|
||||
"from_field": "total_earning"
|
||||
},
|
||||
{
|
||||
"to_field": "e_amount",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"match_id": 1,
|
||||
"from_field": "modified_value"
|
||||
},
|
||||
{
|
||||
"to_field": "d_amount",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"match_id": 2,
|
||||
"from_field": "d_modified_amt"
|
||||
},
|
||||
{
|
||||
"to_field": "e_modified_amount",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"match_id": 1,
|
||||
"from_field": "modified_value"
|
||||
},
|
||||
{
|
||||
"to_field": "e_depends_on_lwp",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"match_id": 1,
|
||||
"from_field": "depend_on_lwp"
|
||||
},
|
||||
{
|
||||
"to_field": "d_modified_amount",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"match_id": 2,
|
||||
"from_field": "d_modified_amt"
|
||||
},
|
||||
{
|
||||
"to_field": "d_depends_on_lwp",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"match_id": 2,
|
||||
"from_field": "depend_on_lwp"
|
||||
},
|
||||
{
|
||||
"to_table": "Salary Slip",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"match_id": 0,
|
||||
"from_table": "Salary Structure"
|
||||
},
|
||||
{
|
||||
"match_id": 1,
|
||||
"to_field": "earning_details",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "earning_details",
|
||||
"from_table": "Salary Structure Earning",
|
||||
"to_table": "Salary Slip Earning"
|
||||
},
|
||||
{
|
||||
"match_id": 2,
|
||||
"to_field": "deduction_details",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "deduction_details",
|
||||
"from_table": "Salary Structure Deduction",
|
||||
"to_table": "Salary Slip Deduction"
|
||||
}
|
||||
]
|
||||
@@ -37,10 +37,10 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
}
|
||||
|
||||
cur_frm.cscript.kra_template = function(doc, dt, dn) {
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'fetch_kra', '',
|
||||
function() {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
wn.model.map_current_doc({
|
||||
method: "hr.doctype.appraisal.appraisal.fetch_appraisal_template",
|
||||
source_name: cur_frm.doc.kra_template,
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript.calculate_total_score = function(doc,cdt,cdn){
|
||||
|
||||
@@ -19,12 +19,8 @@ import webnotes
|
||||
|
||||
from webnotes.utils import cstr, flt, getdate
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
@@ -39,23 +35,18 @@ class DocType:
|
||||
self.calculate_total()
|
||||
|
||||
def get_employee_name(self):
|
||||
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
|
||||
emp_nm = webnotes.conn.sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
|
||||
emp_nm= emp_nm and emp_nm[0][0] or ''
|
||||
self.doc.employee_name = emp_nm
|
||||
return emp_nm
|
||||
|
||||
def fetch_kra(self):
|
||||
self.doclist = self.doc.clear_table(self.doclist,'appraisal_details')
|
||||
get_obj('DocType Mapper', 'Appraisal Template-Appraisal').dt_map('Appraisal Template', 'Appraisal',
|
||||
self.doc.kra_template, self.doc, self.doclist, "[['Appraisal Template','Appraisal'],['Appraisal Template Goal', 'Appraisal Goal']]")
|
||||
|
||||
|
||||
def validate_dates(self):
|
||||
if getdate(self.doc.start_date) > getdate(self.doc.end_date):
|
||||
msgprint("End Date can not be less than Start Date")
|
||||
raise Exception
|
||||
|
||||
def validate_existing_appraisal(self):
|
||||
chk = sql("""select name from `tabAppraisal` where employee=%s
|
||||
chk = webnotes.conn.sql("""select name from `tabAppraisal` where employee=%s
|
||||
and (status='Submitted' or status='Completed')
|
||||
and ((start_date>=%s and start_date<=%s)
|
||||
or (end_date>=%s and end_date<=%s))""",(self.doc.employee,self.doc.start_date,self.doc.end_date,self.doc.start_date,self.doc.end_date))
|
||||
@@ -88,3 +79,18 @@ class DocType:
|
||||
|
||||
def on_cancel(self):
|
||||
webnotes.conn.set(self.doc, 'status', 'Cancelled')
|
||||
|
||||
@webnotes.whitelist()
|
||||
def fetch_appraisal_template(source_name, target_doclist=None):
|
||||
from webnotes.model.mapper import get_mapped_doclist
|
||||
|
||||
doclist = get_mapped_doclist("Appraisal Template", source_name, {
|
||||
"Appraisal Template": {
|
||||
"doctype": "Appraisal",
|
||||
},
|
||||
"Appraisal Template Goal": {
|
||||
"doctype": "Appraisal Goal",
|
||||
}
|
||||
}, target_doclist)
|
||||
|
||||
return [d.fields for d in doclist]
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
cur_frm.add_fetch('employee', 'company', 'company');
|
||||
|
||||
// On load
|
||||
//=======================================================================
|
||||
cur_frm.cscript.onload = function(doc, dt, dn){
|
||||
e_tbl = getchildren('Salary Structure Earning', doc.name, 'earning_details', doc.doctype);
|
||||
d_tbl = getchildren('Salary Structure Deduction', doc.name, 'deduction_details', doc.doctype);
|
||||
@@ -25,8 +23,6 @@ cur_frm.cscript.onload = function(doc, dt, dn){
|
||||
$c_obj(make_doclist(doc.doctype,doc.name),'make_earn_ded_table','', function(r, rt) { refresh_many(['earning_details', 'deduction_details']);});
|
||||
}
|
||||
|
||||
// On refresh
|
||||
//=======================================================================
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn){
|
||||
if((!doc.__islocal) && (doc.is_active == 'Yes')){
|
||||
cur_frm.add_custom_button('Make Salary Slip', cur_frm.cscript['Make Salary Slip']);
|
||||
@@ -35,56 +31,26 @@ cur_frm.cscript.refresh = function(doc, dt, dn){
|
||||
cur_frm.toggle_enable('employee', doc.__islocal);
|
||||
}
|
||||
|
||||
|
||||
// Make Salry Slip
|
||||
//=======================================================================
|
||||
cur_frm.cscript['Make Salary Slip'] = function(){
|
||||
var doc = cur_frm.doc;
|
||||
var callback = function(r,rt){
|
||||
ret = r.message;
|
||||
n = wn.model.make_new_doc_and_get_name("Salary Slip");
|
||||
$c('dt_map', args={
|
||||
'docs':wn.model.compress([locals["Salary Slip"][n]]),
|
||||
'from_doctype':'Salary Structure',
|
||||
'to_doctype':'Salary Slip',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Salary Structure', 'Salary Slip'], ['Salary Structure Earning', 'Salary Slip Earning'], ['Salary Structure Deduction', 'Salary Slip Deduction']]"
|
||||
},
|
||||
function(r,rt) {
|
||||
n.fiscal_year = sys_defaults.fiscal_year;
|
||||
n.bank_name = ret['bank_name'];
|
||||
n.bank_account_no = ret['bank_ac_no'];
|
||||
n.esic_no=ret['esic_no'];
|
||||
n.pf_no= ret['pf_no'];
|
||||
loaddoc("Salary Slip", n);
|
||||
}
|
||||
);
|
||||
}
|
||||
$c_obj(make_doclist(doc.doctype,doc.name),'get_ss_values',cur_frm.doc.employee, callback);
|
||||
cur_frm.cscript['Make Salary Slip'] = function() {
|
||||
wn.model.open_mapped_doc({
|
||||
method: "hr.doctype.salary_structure.salary_structure.make_salary_slip",
|
||||
source_name: cur_frm.doc.name
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// get employee details
|
||||
//=======================================================================
|
||||
cur_frm.cscript.employee = function(doc, dt, dn){
|
||||
if (doc.employee)
|
||||
get_server_fields('get_employee_details','','',doc,dt,dn);
|
||||
}
|
||||
|
||||
// calculate earning totals
|
||||
//=======================================================================
|
||||
cur_frm.cscript.modified_value = function(doc, cdt, cdn){
|
||||
calculate_totals(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
// calculate deduction totals
|
||||
//=======================================================================
|
||||
cur_frm.cscript.d_modified_amt = function(doc, cdt, cdn){
|
||||
calculate_totals(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
// calculate totals
|
||||
//=======================================================================
|
||||
var calculate_totals = function(doc, cdt, cdn) {
|
||||
var tbl1 = getchildren('Salary Structure Earning', doc.name, 'earning_details', doc.doctype);
|
||||
var tbl2 = getchildren('Salary Structure Deduction', doc.name, 'deduction_details', doc.doctype);
|
||||
@@ -102,8 +68,6 @@ var calculate_totals = function(doc, cdt, cdn) {
|
||||
refresh_many(['total_earning', 'total_deduction', 'net_pay']);
|
||||
}
|
||||
|
||||
// validate
|
||||
//=======================================================================
|
||||
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
||||
calculate_totals(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
@@ -94,4 +94,41 @@ class DocType:
|
||||
|
||||
def validate(self):
|
||||
self.check_existing()
|
||||
self.validate_amount()
|
||||
self.validate_amount()
|
||||
|
||||
@webnotes.whitelist()
|
||||
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
|
||||
|
||||
doclist = get_mapped_doclist("Salary Structure", source_name, {
|
||||
"Salary Structure": {
|
||||
"doctype": "Salary Slip",
|
||||
"field_map": {
|
||||
"total_earning": "gross_pay"
|
||||
}
|
||||
},
|
||||
"Salary Structure Deduction": {
|
||||
"doctype": "Salary Slip Deduction",
|
||||
"field_map": {
|
||||
"depend_on_lwp": "d_depends_on_lwp"
|
||||
}
|
||||
},
|
||||
"Salary Structure Earning": {
|
||||
"doctype": "Salary Slip Earning",
|
||||
"field_map": {
|
||||
"depend_on_lwp": "e_depends_on_lwp",
|
||||
"modified_value": "e_modified_amount"
|
||||
}
|
||||
}
|
||||
}, target_doclist, postprocess)
|
||||
|
||||
return [d.fields for d in doclist]
|
||||
Reference in New Issue
Block a user