appraisal, don't validate points for self-appraisal
This commit is contained in:
parent
f2223102e2
commit
3ab6c5fca9
@ -30,6 +30,14 @@ class DocType:
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def validate(self):
|
||||
if not self.doc.status:
|
||||
self.doc.status = "Draft"
|
||||
|
||||
self.validate_dates()
|
||||
self.validate_existing_appraisal()
|
||||
self.calculate_total()
|
||||
|
||||
def get_employee_name(self):
|
||||
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
|
||||
emp_nm= emp_nm and emp_nm[0][0] or ''
|
||||
@ -47,25 +55,19 @@ class DocType:
|
||||
raise Exception
|
||||
|
||||
def validate_existing_appraisal(self):
|
||||
chk = 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))
|
||||
chk = 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))
|
||||
if chk:
|
||||
msgprint("You have already created Appraisal "\
|
||||
+cstr(chk[0][0])+" in the current date range for employee "\
|
||||
+cstr(self.doc.employee_name))
|
||||
raise Exception
|
||||
|
||||
def validate(self):
|
||||
if not self.doc.status:
|
||||
self.doc.status = "Draft"
|
||||
|
||||
self.validate_dates()
|
||||
self.validate_existing_appraisal()
|
||||
self.calculate_total()
|
||||
|
||||
def calculate_total(self):
|
||||
total, total_w = 0, 0
|
||||
for d in getlist(self.doclist, 'appraisal_details'):
|
||||
|
||||
if d.score:
|
||||
d.score_earned = flt(d.score) * flt(d.per_weightage) / 100
|
||||
total = total + d.score_earned
|
||||
@ -75,8 +77,11 @@ class DocType:
|
||||
msgprint("Total weightage assigned should be 100%. It is :" + str(total_w) + "%",
|
||||
raise_exception=1)
|
||||
|
||||
if webnotes.conn.get_default("employee", webnotes.session.user) != self.doc.employee:
|
||||
|
||||
if total==0:
|
||||
msgprint("Total can't be zero. You must atleast give some points!", raise_exception=1)
|
||||
|
||||
self.doc.total_score = total
|
||||
|
||||
def on_submit(self):
|
||||
|
@ -2,9 +2,9 @@
|
||||
{
|
||||
"owner": "jai@webnotestech.com",
|
||||
"docstatus": 0,
|
||||
"creation": "2013-01-16 14:48:56",
|
||||
"creation": "2013-01-19 10:23:35",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2013-01-17 11:39:55"
|
||||
"modified": "2013-01-19 10:31:03"
|
||||
},
|
||||
{
|
||||
"read_only": 1,
|
||||
@ -31,8 +31,8 @@
|
||||
"submit": 0,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"report": 0,
|
||||
"parenttype": "DocType",
|
||||
"report": 1,
|
||||
"permlevel": 0,
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
@ -70,9 +70,9 @@
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Company",
|
||||
"reqd": 1,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"reqd": 1,
|
||||
"options": "Company"
|
||||
},
|
||||
{
|
||||
@ -161,9 +161,9 @@
|
||||
"default": "1",
|
||||
"doctype": "DocField",
|
||||
"label": "Use Multi-Level BOM",
|
||||
"reqd": 0,
|
||||
"fieldname": "use_multi_level_bom",
|
||||
"fieldtype": "Check"
|
||||
"fieldtype": "Check",
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -181,9 +181,9 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Materials Requirement Planning (MRP)",
|
||||
"fieldname": "sb5",
|
||||
"fieldtype": "Section Break",
|
||||
"options": "Simple"
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"description": "Download a report containing all raw materials with their latest inventory status",
|
||||
@ -213,6 +213,10 @@
|
||||
"fieldtype": "Button",
|
||||
"options": "raise_purchase_request"
|
||||
},
|
||||
{
|
||||
"role": "System Manager",
|
||||
"doctype": "DocPerm"
|
||||
},
|
||||
{
|
||||
"role": "Manufacturing User",
|
||||
"doctype": "DocPerm"
|
||||
|
@ -2,6 +2,7 @@ import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("core", "doctype", "patch_log")
|
||||
if webnotes.conn.table_exists("__PatchLog"):
|
||||
for d in webnotes.conn.sql("""select patch from __PatchLog"""):
|
||||
webnotes.doc({
|
||||
"doctype": "Patch Log",
|
||||
|
@ -50,7 +50,7 @@ def send_message(subject="Website Query", message="", sender="", status="Open"):
|
||||
lead.ignore_permissions = True
|
||||
lead.insert()
|
||||
|
||||
make(content=message, sender=sender,
|
||||
make(content=message, sender=sender, subject=subject,
|
||||
doctype="Lead", name=lead.doc.name, lead=lead.doc.name)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user