replaced set

This commit is contained in:
Anand Doshi 2012-11-30 17:18:45 +05:30
parent 535fbb1b00
commit ea61d8cf99
18 changed files with 59 additions and 59 deletions

View File

@ -133,7 +133,7 @@ class DocType(TransactionBase):
def validate(self):
self.validate_fiscal_year()
# Step 1:=> set status as "Draft"
set(self.doc, 'status', 'Draft')
webnotes.conn.set(self.doc, 'status', 'Draft')
# Step 2:=> get Purchase Common Obj
pc_obj = get_obj(dt='Purchase Common')
@ -213,7 +213,7 @@ class DocType(TransactionBase):
def update_status(self, status):
self.check_modified_date()
# step 1:=> Set Status
set(self.doc,'status',cstr(status))
webnotes.conn.set(self.doc,'status',cstr(status))
# step 2:=> Update Bin
self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1)
@ -243,7 +243,7 @@ class DocType(TransactionBase):
pc_obj.update_last_purchase_rate(self, is_submit = 1)
# Step 6 :=> Set Status
set(self.doc,'status','Submitted')
webnotes.conn.set(self.doc,'status','Submitted')
# On Cancel
# -------------------------------------------------------------------------------------------------------
@ -267,7 +267,7 @@ class DocType(TransactionBase):
raise Exception
# 4.Set Status as Cancelled
set(self.doc,'status','Cancelled')
webnotes.conn.set(self.doc,'status','Cancelled')
# 5.Update Purchase Requests Pending Qty and accordingly it's Status
pc_obj.update_prevdoc_detail(self,is_submit = 0)

View File

@ -147,7 +147,7 @@ class DocType:
self.validate_fiscal_year()
# set status as "Draft"
set(self.doc, 'status', 'Draft')
webnotes.conn.set(self.doc, 'status', 'Draft')
# Get Purchase Common Obj
pc_obj = get_obj(dt='Purchase Common')
@ -183,7 +183,7 @@ class DocType:
get_obj('Warehouse', d.warehouse).update_bin(args)
def on_submit(self):
set(self.doc,'status','Submitted')
webnotes.conn.set(self.doc,'status','Submitted')
self.update_bin(is_submit = 1, is_stopped = 0)
def check_modified_date(self):
@ -200,7 +200,7 @@ class DocType:
self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1)
# Step 2:=> Set status
set(self.doc,'status',cstr(status))
webnotes.conn.set(self.doc,'status',cstr(status))
# Step 3:=> Acknowledge User
msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)) )
@ -219,4 +219,4 @@ class DocType:
self.update_bin(is_submit = 0, is_stopped = (cstr(self.doc.status) == 'Stopped') and 1 or 0)
# Step 5:=> Set Status
set(self.doc,'status','Cancelled')
webnotes.conn.set(self.doc,'status','Cancelled')

View File

@ -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

View File

@ -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"""

View File

@ -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`

View File

@ -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")

View File

@ -36,6 +36,6 @@ class DocType:
sql("update `tabBOM Operation` set hour_rate = '%s' where parent = '%s' and workstation = '%s'"%( self.doc.hour_rate, bom_no[0], self.doc.name))
def on_update(self):
set(self.doc, 'overhead', flt(self.doc.hour_rate_electricity) + flt(self.doc.hour_rate_consumable) + flt(self.doc.hour_rate_rent))
set(self.doc, 'hour_rate', flt(self.doc.hour_rate_labour) + flt(self.doc.overhead))
webnotes.conn.set(self.doc, 'overhead', flt(self.doc.hour_rate_electricity) + flt(self.doc.hour_rate_consumable) + flt(self.doc.hour_rate_rent))
webnotes.conn.set(self.doc, 'hour_rate', flt(self.doc.hour_rate_labour) + flt(self.doc.overhead))
self.update_bom_operation()

View File

@ -81,10 +81,10 @@ class DocType:
def on_update(self):
self.calculate_total_hr()
set(self.doc, 'status', 'Draft')
webnotes.conn.set(self.doc, 'status', 'Draft')
def on_submit(self):
set(self.doc, 'status', 'Submitted')
webnotes.conn.set(self.doc, 'status', 'Submitted')
def on_cancel(self):
set(self.doc, 'status', 'Cancelled')
webnotes.conn.set(self.doc, 'status', 'Cancelled')

View File

@ -171,7 +171,7 @@ class DocType(TransactionBase):
raise Exception
def on_update(self):
set(self.doc, 'status', 'Draft')
webnotes.conn.set(self.doc, 'status', 'Draft')
def on_submit(self):
valid_lst = []
@ -187,7 +187,7 @@ class DocType(TransactionBase):
sql("update `tabSerial No` set status = 'Installed' where name = '%s'" % x)
set(self.doc, 'status', 'Submitted')
webnotes.conn.set(self.doc, 'status', 'Submitted')
def on_cancel(self):
@ -204,4 +204,4 @@ class DocType(TransactionBase):
for x in cur_s_no:
sql("update `tabSerial No` set status = 'Delivered' where name = '%s'" % x)
set(self.doc, 'status', 'Cancelled')
webnotes.conn.set(self.doc, 'status', 'Cancelled')

View File

@ -173,7 +173,7 @@ class DocType(TransactionBase):
else:
msgprint("Contact Date Cannot be before Last Contact Date")
raise Exception
#set(self.doc, 'contact_date_ref',self.doc.contact_date)
#webnotes.conn.set(self.doc, 'contact_date_ref',self.doc.contact_date)
# Validate
@ -199,10 +199,10 @@ class DocType(TransactionBase):
if self.doc.contact_date and self.doc.contact_date_ref != self.doc.contact_date:
if self.doc.contact_by:
self.add_calendar_event()
set(self.doc, 'contact_date_ref',self.doc.contact_date)
webnotes.conn.set(self.doc, 'contact_date_ref',self.doc.contact_date)
# Set Quotation Status
set(self.doc, 'status', 'Draft')
webnotes.conn.set(self.doc, 'status', 'Draft')
# subject for follow
self.doc.subject = '[%(status)s] To %(customer)s worth %(currency)s %(grand_total)s' % self.doc.fields
@ -274,8 +274,8 @@ class DocType(TransactionBase):
msgprint("Sales Order No. "+cstr(chk[0][0])+" is submitted against this Quotation. Thus 'Order Lost' can not be declared against it.")
raise Exception
else:
set(self.doc, 'status', 'Order Lost')
set(self.doc, 'order_lost_reason', arg)
webnotes.conn.set(self.doc, 'status', 'Order Lost')
webnotes.conn.set(self.doc, 'order_lost_reason', arg)
self.update_enquiry('order lost')
return 'true'
@ -291,15 +291,15 @@ class DocType(TransactionBase):
def on_submit(self):
self.check_item_table()
if not self.doc.amended_from:
set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been sent')
webnotes.conn.set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been sent')
else:
set(self.doc, 'message', 'Quotation has been amended. New Quotation no:'+self.doc.name)
webnotes.conn.set(self.doc, 'message', 'Quotation has been amended. New Quotation no:'+self.doc.name)
# Check for Approving Authority
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self)
# Set Quotation Status
set(self.doc, 'status', 'Submitted')
webnotes.conn.set(self.doc, 'status', 'Submitted')
#update enquiry status
self.update_enquiry('submit')
@ -308,12 +308,12 @@ class DocType(TransactionBase):
# ON CANCEL
# ==========================================================================
def on_cancel(self):
set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been cancelled')
webnotes.conn.set(self.doc, 'message', 'Quotation: '+self.doc.name+' has been cancelled')
#update enquiry status
self.update_enquiry('cancel')
set(self.doc,'status','Cancelled')
webnotes.conn.set(self.doc,'status','Cancelled')
# SEND SMS

View File

@ -341,7 +341,7 @@ class DocType(TransactionBase):
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.grand_total, self)
self.update_prevdoc_status('submit')
set(self.doc, 'status', 'Submitted')
webnotes.conn.set(self.doc, 'status', 'Submitted')
def on_cancel(self):
# Cannot cancel stopped SO
@ -353,7 +353,7 @@ class DocType(TransactionBase):
self.update_prevdoc_status('cancel')
set(self.doc, 'status', 'Cancelled')
webnotes.conn.set(self.doc, 'status', 'Cancelled')
# does not allow to cancel document if DN or RV made against it is SUBMITTED
# ----------------------------------------------------------------------------
@ -395,14 +395,14 @@ class DocType(TransactionBase):
def stop_sales_order(self):
self.check_modified_date()
self.update_stock_ledger(update_stock = -1,clear = 1)
set(self.doc, 'status', 'Stopped')
webnotes.conn.set(self.doc, 'status', 'Stopped')
msgprint("""%s: %s has been Stopped. To make transactions against this Sales Order
you need to Unstop it.""" % (self.doc.doctype, self.doc.name))
def unstop_sales_order(self):
self.check_modified_date()
self.update_stock_ledger(update_stock = 1,clear = 1)
set(self.doc, 'status', 'Submitted')
webnotes.conn.set(self.doc, 'status', 'Submitted')
msgprint("%s: %s has been Unstopped" % (self.doc.doctype, self.doc.name))

View File

@ -190,9 +190,9 @@ class DocType:
# ---------------------------------------------------
def set_default_groups(self):
if not self.doc.receivables_group:
set(self.doc, 'receivables_group', 'Accounts Receivable - '+self.doc.abbr)
webnotes.conn.set(self.doc, 'receivables_group', 'Accounts Receivable - '+self.doc.abbr)
if not self.doc.payables_group:
set(self.doc, 'payables_group', 'Accounts Payable - '+self.doc.abbr)
webnotes.conn.set(self.doc, 'payables_group', 'Accounts Payable - '+self.doc.abbr)
# Create default cost center

View File

@ -256,7 +256,7 @@ class DocType(TransactionBase):
self.credit_limit()
# set DN status
set(self.doc, 'status', 'Submitted')
webnotes.conn.set(self.doc, 'status', 'Submitted')
def validate_packed_qty(self):
@ -294,7 +294,7 @@ class DocType(TransactionBase):
sales_com_obj.update_prevdoc_detail(0,self)
self.update_stock_ledger(update_stock = -1)
set(self.doc, 'status', 'Cancelled')
webnotes.conn.set(self.doc, 'status', 'Cancelled')
self.cancel_packing_slips()

View File

@ -162,7 +162,7 @@ class DocType(TransactionBase):
def validate(self):
self.po_required()
self.validate_fiscal_year()
set(self.doc, 'status', 'Draft') # set status as "Draft"
webnotes.conn.set(self.doc, 'status', 'Draft') # set status as "Draft"
self.validate_accepted_rejected_qty()
self.validate_inspection() # Validate Inspection
get_obj('Stock Ledger').validate_serial_no(self, 'purchase_receipt_details')
@ -301,7 +301,7 @@ class DocType(TransactionBase):
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total)
# Set status as Submitted
set(self.doc,'status', 'Submitted')
webnotes.conn.set(self.doc,'status', 'Submitted')
pc_obj = get_obj('Purchase Common')
# Update Previous Doc i.e. update pending_qty and Status accordingly
@ -340,7 +340,7 @@ class DocType(TransactionBase):
raise Exception
# 2.Set Status as Cancelled
set(self.doc,'status','Cancelled')
webnotes.conn.set(self.doc,'status','Cancelled')
# 3. Cancel Serial No
get_obj('Stock Ledger').update_serial_record(self, 'purchase_receipt_details', is_submit = 0, is_incoming = 1)

View File

@ -52,7 +52,7 @@ class DocType(TransactionBase):
msgprint("Maintenance Visit No. "+lst1+" already created against this customer issue. So can not be Cancelled")
raise Exception
else:
set(self.doc, 'status', 'Cancelled')
webnotes.conn.set(self.doc, 'status', 'Cancelled')
def on_update(self):
pass

View File

@ -102,7 +102,7 @@ class DocType(TransactionBase):
for key in scheduled_date:
if email_map[d.incharge_name]:
self.add_calender_event(key["scheduled_date"],email_map[d.incharge_name],d.item_code)
set(self.doc, 'status', 'Submitted')
webnotes.conn.set(self.doc, 'status', 'Submitted')
def add_calender_event(self,scheduled_date,incharge_email,item_code):
@ -274,7 +274,7 @@ class DocType(TransactionBase):
sql("update `tabSerial No` set amc_expiry_date = '%s', maintenance_status = 'Under AMC' where name = '%s'"% (amc_end_date,x))
def on_update(self):
set(self.doc, 'status', 'Draft')
webnotes.conn.set(self.doc, 'status', 'Draft')
#validate that new maintenance start date does not clash with existing mntc end date
#-------------------------------------------------------------------------------------------------
@ -334,7 +334,7 @@ class DocType(TransactionBase):
for d in getlist(self.doclist, 'item_maintenance_detail'):
if d.serial_no:
self.update_amc_date(d.serial_no, '')
set(self.doc, 'status', 'Cancelled')
webnotes.conn.set(self.doc, 'status', 'Cancelled')
sql("delete from `tabEvent` where ref_type='Maintenance Schedule' and ref_name='%s' " %(self.doc.name))
def on_trash(self):
sql("delete from `tabEvent` where ref_type='Maintenance Schedule' and ref_name='%s' " %(self.doc.name))

View File

@ -148,11 +148,11 @@ class DocType(TransactionBase):
def on_submit(self):
self.update_customer_issue(1)
set(self.doc, 'status', 'Submitted')
webnotes.conn.set(self.doc, 'status', 'Submitted')
def on_cancel(self):
self.check_if_last_visit()
set(self.doc, 'status', 'Cancelled')
webnotes.conn.set(self.doc, 'status', 'Cancelled')
def on_update(self):
pass

View File

@ -41,7 +41,7 @@ class DocType:
d = d.replace(x, '')
# mobile no validation for erpnext gateway
if webnotes.conn.get_value('SMS Settings', None, 'sms_gateway_url'):
if webnotes.conn.webnotes.conn.get_value('SMS Settings', None, 'sms_gateway_url'):
mob_no = d
else:
if not d.startswith("0") and len(d) == 10: