mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 15:12:51 +00:00
fixed get_server_values to make them utf-8 friendly
This commit is contained in:
@@ -72,16 +72,6 @@ cur_frm.fields_dict['master_name'].get_query=function(doc){
|
|||||||
else alert("Please select master type");
|
else alert("Please select master type");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// Get customer/supplier address
|
|
||||||
// -----------------------------------------
|
|
||||||
cur_frm.cscript.master_name = function(doc,cdt,cdn){
|
|
||||||
if(doc.master_name){
|
|
||||||
get_server_fields('get_address','','',doc,cdt,cdn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// parent account get query
|
// parent account get query
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
cur_frm.fields_dict['parent_account'].get_query = function(doc){
|
cur_frm.fields_dict['parent_account'].get_query = function(doc){
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class DocType:
|
|||||||
ret = {
|
ret = {
|
||||||
'company_abbr' : abbr
|
'company_abbr' : abbr
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
# Cost Center name must be unique
|
# Cost Center name must be unique
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class DocType(TransactionBase):
|
|||||||
'company_address': cstr(comp_det[0][0]),
|
'company_address': cstr(comp_det[0][0]),
|
||||||
'registration_details': cstr(comp_det[0][1])
|
'registration_details': cstr(comp_det[0][1])
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
# Get party details
|
# Get party details
|
||||||
#------------------
|
#------------------
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ class DocType:
|
|||||||
args = eval(args)
|
args = eval(args)
|
||||||
o_s = sql("select outstanding_amount from `tab%s` where name = '%s'" % (args['doctype'],args['docname']))
|
o_s = sql("select outstanding_amount from `tab%s` where name = '%s'" % (args['doctype'],args['docname']))
|
||||||
if args['doctype'] == 'Payable Voucher':
|
if args['doctype'] == 'Payable Voucher':
|
||||||
return cstr({'debit': o_s and flt(o_s[0][0]) or 0})
|
return {'debit': o_s and flt(o_s[0][0]) or 0}
|
||||||
if args['doctype'] == 'Receivable Voucher':
|
if args['doctype'] == 'Receivable Voucher':
|
||||||
return cstr({'credit': o_s and flt(o_s[0][0]) or 0})
|
return {'credit': o_s and flt(o_s[0][0]) or 0}
|
||||||
|
|
||||||
#--------------------------------------------------------------------------------------------------------
|
#--------------------------------------------------------------------------------------------------------
|
||||||
# Create remarks
|
# Create remarks
|
||||||
|
|||||||
@@ -48,14 +48,14 @@ class DocType(TransactionBase):
|
|||||||
ret['due_date'] = add_days(cstr(self.doc.posting_date), acc_head and cint(acc_head[0][1]) or 0)
|
ret['due_date'] = add_days(cstr(self.doc.posting_date), acc_head and cint(acc_head[0][1]) or 0)
|
||||||
elif not acc_head:
|
elif not acc_head:
|
||||||
msgprint("%s does not have an Account Head in %s. You must first create it from the Supplier Master" % (self.doc.supplier, self.doc.company))
|
msgprint("%s does not have an Account Head in %s. You must first create it from the Supplier Master" % (self.doc.supplier, self.doc.company))
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
def get_cust(self):
|
def get_cust(self):
|
||||||
ret = {}
|
ret = {}
|
||||||
if self.doc.credit_to:
|
if self.doc.credit_to:
|
||||||
ret['supplier'] = get_value('Account',self.doc.credit_to,'master_name')
|
ret['supplier'] = get_value('Account',self.doc.credit_to,'master_name')
|
||||||
|
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# Get Default Cost Center and Expense Head from Item Master
|
# Get Default Cost Center and Expense Head from Item Master
|
||||||
@@ -70,7 +70,7 @@ class DocType(TransactionBase):
|
|||||||
if not args['cost_center'] or args['cost_center'] == 'undefined':
|
if not args['cost_center'] or args['cost_center'] == 'undefined':
|
||||||
cost_center = sql("select cost_center from `tabItem` where name = '%s'" % args['item_code'])
|
cost_center = sql("select cost_center from `tabItem` where name = '%s'" % args['item_code'])
|
||||||
ret['cost_center'] = cost_center and cost_center[0][0] or ''
|
ret['cost_center'] = cost_center and cost_center[0][0] or ''
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# Get Items based on PO or PR
|
# Get Items based on PO or PR
|
||||||
@@ -115,7 +115,7 @@ class DocType(TransactionBase):
|
|||||||
'cost_center' : item_det and item_det[0]['cost_center'] or '',
|
'cost_center' : item_det and item_det[0]['cost_center'] or '',
|
||||||
'item_tax_rate' : str(t)
|
'item_tax_rate' : str(t)
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
# Advance Allocation
|
# Advance Allocation
|
||||||
# -------------------
|
# -------------------
|
||||||
@@ -139,7 +139,7 @@ class DocType(TransactionBase):
|
|||||||
def get_rate1(self,acc):
|
def get_rate1(self,acc):
|
||||||
rate = sql("select tax_rate from `tabAccount` where name='%s'"%(acc))
|
rate = sql("select tax_rate from `tabAccount` where name='%s'"%(acc))
|
||||||
ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 }
|
ret={'add_tax_rate' :rate and flt(rate[0][0]) or 0 }
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# *************************** Server Utility Functions *****************************
|
# *************************** Server Utility Functions *****************************
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class DocType(TransactionBase):
|
|||||||
def get_debit_to(self):
|
def get_debit_to(self):
|
||||||
acc_head = self.get_customer_account()
|
acc_head = self.get_customer_account()
|
||||||
if acc_head:
|
if acc_head:
|
||||||
return cstr({ 'debit_to' : acc_head })
|
return { 'debit_to' : acc_head }
|
||||||
|
|
||||||
|
|
||||||
# Set Due Date = Posting Date + Credit Days
|
# Set Due Date = Posting Date + Credit Days
|
||||||
@@ -515,7 +515,7 @@ class DocType(TransactionBase):
|
|||||||
ret = {
|
ret = {
|
||||||
'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
|
'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
# Make GL Entries
|
# Make GL Entries
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class DocType:
|
|||||||
else:
|
else:
|
||||||
ret = { 'registration_details': cstr(comp_det[0][0])}
|
ret = { 'registration_details': cstr(comp_det[0][0])}
|
||||||
|
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
# Get default bank and tds account
|
# Get default bank and tds account
|
||||||
#------------------------------------
|
#------------------------------------
|
||||||
|
|||||||
@@ -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)
|
# ********** 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)
|
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 ''
|
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
|
||||||
return cstr(ret)
|
return ret
|
||||||
else:
|
else:
|
||||||
msgprint("Supplier : %s does not exists" % (name))
|
msgprint("Supplier : %s does not exists" % (name))
|
||||||
raise Exception
|
raise Exception
|
||||||
@@ -142,14 +142,14 @@ class DocType(TransactionBase):
|
|||||||
ret['purchase_rate'] = item and flt(item[0]['last_purchase_rate']) or 0
|
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)
|
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
|
# Get Available Qty at Warehouse
|
||||||
def get_bin_details( self, arg = ''):
|
def get_bin_details( self, arg = ''):
|
||||||
arg = eval(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)
|
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 }
|
ret = { 'projected_qty' : bin and flt(bin[0]['projected_qty']) or 0 }
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
# Get UOM Details
|
# Get UOM Details
|
||||||
def get_uom_details(self, arg = ''):
|
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
|
'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
|
# get last purchase rate
|
||||||
def get_last_purchase_rate( self, obj):
|
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
|
'rate' : rate and (rate[0]['account_type'] == 'Tax' and not arg['charge_type'] == 'Actual') and flt(rate[0]['tax_rate']) or 0
|
||||||
}
|
}
|
||||||
#msgprint(ret)
|
#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')
|
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
|
# Get Item Details
|
||||||
def get_item_details(self, arg =''):
|
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
|
# Get UOM Details
|
||||||
def get_uom_details(self, arg = ''):
|
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
|
# get available qty at warehouse
|
||||||
def get_bin_details(self, arg = ''):
|
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
|
# Pull Indent
|
||||||
def get_indent_details(self):
|
def get_indent_details(self):
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class DocType:
|
|||||||
'supplier_name' : cd and cd[0][4] or '',
|
'supplier_name' : cd and cd[0][4] or '',
|
||||||
'supplier_address': cd and cd[0][5] or ''
|
'supplier_address': cd and cd[0][5] or ''
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
def get_rfq_details(self):
|
def get_rfq_details(self):
|
||||||
self.doc.clear_table(self.doclist, 'supplier_quotation_details')
|
self.doc.clear_table(self.doclist, 'supplier_quotation_details')
|
||||||
@@ -28,12 +28,12 @@ class DocType:
|
|||||||
def update_approval_status(self):
|
def update_approval_status(self):
|
||||||
if not self.doc.approval_status or self.doc.approval_status == 'Not Approved':
|
if not self.doc.approval_status or self.doc.approval_status == 'Not Approved':
|
||||||
set(self.doc, 'approval_status','Approved')
|
set(self.doc, 'approval_status','Approved')
|
||||||
return cstr(self.doc.approval_status)
|
return self.doc.approval_status
|
||||||
elif self.doc.approval_status == 'Approved':
|
elif self.doc.approval_status == 'Approved':
|
||||||
pc_obj = get_obj('Purchase Common')
|
pc_obj = get_obj('Purchase Common')
|
||||||
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
|
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
|
||||||
set(self.doc, 'approval_status', 'Not Approved')
|
set(self.doc, 'approval_status', 'Not Approved')
|
||||||
return cstr(self.doc.approval_status)
|
return self.doc.approval_status
|
||||||
|
|
||||||
def validate_item_list(self):
|
def validate_item_list(self):
|
||||||
if not getlist(self.doclist, 'supplier_quotation_details'):
|
if not getlist(self.doclist, 'supplier_quotation_details'):
|
||||||
@@ -101,4 +101,4 @@ class DocType:
|
|||||||
# Get Supplier Details
|
# Get Supplier Details
|
||||||
# --------------------
|
# --------------------
|
||||||
def get_supplier_details(self, name = ''):
|
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)
|
||||||
@@ -26,7 +26,7 @@ class DocType:
|
|||||||
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
|
emp_nm = sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
|
||||||
emp_nm= emp_nm and emp_nm[0][0] or ''
|
emp_nm= emp_nm and emp_nm[0][0] or ''
|
||||||
self.doc.employee_name = emp_nm
|
self.doc.employee_name = emp_nm
|
||||||
return cstr(emp_nm)
|
return emp_nm
|
||||||
|
|
||||||
def fetch_kra(self):
|
def fetch_kra(self):
|
||||||
if not self.doc.kra_template:
|
if not self.doc.kra_template:
|
||||||
@@ -88,7 +88,7 @@ class DocType:
|
|||||||
if d.score:
|
if d.score:
|
||||||
total = total + flt(d.score_earned)
|
total = total + flt(d.score_earned)
|
||||||
ret={'total_score':flt(total)}
|
ret={'total_score':flt(total)}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
def declare_completed(self):
|
def declare_completed(self):
|
||||||
ret={}
|
ret={}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class DocType:
|
|||||||
set(self.doc, 'employee_name', emp_nm and emp_nm[0][0] or '')
|
set(self.doc, 'employee_name', emp_nm and emp_nm[0][0] or '')
|
||||||
|
|
||||||
ret = { 'employee_name' : emp_nm and emp_nm[0][0] or ''}
|
ret = { 'employee_name' : emp_nm and emp_nm[0][0] or ''}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
#validation for duplicate record
|
#validation for duplicate record
|
||||||
def validate_duplicate_record(self):
|
def validate_duplicate_record(self):
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class DocType:
|
|||||||
if self.doc.date_of_birth:
|
if self.doc.date_of_birth:
|
||||||
dt = getdate(self.doc.date_of_birth) + datetime.timedelta(21915)
|
dt = getdate(self.doc.date_of_birth) + datetime.timedelta(21915)
|
||||||
ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')}
|
ret = {'date_of_retirement': dt.strftime('%Y-%m-%d')}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
# check if salary structure exists
|
# check if salary structure exists
|
||||||
#========================================================================================================
|
#========================================================================================================
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class DocType:
|
|||||||
'carry_forwarded_leaves' : prev_bal,
|
'carry_forwarded_leaves' : prev_bal,
|
||||||
'total_leaves_allocated' : flt(prev_bal) + flt(self.doc.new_leaves_allocated)
|
'total_leaves_allocated' : flt(prev_bal) + flt(self.doc.new_leaves_allocated)
|
||||||
}
|
}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# ********************************************** validate *****************************************************
|
# ********************************************** validate *****************************************************
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class DocType:
|
|||||||
'grade' : cstr(det[0][4]),
|
'grade' : cstr(det[0][4]),
|
||||||
'backup_employee': cstr(self.doc.employee)
|
'backup_employee': cstr(self.doc.employee)
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# Set Salary structure field values
|
# Set Salary structure field values
|
||||||
@@ -53,7 +53,7 @@ class DocType:
|
|||||||
'bank_ac_no' : basic_info and basic_info[0][1] or '',
|
'bank_ac_no' : basic_info and basic_info[0][1] or '',
|
||||||
'esic_no' : basic_info and basic_info[0][2] or '',
|
'esic_no' : basic_info and basic_info[0][2] or '',
|
||||||
'pf_no' : basic_info and basic_info[0][3] or ''}
|
'pf_no' : basic_info and basic_info[0][3] or ''}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
# Make earning and deduction table
|
# Make earning and deduction table
|
||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class DocType:
|
|||||||
ret={
|
ret={
|
||||||
'description' : item and item[0]['description'] or ''
|
'description' : item and item[0]['description'] or ''
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
def get_workstation_details(self,workstation):
|
def get_workstation_details(self,workstation):
|
||||||
ws = sql("select hour_rate, capacity from `tabWorkstation` where name = %s",workstation , as_dict = 1)
|
ws = sql("select hour_rate, capacity from `tabWorkstation` where name = %s",workstation , as_dict = 1)
|
||||||
@@ -44,7 +44,7 @@ class DocType:
|
|||||||
'hour_rate' : ws and flt(ws[0]['hour_rate']) or '',
|
'hour_rate' : ws and flt(ws[0]['hour_rate']) or '',
|
||||||
'workstation_capacity' : ws and flt(ws[0]['capacity']) or ''
|
'workstation_capacity' : ws and flt(ws[0]['capacity']) or ''
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
def get_bom_material_detail(self, arg):
|
def get_bom_material_detail(self, arg):
|
||||||
arg = eval(arg)
|
arg = eval(arg)
|
||||||
@@ -106,7 +106,7 @@ class DocType:
|
|||||||
'standard_rate' : 0
|
'standard_rate' : 0
|
||||||
}
|
}
|
||||||
ret_item.update(ret_bom_rates)
|
ret_item.update(ret_bom_rates)
|
||||||
return cstr(ret_item)
|
return ret_item
|
||||||
|
|
||||||
def set_as_default_bom(self):
|
def set_as_default_bom(self):
|
||||||
# set Is Default as 1
|
# set Is Default as 1
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class DocType:
|
|||||||
'stock_uom' : item and item[0]['stock_uom'],
|
'stock_uom' : item and item[0]['stock_uom'],
|
||||||
'bom_no' : item and item[0]['default_bom']
|
'bom_no' : item and item[0]['default_bom']
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
else:
|
else:
|
||||||
msgprint("Item %s does not exist in system." %(args['item_code']))
|
msgprint("Item %s does not exist in system." %(args['item_code']))
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class DocType:
|
|||||||
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
|
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
|
||||||
ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
|
ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
|
||||||
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
|
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
|
||||||
return cstr(ret)
|
return ret
|
||||||
else:
|
else:
|
||||||
msgprint("Customer : %s does not exist in system." % (self.doc.customer))
|
msgprint("Customer : %s does not exist in system." % (self.doc.customer))
|
||||||
raise Exception
|
raise Exception
|
||||||
@@ -65,7 +65,7 @@ class DocType:
|
|||||||
#if pft > 0:
|
#if pft > 0:
|
||||||
per_pft = (flt(pft) / flt(self.doc.project_value)) * 100
|
per_pft = (flt(pft) / flt(self.doc.project_value)) * 100
|
||||||
ret = {'gross_margin_value': pft, 'per_gross_margin': per_pft}
|
ret = {'gross_margin_value': pft, 'per_gross_margin': per_pft}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
# validate
|
# validate
|
||||||
#================================================
|
#================================================
|
||||||
|
|||||||
@@ -22,18 +22,18 @@ class DocType:
|
|||||||
cust = sql("select customer, customer_name from `tabProject` where name = %s", self.doc.project)
|
cust = sql("select customer, customer_name from `tabProject` where name = %s", self.doc.project)
|
||||||
if cust:
|
if cust:
|
||||||
ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
|
ret = {'customer': cust and cust[0][0] or '', 'customer_name': cust and cust[0][1] or ''}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
def get_customer_details(self):
|
def get_customer_details(self):
|
||||||
cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
|
cust = sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
|
||||||
if cust:
|
if cust:
|
||||||
ret = {'customer_name': cust and cust[0][0] or ''}
|
ret = {'customer_name': cust and cust[0][0] or ''}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
def get_allocated_to_name(self):
|
def get_allocated_to_name(self):
|
||||||
as_em = sql("select first_name, last_name from `tabProfile` where name=%s",self.doc.allocated_to)
|
as_em = sql("select first_name, last_name from `tabProfile` where name=%s",self.doc.allocated_to)
|
||||||
ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''}
|
ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
# validate
|
# validate
|
||||||
#--------------------------------------------
|
#--------------------------------------------
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class DocType:
|
|||||||
tsk = sql("select name, project, customer, customer_name from `tabTicket` where subject = %s", task_sub)
|
tsk = sql("select name, project, customer, customer_name from `tabTicket` where subject = %s", task_sub)
|
||||||
if tsk:
|
if tsk:
|
||||||
ret = {'task_id': tsk and tsk[0][0] or '', 'project_name': tsk and tsk[0][1] or '', 'customer_name': tsk and tsk[0][3] or ''}
|
ret = {'task_id': tsk and tsk[0][0] or '', 'project_name': tsk and tsk[0][1] or '', 'customer_name': tsk and tsk[0][3] or ''}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if getdate(self.doc.timesheet_date) > getdate(nowdate()):
|
if getdate(self.doc.timesheet_date) > getdate(nowdate()):
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class DocType(TransactionBase):
|
|||||||
ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
|
ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
|
||||||
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
|
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
|
||||||
|
|
||||||
return cstr(ret)
|
return ret
|
||||||
else:
|
else:
|
||||||
msgprint("Customer : %s does not exist in system." % (name))
|
msgprint("Customer : %s does not exist in system." % (name))
|
||||||
raise Exception
|
raise Exception
|
||||||
@@ -64,7 +64,7 @@ class DocType(TransactionBase):
|
|||||||
'contact_no' : contact and contact[0]['contact_no'] or '',
|
'contact_no' : contact and contact[0]['contact_no'] or '',
|
||||||
'email_id' : contact and contact[0]['email_id'] or ''
|
'email_id' : contact and contact[0]['email_id'] or ''
|
||||||
}
|
}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
# ====================================================================================================================
|
# ====================================================================================================================
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
@@ -184,7 +184,7 @@ class DocType(TransactionBase):
|
|||||||
else:
|
else:
|
||||||
set(self.doc, 'status', 'Enquiry Lost')
|
set(self.doc, 'status', 'Enquiry Lost')
|
||||||
set(self.doc, 'order_lost_reason', arg)
|
set(self.doc, 'order_lost_reason', arg)
|
||||||
return cstr('true')
|
return 'true'
|
||||||
|
|
||||||
# ====================================================================================================================
|
# ====================================================================================================================
|
||||||
def update_follow_up(self):
|
def update_follow_up(self):
|
||||||
|
|||||||
@@ -30,19 +30,6 @@ class DocType(TransactionBase):
|
|||||||
def autoname(self):
|
def autoname(self):
|
||||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
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
|
#fetch delivery note details
|
||||||
#====================================
|
#====================================
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class DocType:
|
|||||||
'description': it and it[0][3] or '',
|
'description': it and it[0][3] or '',
|
||||||
'uom' : it and it[0][4] or ''
|
'uom' : it and it[0][4] or ''
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
import string
|
import string
|
||||||
|
|||||||
@@ -45,17 +45,12 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
self.get_adj_percent()
|
self.get_adj_percent()
|
||||||
|
|
||||||
return cstr(self.doc.quotation_to)
|
return self.doc.quotation_to
|
||||||
|
|
||||||
# Get Customer Details
|
|
||||||
# --------------------
|
|
||||||
#def get_customer_details(self):
|
|
||||||
# return cstr(get_obj('Sales Common').get_customer_details(self))
|
|
||||||
|
|
||||||
# Get contact person details based on customer selected
|
# Get contact person details based on customer selected
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
def get_contact_details(self):
|
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
|
# Clear Quotation Details
|
||||||
# -----------------------
|
# -----------------------
|
||||||
@@ -111,7 +106,7 @@ class DocType(TransactionBase):
|
|||||||
'contact_mobile' : details and details[0]['mobile_no'] or '-',
|
'contact_mobile' : details and details[0]['mobile_no'] or '-',
|
||||||
'contact_email' : details and details[0]['email_id'] or '-'
|
'contact_email' : details and details[0]['email_id'] or '-'
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# GET TERMS AND CONDITIONS
|
# GET TERMS AND CONDITIONS
|
||||||
@@ -295,7 +290,7 @@ class DocType(TransactionBase):
|
|||||||
set(self.doc, 'status', 'Order Lost')
|
set(self.doc, 'status', 'Order Lost')
|
||||||
set(self.doc, 'order_lost_reason', arg)
|
set(self.doc, 'order_lost_reason', arg)
|
||||||
self.update_enquiry('order lost')
|
self.update_enquiry('order lost')
|
||||||
return cstr('true')
|
return 'true'
|
||||||
|
|
||||||
#check if value entered in item table
|
#check if value entered in item table
|
||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
|
|||||||
@@ -118,21 +118,21 @@ class DocType(TransactionBase):
|
|||||||
t = {}
|
t = {}
|
||||||
for x in tax: t[x[0]] = flt(x[1])
|
for x in tax: t[x[0]] = flt(x[1])
|
||||||
ret = {
|
ret = {
|
||||||
'description' : item and item[0]['description_html'] or item[0]['description'],
|
'description' : item and item[0]['description_html'] or item[0]['description'],
|
||||||
'item_group' : item and item[0]['item_group'] or '',
|
'item_group' : item and item[0]['item_group'] or '',
|
||||||
'item_name' : item and item[0]['item_name'] or '',
|
'item_name' : item and item[0]['item_name'] or '',
|
||||||
'brand' : item and item[0]['brand'] or '',
|
'brand' : item and item[0]['brand'] or '',
|
||||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||||
'reserved_warehouse' : item and item[0]['default_warehouse'] or '',
|
'reserved_warehouse' : item and item[0]['default_warehouse'] or '',
|
||||||
'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 '',
|
'income_account' : item and item[0]['default_income_account'] or '',
|
||||||
'cost_center' : item and item[0]['default_sales_cost_center'] 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
|
'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,
|
'adj_rate' : 0,
|
||||||
'amount' : 0,
|
'amount' : 0,
|
||||||
'export_amount' : 0,
|
'export_amount' : 0,
|
||||||
'item_tax_rate' : str(t),
|
'item_tax_rate' : str(t),
|
||||||
'batch_no' : ''
|
'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
|
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)
|
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':
|
if obj.doc.doctype == 'Receivable Voucher':
|
||||||
return ret
|
return ret
|
||||||
return str(ret)
|
|
||||||
|
return ret
|
||||||
|
|
||||||
# ***************** Get Ref rate as entered in Item Master ********************
|
# ***************** Get Ref rate as entered in Item Master ********************
|
||||||
def get_ref_rate(self, item_code, price_list_name, currency):
|
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.base_ref_rate = flt(ref_rate) * flt(obj.doc.conversion_rate)
|
||||||
d.export_rate = flt(ref_rate)
|
d.export_rate = flt(ref_rate)
|
||||||
|
|
||||||
|
|
||||||
# Load Default Taxes
|
# Load Default Taxes
|
||||||
# ====================
|
# ====================
|
||||||
def load_default_taxes(self, obj):
|
def load_default_taxes(self, obj):
|
||||||
@@ -203,7 +203,7 @@ class DocType(TransactionBase):
|
|||||||
ret = {
|
ret = {
|
||||||
'item_tax_rate' : tax and str(t) or ''
|
'item_tax_rate' : tax and str(t) or ''
|
||||||
}
|
}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
# Get Serial No Details
|
# Get Serial No Details
|
||||||
# ==========================================================================
|
# ==========================================================================
|
||||||
@@ -220,7 +220,7 @@ class DocType(TransactionBase):
|
|||||||
'description' : item and item[0]['description'] or '',
|
'description' : item and item[0]['description'] or '',
|
||||||
'item_tax_rate' : str(t)
|
'item_tax_rate' : str(t)
|
||||||
}
|
}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
# Get Commission rate
|
# Get Commission rate
|
||||||
# =======================================================================
|
# =======================================================================
|
||||||
@@ -233,7 +233,7 @@ class DocType(TransactionBase):
|
|||||||
'commission_rate' : comm_rate and flt(comm_rate[0]['commission_rate']) or 0,
|
'commission_rate' : comm_rate and flt(comm_rate[0]['commission_rate']) or 0,
|
||||||
'total_commission' : flt(total_comm)
|
'total_commission' : flt(total_comm)
|
||||||
}
|
}
|
||||||
return str(ret)
|
return ret
|
||||||
else:
|
else:
|
||||||
msgprint("Business Associate : %s does not exist in the system." % (sales_partner))
|
msgprint("Business Associate : %s does not exist in the system." % (sales_partner))
|
||||||
raise Exception
|
raise Exception
|
||||||
@@ -287,7 +287,7 @@ class DocType(TransactionBase):
|
|||||||
ret = {
|
ret = {
|
||||||
'rate' : rate and flt(rate[0]['tax_rate']) or 0
|
'rate' : rate and flt(rate[0]['tax_rate']) or 0
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# Make Packing List from Sales BOM
|
# Make Packing List from Sales BOM
|
||||||
|
|||||||
@@ -102,8 +102,7 @@ class DocType(TransactionBase):
|
|||||||
'projected_qty' : tot_avail_qty and flt(tot_avail_qty[0]['projected_qty']) or 0,
|
'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
|
'actual_qty' : tot_avail_qty and flt(tot_avail_qty[0]['actual_qty']) or 0
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# OTHER CHARGES TRIGGER FUNCTIONS
|
# OTHER CHARGES TRIGGER FUNCTIONS
|
||||||
# ====================================================================================
|
# ====================================================================================
|
||||||
@@ -136,7 +135,7 @@ class DocType(TransactionBase):
|
|||||||
nm = nm and nm[0][0] or ''
|
nm = nm and nm[0][0] or ''
|
||||||
|
|
||||||
if not nm:
|
if not nm:
|
||||||
return cstr('No')
|
return 'No'
|
||||||
|
|
||||||
#check if maintenance visit already generated
|
#check if maintenance visit already generated
|
||||||
#============================================
|
#============================================
|
||||||
@@ -145,7 +144,7 @@ class DocType(TransactionBase):
|
|||||||
nm = nm and nm[0][0] or ''
|
nm = nm and nm[0][0] or ''
|
||||||
|
|
||||||
if not nm:
|
if not nm:
|
||||||
return cstr('No')
|
return 'No'
|
||||||
|
|
||||||
# VALIDATE
|
# VALIDATE
|
||||||
# =====================================================================================
|
# =====================================================================================
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class DocType:
|
|||||||
for r in res:
|
for r in res:
|
||||||
ret[cstr(r[0])]=r[1] and cstr(r[1]) or ''
|
ret[cstr(r[0])]=r[1] and cstr(r[1]) or ''
|
||||||
|
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
def set_cp_value(self, key):
|
def set_cp_value(self, key):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -40,15 +40,10 @@ class DocType(TransactionBase):
|
|||||||
def validate_fiscal_year(self):
|
def validate_fiscal_year(self):
|
||||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
|
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
|
||||||
|
|
||||||
# ******************* Get Customer Details ***********************
|
|
||||||
#def get_customer_details(self):
|
|
||||||
# sales_com_obj = get_obj('Sales Common')
|
|
||||||
# sales_com_obj.get_customer_details(self)
|
|
||||||
# sales_com_obj.get_shipping_details(self)
|
|
||||||
|
|
||||||
# ****** Get contact person details based on customer selected ****
|
# ****** Get contact person details based on customer selected ****
|
||||||
def get_contact_details(self):
|
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)
|
||||||
|
|
||||||
# *********** Get Commission rate of Sales Partner ****************
|
# *********** Get Commission rate of Sales Partner ****************
|
||||||
def get_comm_rate(self, sales_partner):
|
def get_comm_rate(self, sales_partner):
|
||||||
@@ -122,7 +117,7 @@ class DocType(TransactionBase):
|
|||||||
ret = {
|
ret = {
|
||||||
'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
|
'actual_qty' : actual_qty and flt(actual_qty[0]['actual_qty']) or 0
|
||||||
}
|
}
|
||||||
return cstr(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# OTHER CHARGES TRIGGER FUNCTIONS
|
# OTHER CHARGES TRIGGER FUNCTIONS
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class DocType:
|
|||||||
ret = {
|
ret = {
|
||||||
'tax_rate' : rate and flt(rate[0][0]) or 0
|
'tax_rate' : rate and flt(rate[0][0]) or 0
|
||||||
}
|
}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
bin = sql("select stock_uom from `tabBin` where item_code = '%s' " % self.doc.item_code)
|
bin = sql("select stock_uom from `tabBin` where item_code = '%s' " % self.doc.item_code)
|
||||||
|
|||||||
@@ -43,17 +43,14 @@ class DocType(TransactionBase):
|
|||||||
def validate_fiscal_year(self):
|
def validate_fiscal_year(self):
|
||||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Transaction Date')
|
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Transaction Date')
|
||||||
|
|
||||||
# Get Supplier Details
|
|
||||||
#def get_supplier_details(self, name = ''):
|
|
||||||
# return cstr(get_obj(dt='Purchase Common').get_supplier_details(name))
|
|
||||||
|
|
||||||
# Get Item Details
|
# Get Item Details
|
||||||
def get_item_details(self, arg = ''):
|
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
|
# Get UOM Details
|
||||||
def get_uom_details(self, arg = ''):
|
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 TERMS & CONDITIONS
|
# GET TERMS & CONDITIONS
|
||||||
# =====================================================================================
|
# =====================================================================================
|
||||||
@@ -62,7 +59,7 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
# get available qty at warehouse
|
# get available qty at warehouse
|
||||||
def get_bin_details(self, arg = ''):
|
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)f
|
||||||
|
|
||||||
# Pull Purchase Order
|
# Pull Purchase Order
|
||||||
def get_po_details(self):
|
def get_po_details(self):
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class DocType:
|
|||||||
def get_item_details(self, name):
|
def get_item_details(self, name):
|
||||||
det = sql("select description, stock_uom from `tabItem` where name = '%s' " % cstr(name))
|
det = sql("select description, stock_uom from `tabItem` where name = '%s' " % cstr(name))
|
||||||
rate = sql("select ref_rate from `tabRef Rate Detail` where price_list_name = %s and parent = %s and ref_currency = %s", (self.doc.price_list, name, self.doc.currency))
|
rate = sql("select ref_rate from `tabRef Rate Detail` where price_list_name = %s and parent = %s and ref_currency = %s", (self.doc.price_list, name, self.doc.currency))
|
||||||
return cstr({'description' : det and det[0][0] or '', 'uom': det and det[0][1] or '', 'rate': rate and flt(rate[0][0]) or 0.00})
|
return {'description' : det and det[0][0] or '', 'uom': det and det[0][1] or '', 'rate': rate and flt(rate[0][0]) or 0.00}
|
||||||
|
|
||||||
|
|
||||||
def get_main_item(self):
|
def get_main_item(self):
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class DocType:
|
|||||||
'conversion_factor' : 1,
|
'conversion_factor' : 1,
|
||||||
'batch_no' : ''
|
'batch_no' : ''
|
||||||
}
|
}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# Get UOM Details
|
# Get UOM Details
|
||||||
@@ -70,7 +70,7 @@ class DocType:
|
|||||||
'conversion_factor' : flt(uom[0]['conversion_factor']),
|
'conversion_factor' : flt(uom[0]['conversion_factor']),
|
||||||
'transfer_qty' : flt(arg['qty']) * flt(uom[0]['conversion_factor']),
|
'transfer_qty' : flt(arg['qty']) * flt(uom[0]['conversion_factor']),
|
||||||
}
|
}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
# get stock and incoming rate on posting date
|
# get stock and incoming rate on posting date
|
||||||
@@ -396,7 +396,7 @@ class DocType:
|
|||||||
'customer_name' : res and res[0][1] or '',
|
'customer_name' : res and res[0][1] or '',
|
||||||
'customer_address' : res and res[0][2] or ''}
|
'customer_address' : res and res[0][2] or ''}
|
||||||
|
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def get_cust_addr(self):
|
def get_cust_addr(self):
|
||||||
@@ -405,7 +405,7 @@ class DocType:
|
|||||||
'customer_name' : res and res[0][0] or '',
|
'customer_name' : res and res[0][0] or '',
|
||||||
'customer_address' : res and res[0][1] or ''}
|
'customer_address' : res and res[0][1] or ''}
|
||||||
|
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -415,7 +415,7 @@ class DocType:
|
|||||||
'supplier' : res and res[0][0] or '',
|
'supplier' : res and res[0][0] or '',
|
||||||
'supplier_name' :res and res[0][1] or '',
|
'supplier_name' :res and res[0][1] or '',
|
||||||
'supplier_address' : res and res[0][2] or ''}
|
'supplier_address' : res and res[0][2] or ''}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def get_supp_addr(self):
|
def get_supp_addr(self):
|
||||||
@@ -423,4 +423,4 @@ class DocType:
|
|||||||
ret = {
|
ret = {
|
||||||
'supplier_name' : res and res[0][0] or '',
|
'supplier_name' : res and res[0][0] or '',
|
||||||
'supplier_address' : res and res[0][1] or ''}
|
'supplier_address' : res and res[0][1] or ''}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class DocType:
|
|||||||
self.doc, self.doclist = d,dl
|
self.doc, self.doclist = d,dl
|
||||||
|
|
||||||
def get_stock_uom(self, item_code):
|
def get_stock_uom(self, item_code):
|
||||||
return cstr({'current_stock_uom': cstr(get_value('Item', item_code, 'stock_uom'))})
|
return {'current_stock_uom': cstr(get_value('Item', item_code, 'stock_uom'))}
|
||||||
|
|
||||||
def validate_mandatory(self):
|
def validate_mandatory(self):
|
||||||
if not cstr(self.doc.item_code):
|
if not cstr(self.doc.item_code):
|
||||||
|
|||||||
@@ -28,37 +28,6 @@ class DocType(TransactionBase):
|
|||||||
#self.doc.name = make_autoname('CI/' + self.doc.fiscal_year + '/.######')
|
#self.doc.name = make_autoname('CI/' + self.doc.fiscal_year + '/.######')
|
||||||
self.doc.name = make_autoname(self.doc.naming_series + '.######')
|
self.doc.name = make_autoname(self.doc.naming_series + '.######')
|
||||||
|
|
||||||
#def get_customer_details(self):
|
|
||||||
# details = sql("select address, territory, customer_group, customer_name from `tabCustomer` where name = '%s' and docstatus != 2" %(self.doc.customer), as_dict = 1)
|
|
||||||
# if details:
|
|
||||||
# ret = {
|
|
||||||
# 'customer_address' : details and details[0]['address'] or '',
|
|
||||||
# 'customer_name' : details and details[0]['customer_name'] or '',
|
|
||||||
# 'territory' : details and details[0]['territory'] or '',
|
|
||||||
# 'customer_group' : details and details[0]['customer_group'] or ''
|
|
||||||
# }
|
|
||||||
# # ********** 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 customer_name = '%s' and is_customer = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(self.doc.customer), as_dict = 1)
|
|
||||||
# ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
|
|
||||||
# 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)
|
|
||||||
# else:
|
|
||||||
# msgprint("Customer : %s does not exist in system." % (name))
|
|
||||||
# raise Exception
|
|
||||||
|
|
||||||
# Get customer's contact person details
|
|
||||||
# ==============================================================
|
|
||||||
#def get_contact_details(self):
|
|
||||||
# contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s' and docstatus != 2" %(self.doc.contact_person, self.doc.customer), as_dict = 1)
|
|
||||||
# ret = {
|
|
||||||
# 'contact_no' : contact and contact[0]['contact_no'] or '',
|
|
||||||
# 'email_id' : contact and contact[0]['email_id'] or ''
|
|
||||||
# }
|
|
||||||
# return str(ret)
|
|
||||||
|
|
||||||
|
|
||||||
#check if maintenance schedule already generated
|
#check if maintenance schedule already generated
|
||||||
#============================================
|
#============================================
|
||||||
def check_maintenance_visit(self):
|
def check_maintenance_visit(self):
|
||||||
@@ -66,7 +35,7 @@ class DocType(TransactionBase):
|
|||||||
nm = nm and nm[0][0] or ''
|
nm = nm and nm[0][0] or ''
|
||||||
|
|
||||||
if not nm:
|
if not nm:
|
||||||
return cstr('No')
|
return 'No'
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
if session['user'] != 'Guest':
|
if session['user'] != 'Guest':
|
||||||
|
|||||||
@@ -38,20 +38,7 @@ class DocType(TransactionBase):
|
|||||||
'item_name': item and item[0]['item_name'] or '',
|
'item_name': item and item[0]['item_name'] or '',
|
||||||
'description' : item and item[0]['description'] or ''
|
'description' : item and item[0]['description'] or ''
|
||||||
}
|
}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
#pull 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)
|
|
||||||
|
|
||||||
# generate maintenance schedule
|
# generate maintenance schedule
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
@@ -132,7 +119,7 @@ class DocType(TransactionBase):
|
|||||||
count = period/365
|
count = period/365
|
||||||
|
|
||||||
ret = {'no_of_visits':count}
|
ret = {'no_of_visits':count}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
def validate_maintenance_detail(self):
|
def validate_maintenance_detail(self):
|
||||||
if not getlist(self.doclist, 'item_maintenance_detail'):
|
if not getlist(self.doclist, 'item_maintenance_detail'):
|
||||||
|
|||||||
@@ -31,20 +31,7 @@ class DocType(TransactionBase):
|
|||||||
'item_name' : item and item[0]['item_name'] or '',
|
'item_name' : item and item[0]['item_name'] or '',
|
||||||
'description' : item and item[0]['description'] or ''
|
'description' : item and item[0]['description'] or ''
|
||||||
}
|
}
|
||||||
return str(ret)
|
return ret
|
||||||
|
|
||||||
#get 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 details of resp Sales order or customer issue
|
# fetch details of resp Sales order or customer issue
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user