fixed get_server_values to make them utf-8 friendly

This commit is contained in:
Rushabh Mehta
2011-08-12 10:55:43 +05:30
parent b3453e6ed5
commit 89717292b7
36 changed files with 95 additions and 195 deletions

View File

@@ -50,7 +50,7 @@ class DocType(TransactionBase):
ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
return cstr(ret)
return ret
else:
msgprint("Customer : %s does not exist in system." % (name))
raise Exception
@@ -64,7 +64,7 @@ class DocType(TransactionBase):
'contact_no' : contact and contact[0]['contact_no'] or '',
'email_id' : contact and contact[0]['email_id'] or ''
}
return str(ret)
return ret
# ====================================================================================================================
def on_update(self):
@@ -184,7 +184,7 @@ class DocType(TransactionBase):
else:
set(self.doc, 'status', 'Enquiry Lost')
set(self.doc, 'order_lost_reason', arg)
return cstr('true')
return 'true'
# ====================================================================================================================
def update_follow_up(self):

View File

@@ -29,20 +29,7 @@ class DocType(TransactionBase):
# ---------
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
#fetch customer details
#=================================
#def get_customer_details(self):
# det = sql("select t1.customer_name, t1.address,t1.territory,t2.contact_name from `tabCustomer` t1, `tabContact` t2 where t1.name = '%s' and t1.name=t2.customer and t2.is_primary_contact = 'Yes'"%self.doc.customer, as_dict=1)
# ret = {
# 'customer_name': det and det[0]['customer_name'] or '',
# 'address' : det and det[0]['address'] or '',
# 'territory': det and det[0]['territory'] or '',
# 'contact_person' : det and det[0]['contact_name'] or ''
# }
# return str(ret)
#fetch delivery note details
#====================================

View File

@@ -51,7 +51,7 @@ class DocType:
'description': it and it[0][3] or '',
'uom' : it and it[0][4] or ''
}
return cstr(ret)
return ret
def validate(self):
import string

View File

@@ -45,17 +45,12 @@ class DocType(TransactionBase):
self.get_adj_percent()
return cstr(self.doc.quotation_to)
# Get Customer Details
# --------------------
#def get_customer_details(self):
# return cstr(get_obj('Sales Common').get_customer_details(self))
return self.doc.quotation_to
# Get contact person details based on customer selected
# ------------------------------------------------------
def get_contact_details(self):
return cstr(get_obj('Sales Common').get_contact_details(self,0))
return get_obj('Sales Common').get_contact_details(self,0)
# Clear Quotation Details
# -----------------------
@@ -111,7 +106,7 @@ class DocType(TransactionBase):
'contact_mobile' : details and details[0]['mobile_no'] or '-',
'contact_email' : details and details[0]['email_id'] or '-'
}
return cstr(ret)
return ret
# GET TERMS AND CONDITIONS
@@ -295,7 +290,7 @@ class DocType(TransactionBase):
set(self.doc, 'status', 'Order Lost')
set(self.doc, 'order_lost_reason', arg)
self.update_enquiry('order lost')
return cstr('true')
return 'true'
#check if value entered in item table
#--------------------------------------

View File

@@ -118,21 +118,21 @@ class DocType(TransactionBase):
t = {}
for x in tax: t[x[0]] = flt(x[1])
ret = {
'description' : item and item[0]['description_html'] or item[0]['description'],
'item_group' : item and item[0]['item_group'] or '',
'item_name' : item and item[0]['item_name'] or '',
'brand' : item and item[0]['brand'] or '',
'stock_uom' : item and item[0]['stock_uom'] or '',
'reserved_warehouse' : item and item[0]['default_warehouse'] or '',
'warehouse' : item and item[0]['default_warehouse'] or '',
'income_account' : item and item[0]['default_income_account'] or '',
'cost_center' : item and item[0]['default_sales_cost_center'] or '',
'qty' : 1.00, # this is done coz if item once fetched is fetched again thn its qty shld be reset to 1
'adj_rate' : 0,
'amount' : 0,
'export_amount' : 0,
'item_tax_rate' : str(t),
'batch_no' : ''
'description' : item and item[0]['description_html'] or item[0]['description'],
'item_group' : item and item[0]['item_group'] or '',
'item_name' : item and item[0]['item_name'] or '',
'brand' : item and item[0]['brand'] or '',
'stock_uom' : item and item[0]['stock_uom'] or '',
'reserved_warehouse' : item and item[0]['default_warehouse'] or '',
'warehouse' : item and item[0]['default_warehouse'] or '',
'income_account' : item and item[0]['default_income_account'] or '',
'cost_center' : item and item[0]['default_sales_cost_center'] or '',
'qty' : 1.00, # this is done coz if item once fetched is fetched again thn its qty shld be reset to 1
'adj_rate' : 0,
'amount' : 0,
'export_amount' : 0,
'item_tax_rate' : str(t),
'batch_no' : ''
}
if(obj.doc.price_list_name and item): #this is done to fetch the changed BASIC RATE and REF RATE based on PRICE LIST
ref_rate = self.get_ref_rate(item_code, obj.doc.price_list_name, obj.doc.currency)
@@ -143,7 +143,8 @@ class DocType(TransactionBase):
if obj.doc.doctype == 'Receivable Voucher':
return ret
return str(ret)
return ret
# ***************** Get Ref rate as entered in Item Master ********************
def get_ref_rate(self, item_code, price_list_name, currency):
@@ -161,7 +162,6 @@ class DocType(TransactionBase):
d.base_ref_rate = flt(ref_rate) * flt(obj.doc.conversion_rate)
d.export_rate = flt(ref_rate)
# Load Default Taxes
# ====================
def load_default_taxes(self, obj):
@@ -203,7 +203,7 @@ class DocType(TransactionBase):
ret = {
'item_tax_rate' : tax and str(t) or ''
}
return str(ret)
return ret
# Get Serial No Details
# ==========================================================================
@@ -220,7 +220,7 @@ class DocType(TransactionBase):
'description' : item and item[0]['description'] or '',
'item_tax_rate' : str(t)
}
return str(ret)
return ret
# Get Commission rate
# =======================================================================
@@ -233,7 +233,7 @@ class DocType(TransactionBase):
'commission_rate' : comm_rate and flt(comm_rate[0]['commission_rate']) or 0,
'total_commission' : flt(total_comm)
}
return str(ret)
return ret
else:
msgprint("Business Associate : %s does not exist in the system." % (sales_partner))
raise Exception
@@ -287,7 +287,7 @@ class DocType(TransactionBase):
ret = {
'rate' : rate and flt(rate[0]['tax_rate']) or 0
}
return cstr(ret)
return ret
# Make Packing List from Sales BOM

View File

@@ -102,8 +102,7 @@ class DocType(TransactionBase):
'projected_qty' : tot_avail_qty and flt(tot_avail_qty[0]['projected_qty']) or 0,
'actual_qty' : tot_avail_qty and flt(tot_avail_qty[0]['actual_qty']) or 0
}
return cstr(ret)
return ret
# OTHER CHARGES TRIGGER FUNCTIONS
# ====================================================================================
@@ -136,7 +135,7 @@ class DocType(TransactionBase):
nm = nm and nm[0][0] or ''
if not nm:
return cstr('No')
return 'No'
#check if maintenance visit already generated
#============================================
@@ -145,7 +144,7 @@ class DocType(TransactionBase):
nm = nm and nm[0][0] or ''
if not nm:
return cstr('No')
return 'No'
# VALIDATE
# =====================================================================================