mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
fixed get_server_values to make them utf-8 friendly
This commit is contained in:
@@ -84,7 +84,7 @@ class DocType(TransactionBase):
|
||||
# ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
|
||||
contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where supplier = '%s' and is_supplier = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
|
||||
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
|
||||
return cstr(ret)
|
||||
return ret
|
||||
else:
|
||||
msgprint("Supplier : %s does not exists" % (name))
|
||||
raise Exception
|
||||
@@ -142,14 +142,14 @@ class DocType(TransactionBase):
|
||||
ret['purchase_rate'] = item and flt(item[0]['last_purchase_rate']) or 0
|
||||
ret['import_rate'] = flt(item and flt(item[0]['last_purchase_rate']) or 0) / flt(obj.doc.fields.has_key('conversion_rate') and flt(obj.doc.conversion_rate) or 1)
|
||||
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
# Get Available Qty at Warehouse
|
||||
def get_bin_details( self, arg = ''):
|
||||
arg = eval(arg)
|
||||
bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (arg['item_code'], arg['warehouse']), as_dict=1)
|
||||
ret = { 'projected_qty' : bin and flt(bin[0]['projected_qty']) or 0 }
|
||||
return str(ret)
|
||||
return ret
|
||||
|
||||
# Get UOM Details
|
||||
def get_uom_details(self, arg = ''):
|
||||
@@ -163,7 +163,7 @@ class DocType(TransactionBase):
|
||||
'purchase_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])) or 0
|
||||
}
|
||||
|
||||
return str(ret)
|
||||
return ret
|
||||
|
||||
# get last purchase rate
|
||||
def get_last_purchase_rate( self, obj):
|
||||
@@ -522,7 +522,7 @@ class DocType(TransactionBase):
|
||||
'rate' : rate and (rate[0]['account_type'] == 'Tax' and not arg['charge_type'] == 'Actual') and flt(rate[0]['tax_rate']) or 0
|
||||
}
|
||||
#msgprint(ret)
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,23 +38,17 @@ class DocType(TransactionBase):
|
||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'PO Date')
|
||||
|
||||
|
||||
# Client Trigger Functions
|
||||
#----------------------------------------------------------------------------------------------------
|
||||
# Get Supplier Details
|
||||
#def get_supplier_details(self, name = ''):
|
||||
#return cstr(get_obj(dt='Purchase Common').get_supplier_details(name))
|
||||
|
||||
# Get Item Details
|
||||
def get_item_details(self, arg =''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_item_details(self,arg))
|
||||
return get_obj(dt='Purchase Common').get_item_details(self,arg)
|
||||
|
||||
# Get UOM Details
|
||||
def get_uom_details(self, arg = ''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_uom_details(arg))
|
||||
return get_obj(dt='Purchase Common').get_uom_details(arg)
|
||||
|
||||
# get available qty at warehouse
|
||||
def get_bin_details(self, arg = ''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_bin_details(arg))
|
||||
return get_obj(dt='Purchase Common').get_bin_details(arg)
|
||||
|
||||
# Pull Indent
|
||||
def get_indent_details(self):
|
||||
|
||||
@@ -18,7 +18,7 @@ class DocType:
|
||||
'supplier_name' : cd and cd[0][4] or '',
|
||||
'supplier_address': cd and cd[0][5] or ''
|
||||
}
|
||||
return cstr(ret)
|
||||
return ret
|
||||
|
||||
def get_rfq_details(self):
|
||||
self.doc.clear_table(self.doclist, 'supplier_quotation_details')
|
||||
@@ -28,12 +28,12 @@ class DocType:
|
||||
def update_approval_status(self):
|
||||
if not self.doc.approval_status or self.doc.approval_status == 'Not Approved':
|
||||
set(self.doc, 'approval_status','Approved')
|
||||
return cstr(self.doc.approval_status)
|
||||
return self.doc.approval_status
|
||||
elif self.doc.approval_status == 'Approved':
|
||||
pc_obj = get_obj('Purchase Common')
|
||||
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
|
||||
set(self.doc, 'approval_status', 'Not Approved')
|
||||
return cstr(self.doc.approval_status)
|
||||
return self.doc.approval_status
|
||||
|
||||
def validate_item_list(self):
|
||||
if not getlist(self.doclist, 'supplier_quotation_details'):
|
||||
@@ -101,4 +101,4 @@ class DocType:
|
||||
# Get Supplier Details
|
||||
# --------------------
|
||||
def get_supplier_details(self, name = ''):
|
||||
return cstr(get_obj('Purchase Common').get_supplier_details(name))
|
||||
return get_obj('Purchase Common').get_supplier_details(name)
|
||||
Reference in New Issue
Block a user