mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 15:09:20 +00:00
replaced set
This commit is contained in:
@@ -41,7 +41,7 @@ class DocType:
|
||||
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
|
||||
|
||||
#this is done because sometimes user entered wrong employee name while uploading employee attendance
|
||||
set(self.doc, 'employee_name', emp_nm and emp_nm[0][0] or '')
|
||||
webnotes.conn.set(self.doc, 'employee_name', emp_nm and emp_nm[0][0] or '')
|
||||
|
||||
ret = { 'employee_name' : emp_nm and emp_nm[0][0] or ''}
|
||||
return ret
|
||||
@@ -102,5 +102,5 @@ class DocType:
|
||||
|
||||
def on_submit(self):
|
||||
#this is done because while uploading attendance chnage docstatus to 1 i.e. submit
|
||||
set(self.doc,'docstatus',1)
|
||||
webnotes.conn.set(self.doc,'docstatus',1)
|
||||
pass
|
||||
|
||||
@@ -65,9 +65,9 @@ class DocType:
|
||||
raise Exception
|
||||
d.save(1)
|
||||
if self.doc.total_sanctioned_amount:
|
||||
set(self.doc,'total_sanctioned_amount',self.doc.total_sanctioned_amount)
|
||||
webnotes.conn.set(self.doc,'total_sanctioned_amount',self.doc.total_sanctioned_amount)
|
||||
if self.doc.remark:
|
||||
set(self.doc, 'remark', self.doc.remark)
|
||||
webnotes.conn.set(self.doc, 'remark', self.doc.remark)
|
||||
|
||||
def approve_voucher(self):
|
||||
missing_count = 0
|
||||
@@ -83,7 +83,7 @@ class DocType:
|
||||
return cstr('No Amount')
|
||||
self.update_voucher()
|
||||
|
||||
set(self.doc, 'approval_status', 'Approved')
|
||||
webnotes.conn.set(self.doc, 'approval_status', 'Approved')
|
||||
# on approval notification
|
||||
#get_obj('Notification Control').notify_contact('Expense Claim Approved', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
|
||||
|
||||
@@ -92,8 +92,8 @@ class DocType:
|
||||
def reject_voucher(self):
|
||||
|
||||
if self.doc.remark:
|
||||
set(self.doc, 'remark', self.doc.remark)
|
||||
set(self.doc, 'approval_status', 'Rejected')
|
||||
webnotes.conn.set(self.doc, 'remark', self.doc.remark)
|
||||
webnotes.conn.set(self.doc, 'approval_status', 'Rejected')
|
||||
|
||||
return cstr('Rejected')
|
||||
|
||||
@@ -110,7 +110,7 @@ class DocType:
|
||||
self.validate_fiscal_year()
|
||||
|
||||
def on_update(self):
|
||||
set(self.doc, 'approval_status', 'Draft')
|
||||
webnotes.conn.set(self.doc, 'approval_status', 'Draft')
|
||||
|
||||
def validate_exp_details(self):
|
||||
if not getlist(self.doclist, 'expense_voucher_details'):
|
||||
@@ -127,10 +127,10 @@ class DocType:
|
||||
|
||||
def on_submit(self):
|
||||
self.validate_exp_details()
|
||||
set(self.doc, 'approval_status', 'Submitted')
|
||||
webnotes.conn.set(self.doc, 'approval_status', 'Submitted')
|
||||
|
||||
def on_cancel(self):
|
||||
set(self.doc, 'approval_status', 'Cancelled')
|
||||
webnotes.conn.set(self.doc, 'approval_status', 'Cancelled')
|
||||
|
||||
def get_formatted_message(self, args):
|
||||
""" get formatted message for auto notification"""
|
||||
|
||||
@@ -96,7 +96,7 @@ class DocType:
|
||||
self.doc.leave_type)
|
||||
cf = cf and cint(cf[0][0]) or 0
|
||||
if not cf:
|
||||
set(self.doc,'carry_forward',0)
|
||||
webnotes.conn.set(self.doc,'carry_forward',0)
|
||||
msgprint("Sorry! You cannot carry forward %s" % (self.doc.leave_type),
|
||||
raise_exception=1)
|
||||
|
||||
@@ -117,8 +117,8 @@ class DocType:
|
||||
|
||||
def get_total_allocated_leaves(self):
|
||||
leave_det = self.get_carry_forwarded_leaves()
|
||||
set(self.doc,'carry_forwarded_leaves',flt(leave_det['carry_forwarded_leaves']))
|
||||
set(self.doc,'total_leaves_allocated',flt(leave_det['total_leaves_allocated']))
|
||||
webnotes.conn.set(self.doc,'carry_forwarded_leaves',flt(leave_det['carry_forwarded_leaves']))
|
||||
webnotes.conn.set(self.doc,'total_leaves_allocated',flt(leave_det['total_leaves_allocated']))
|
||||
|
||||
def check_for_leave_application(self):
|
||||
exists = sql("""select name from `tabLeave Application`
|
||||
|
||||
@@ -74,8 +74,8 @@ class DocType:
|
||||
bal = self.get_leave_balance()
|
||||
tot_leaves = self.get_total_leave_days()
|
||||
bal, tot_leaves = bal, tot_leaves
|
||||
set(self.doc,'leave_balance',flt(bal['leave_balance']))
|
||||
set(self.doc,'total_leave_days',flt(tot_leaves['total_leave_days']))
|
||||
webnotes.conn.set(self.doc,'leave_balance',flt(bal['leave_balance']))
|
||||
webnotes.conn.set(self.doc,'total_leave_days',flt(tot_leaves['total_leave_days']))
|
||||
if flt(bal['leave_balance']) < flt(tot_leaves['total_leave_days']):
|
||||
msgprint("Warning : There is not enough leave balance")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user