mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
restructured erpnext and deleted unwanted
This commit is contained in:
0
selling/doctype/customer/__init__.py
Normal file
0
selling/doctype/customer/__init__.py
Normal file
211
selling/doctype/customer/customer.js
Normal file
211
selling/doctype/customer/customer.js
Normal file
@@ -0,0 +1,211 @@
|
||||
$import(Contact Control)
|
||||
|
||||
/* ********************************* onload ********************************************* */
|
||||
|
||||
cur_frm.cscript.onload = function(doc,dt,dn){
|
||||
// history doctypes and scripts
|
||||
cur_frm.history_dict = {
|
||||
'Quotation' : 'cur_frm.cscript.make_qtn_list(this.body, this.doc)',
|
||||
'Sales Order' : 'cur_frm.cscript.make_so_list(this.body, this.doc)',
|
||||
'Delivery Note' : 'cur_frm.cscript.make_dn_list(this.body, this.doc)',
|
||||
'Sales Invoice' : 'cur_frm.cscript.make_si_list(this.body, this.doc)'
|
||||
}
|
||||
// make address, contact, shipping, history list body
|
||||
cur_frm.cscript.make_hl_body();
|
||||
//cur_frm.cscript.make_sl_body();
|
||||
}
|
||||
|
||||
cur_frm.add_fetch('lead_name', 'company_name', 'customer_name');
|
||||
cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate');
|
||||
|
||||
/* ********************************* refresh ********************************************* */
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,dt,dn) {
|
||||
if(sys_defaults.cust_master_name == 'Customer Name')
|
||||
hide_field('naming_series');
|
||||
else
|
||||
unhide_field('naming_series');
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['Address HTML','Contact HTML']);
|
||||
//cur_frm.cscript.set_hl_msg(doc);
|
||||
//cur_frm.cscript.set_sl_msg(doc);
|
||||
}else{
|
||||
unhide_field(['Address HTML','Contact HTML']);
|
||||
// make lists
|
||||
cur_frm.cscript.make_address(doc,dt,dn);
|
||||
cur_frm.cscript.make_contact(doc,dt,dn);
|
||||
cur_frm.cscript.make_history(doc,dt,dn);
|
||||
//cur_frm.cscript.make_shipping_address(doc,dt,dn);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_address = function() {
|
||||
if(!cur_frm.address_list) {
|
||||
cur_frm.address_list = new wn.widgets.Listing({
|
||||
parent: cur_frm.fields_dict['Address HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Address",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Address"][dn];
|
||||
ndoc.customer = cur_frm.doc.name;
|
||||
ndoc.customer_name = cur_frm.doc.customer_name;
|
||||
ndoc.address_type = 'Office';
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.address_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
||||
},
|
||||
as_dict: 1,
|
||||
no_results_message: 'No addresses created',
|
||||
render_row: function(wrapper, data) {
|
||||
$(wrapper).css('padding','5px 0px');
|
||||
var link = $ln(wrapper,cstr(data.name), function() { loaddoc("Address", this.dn); }, {fontWeight:'bold'});
|
||||
link.dn = data.name
|
||||
|
||||
$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_address ? '[Primary]' : '') + (data.is_shipping_address ? '[Shipping]' : ''));
|
||||
$a(wrapper,'div','',{marginTop:'5px', color:'#555'},
|
||||
(data.address_line1 ? data.address_line1 + '<br />' : '') +
|
||||
(data.address_line2 ? data.address_line2 + '<br />' : '') +
|
||||
(data.city ? data.city + '<br />' : '') +
|
||||
(data.state ? data.state + ', ' : '') +
|
||||
(data.country ? data.country + '<br />' : '') +
|
||||
(data.pincode ? 'Pincode: ' + data.pincode + '<br />' : '') +
|
||||
(data.phone ? 'Phone: ' + data.phone + '<br />' : '') +
|
||||
(data.fax ? 'Fax: ' + data.fax + '<br />' : '') +
|
||||
(data.email_id ? 'Email: ' + data.email_id + '<br />' : ''));
|
||||
}
|
||||
});
|
||||
}
|
||||
cur_frm.address_list.run();
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_contact = function() {
|
||||
if(!cur_frm.contact_list) {
|
||||
cur_frm.contact_list = new wn.widgets.Listing({
|
||||
parent: cur_frm.fields_dict['Contact HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Contact",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Contact"][dn];
|
||||
ndoc.customer = cur_frm.doc.name;
|
||||
ndoc.customer_name = cur_frm.doc.customer_name;
|
||||
if(cur_frm.doc.customer_type == 'Individual') {
|
||||
ndoc.first_name = cur_frm.doc.customer_name;
|
||||
}
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.contact_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
||||
},
|
||||
as_dict: 1,
|
||||
no_results_message: 'No contacts created',
|
||||
render_row: function(wrapper, data) {
|
||||
$(wrapper).css('padding', '5px 0px');
|
||||
var link = $ln(wrapper, cstr(data.name), function() { loaddoc("Contact", this.dn); }, {fontWeight:'bold'});
|
||||
link.dn = data.name
|
||||
|
||||
$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_contact ? '[Primary]' : ''));
|
||||
$a(wrapper,'div', '',{marginTop:'5px', color:'#555'}, data.first_name + (data.last_name ? ' ' + data.last_name + '<br />' : '<br>') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.mobile_no ? 'Mobile: ' + data.mobile_no + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : '') + (data.department ? 'Department: ' + data.department + '<br />' : '') + (data.designation ? 'Designation: ' + data.designation + '<br />' : ''));
|
||||
}
|
||||
});
|
||||
}
|
||||
cur_frm.contact_list.run();
|
||||
|
||||
}
|
||||
|
||||
/* ********************************* client triggers ************************************** */
|
||||
|
||||
// ---------------
|
||||
// customer group
|
||||
// ---------------
|
||||
cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) {
|
||||
return 'SELECT `tabCustomer Group`.`name`, `tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "No" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.cscript.CGHelp = function(doc,dt,dn){
|
||||
var call_back = function(){
|
||||
var sb_obj = new SalesBrowser();
|
||||
sb_obj.set_val('Customer Group');
|
||||
}
|
||||
loadpage('Sales Browser',call_back);
|
||||
}
|
||||
|
||||
// -----
|
||||
// lead
|
||||
// -----
|
||||
cur_frm.fields_dict['lead_name'].get_query = function(doc,dt,dn){
|
||||
return 'SELECT `tabLead`.`name` FROM `tabLead` WHERE `tabLead`.`status`!="Converted" AND `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50';
|
||||
}
|
||||
|
||||
/* ********************************* transaction history ************************************** */
|
||||
|
||||
// --------------------
|
||||
// make quotation list
|
||||
// --------------------
|
||||
cur_frm.cscript.make_qtn_list = function(parent,doc){
|
||||
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
|
||||
lst.colnames = ['Sr.','Id','Status','Quotation Date','Contact Person','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Data','Currency'];
|
||||
lst.coloptions = ['','Quotation','','','',''];
|
||||
|
||||
var q = repl("select name,status,transaction_date, contact_person, grand_total from tabQuotation where customer='%(cust)s' order by transaction_date desc", {'cust':doc.name});
|
||||
var q_max = repl("select count(name) from tabQuotation where customer='%(cust)s'", {'cust':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Quotation','Quotation');
|
||||
}
|
||||
|
||||
// -------------
|
||||
// make so list
|
||||
// -------------
|
||||
cur_frm.cscript.make_so_list = function(parent,doc){
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','30%','25%'];
|
||||
lst.colnames = ['Sr.','Id','Status','Sales Order Date','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Currency'];
|
||||
lst.coloptions = ['','Sales Order','','',''];
|
||||
|
||||
var q = repl("select name,status,transaction_date, grand_total from `tabSales Order` where customer='%(cust)s' order by transaction_date desc", {'cust':doc.name});
|
||||
var q_max = repl("select count(name) from `tabSales Order` where customer='%(cust)s'", {'cust':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Order','Sales Order');
|
||||
}
|
||||
|
||||
// -------------
|
||||
// make dn list
|
||||
// -------------
|
||||
cur_frm.cscript.make_dn_list = function(parent,doc){
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
|
||||
lst.colnames = ['Sr.','Id','Status','Delivery Note Date','Territory','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Link','Currency'];
|
||||
lst.coloptions = ['','Delivery Note','','','Territory',''];
|
||||
|
||||
var q = repl("select name,status,transaction_date,territory,grand_total from `tabDelivery Note` where customer='%(cust)s' order by transaction_date desc", {'cust':doc.name});
|
||||
var q_max = repl("select count(name) from `tabDelivery Note` where customer='%(cust)s'", {'cust':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Delivery Note','Delivery Note');
|
||||
}
|
||||
|
||||
// -------------
|
||||
// make si list
|
||||
// -------------
|
||||
cur_frm.cscript.make_si_list = function(parent,doc){
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
|
||||
lst.colnames = ['Sr.','Id','Posting Date','Due Date','Debit To','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Link','Currency'];
|
||||
lst.coloptions = ['','Receivable Voucher','','','Account',''];
|
||||
|
||||
|
||||
var q = repl("select name,posting_date,due_date,debit_to,grand_total from `tabReceivable Voucher` where customer='%(cust)s' order by posting_date desc", {'cust':doc.name});
|
||||
var q_max = repl("select count(name) from `tabReceivable Voucher` where customer='%(cust)s'", {'cust':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Sales Invoice','Receivable Voucher');
|
||||
}
|
||||
230
selling/doctype/customer/customer.py
Normal file
230
selling/doctype/customer/customer.py
Normal file
@@ -0,0 +1,230 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, date_diff, flt, formatdate, get_defaults, getdate, has_common, now, nowdate, replace_newlines, sendmail, set_default, user_format, validate_email_add
|
||||
from webnotes.model.doc import Document, make_autoname
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# ******************************************************* autoname ***********************************************************
|
||||
def autoname(self):
|
||||
cust_master_name = get_defaults().get('cust_master_name')
|
||||
if cust_master_name == 'Customer Name':
|
||||
|
||||
# filter out bad characters in name
|
||||
#cust = self.doc.customer_name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
|
||||
cust = self.doc.customer_name
|
||||
|
||||
supp = sql("select name from `tabSupplier` where name = %s", (cust))
|
||||
supp = supp and supp[0][0] or ''
|
||||
if supp:
|
||||
msgprint("You already have a Supplier with same name")
|
||||
raise Exception
|
||||
else:
|
||||
self.doc.name = cust
|
||||
|
||||
else:
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
|
||||
# ******************************************************* triggers ***********************************************************
|
||||
# ----------------
|
||||
# get company abbr
|
||||
# -----------------
|
||||
def get_company_abbr(self):
|
||||
return get_value('Company', self.doc.company, 'abbr')
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------
|
||||
# get parent account(i.e receivables group from company where default account head need to be created)
|
||||
# -----------------------------------------------------------------------------------------------------
|
||||
def get_receivables_group(self):
|
||||
g = sql("select receivables_group from tabCompany where name=%s", self.doc.company)
|
||||
g = g and g[0][0] or ''
|
||||
if not g:
|
||||
msgprint("Update Company master, assign a default group for Receivables")
|
||||
raise Exception
|
||||
return g
|
||||
|
||||
# ******************************************************* validate *********************************************************
|
||||
# ----------------
|
||||
# validate values
|
||||
# ----------------
|
||||
def validate_values(self):
|
||||
# Master name by naming series -> Series field mandatory
|
||||
if get_defaults().get('cust_master_name') == 'Naming Series' and not self.doc.naming_series:
|
||||
msgprint("Series is Mandatory.")
|
||||
raise Exception
|
||||
|
||||
# ---------
|
||||
# validate
|
||||
# ---------
|
||||
def validate(self):
|
||||
self.validate_values()
|
||||
|
||||
# ******************************************************* on update *********************************************************
|
||||
# ------------------------
|
||||
# create customer address
|
||||
# ------------------------
|
||||
def create_customer_address(self):
|
||||
addr_flds = [self.doc.address_line1, self.doc.address_line2, self.doc.city, self.doc.state, self.doc.country, self.doc.pincode]
|
||||
address_line = "\n".join(filter(lambda x : (x!='' and x!=None),addr_flds))
|
||||
|
||||
if self.doc.phone_1:
|
||||
address_line = address_line + "\n" + "Phone: " + cstr(self.doc.phone_1)
|
||||
if self.doc.email_id:
|
||||
address_line = address_line + "\n" + "E-mail: " + cstr(self.doc.email_id)
|
||||
set(self.doc,'address', address_line)
|
||||
|
||||
telephone = "(O): " + cstr(self.doc.phone_1) +"\n"+ cstr(self.doc.phone_2) + "\n" + "(M): " + "\n" + "(fax): " + cstr(self.doc.fax_1)
|
||||
set(self.doc,'telephone',telephone)
|
||||
|
||||
|
||||
# ------------------------------------
|
||||
# create primary contact for customer
|
||||
# ------------------------------------
|
||||
def create_p_contact(self,nm,phn_no,email_id,mob_no,fax,cont_addr):
|
||||
c1 = Document('Contact')
|
||||
c1.first_name = nm
|
||||
c1.contact_name = nm
|
||||
c1.contact_no = phn_no
|
||||
c1.email_id = email_id
|
||||
c1.mobile_no = mob_no
|
||||
c1.fax = fax
|
||||
c1.contact_address = cont_addr
|
||||
c1.is_primary_contact = 'Yes'
|
||||
c1.is_customer =1
|
||||
c1.customer = self.doc.name
|
||||
c1.customer_name = self.doc.customer_name
|
||||
c1.customer_address = self.doc.address
|
||||
c1.customer_group = self.doc.customer_group
|
||||
c1.save(1)
|
||||
|
||||
|
||||
# ------------------------
|
||||
# create customer contact
|
||||
# ------------------------
|
||||
def create_customer_contact(self):
|
||||
contact = sql("select distinct name from `tabContact` where customer_name=%s", (self.doc.customer_name))
|
||||
contact = contact and contact[0][0] or ''
|
||||
if not contact:
|
||||
# create primary contact for individual customer
|
||||
if self.doc.customer_type == 'Individual':
|
||||
self.create_p_contact(self.doc.customer_name,self.doc.phone_1,self.doc.email_id,'',self.doc.fax_1,self.doc.address)
|
||||
|
||||
# create primary contact for lead
|
||||
elif self.doc.lead_name:
|
||||
c_detail = sql("select lead_name, company_name, contact_no, mobile_no, email_id, fax, address from `tabLead` where name =%s", self.doc.lead_name, as_dict=1)
|
||||
self.create_p_contact(c_detail and c_detail[0]['lead_name'] or '', c_detail and c_detail[0]['contact_no'] or '', c_detail and c_detail[0]['email_id'] or '', c_detail and c_detail[0]['mobile_no'] or '', c_detail and c_detail[0]['fax'] or '', c_detail and c_detail[0]['address'] or '')
|
||||
|
||||
|
||||
# -------------------
|
||||
# update lead status
|
||||
# -------------------
|
||||
def update_lead_status(self):
|
||||
if self.doc.lead_name:
|
||||
sql("update `tabLead` set status='Converted' where name = %s", self.doc.lead_name)
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# create accont head - in tree under receivables_group of selected company
|
||||
# -------------------------------------------------------------------------
|
||||
def create_account_head(self):
|
||||
if self.doc.company :
|
||||
abbr = self.get_company_abbr()
|
||||
if not sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
|
||||
parent_account = self.get_receivables_group()
|
||||
arg = {'account_name':self.doc.name,'parent_account': parent_account, 'group_or_ledger':'Ledger', 'company':self.doc.company,'account_type':'','tax_rate':'0','master_type':'Customer','master_name':self.doc.name,'address':self.doc.address}
|
||||
# create
|
||||
ac = get_obj('GL Control').add_ac(cstr(arg))
|
||||
msgprint("Account Head created for "+ac)
|
||||
else :
|
||||
msgprint("Please Select Company under which you want to create account head")
|
||||
|
||||
|
||||
# ----------------------------------------
|
||||
# update credit days and limit in account
|
||||
# ----------------------------------------
|
||||
def update_credit_days_limit(self):
|
||||
sql("update tabAccount set credit_days = '%s', credit_limit = '%s' where name = '%s'" % (self.doc.credit_days, self.doc.credit_limit, self.doc.name + " - " + self.get_company_abbr()))
|
||||
|
||||
|
||||
#create address and contact from lead
|
||||
def create_lead_address_contact(self):
|
||||
if self.doc.lead_name:
|
||||
details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, contact_no, mobile_no, fax, email_id from `tabLead` where name = '%s'" %(self.doc.lead_name), as_dict = 1)
|
||||
d = Document('Address')
|
||||
d.address_line1 = details[0]['address_line1']
|
||||
d.address_line2 = details[0]['address_line2']
|
||||
d.city = details[0]['city']
|
||||
d.country = details[0]['country']
|
||||
d.pincode = details[0]['pincode']
|
||||
d.state = details[0]['state']
|
||||
d.fax = details[0]['fax']
|
||||
d.email_id = details[0]['email_id']
|
||||
d.phone = details[0]['contact_no']
|
||||
d.customer = self.doc.name
|
||||
d.customer_name = self.doc.customer_name
|
||||
d.is_primary_address = 1
|
||||
d.address_type = 'Office'
|
||||
try:
|
||||
d.save(1)
|
||||
except NameError, e:
|
||||
pass
|
||||
|
||||
c = Document('Contact')
|
||||
c.first_name = details[0]['lead_name']
|
||||
c.email_id = details[0]['email_id']
|
||||
c.phone = details[0]['contact_no']
|
||||
c.phone = details[0]['contact_no']
|
||||
c.customer = self.doc.name
|
||||
c.customer_name = self.doc.customer_name
|
||||
c.is_primary_contact = 1
|
||||
try:
|
||||
c.save(1)
|
||||
except NameError, e:
|
||||
pass
|
||||
|
||||
# ----------
|
||||
# on update
|
||||
# ----------
|
||||
def on_update(self):
|
||||
# create customer addr
|
||||
#self.create_customer_address()
|
||||
# create customer contact
|
||||
#self.create_customer_contact()
|
||||
# update lead status
|
||||
self.update_lead_status()
|
||||
# create account head
|
||||
self.create_account_head()
|
||||
# update credit days and limit in account
|
||||
self.update_credit_days_limit()
|
||||
#create address and contact from lead
|
||||
self.create_lead_address_contact()
|
||||
|
||||
def delete_customer_address(self):
|
||||
for rec in sql("select * from `tabAddress` where customer='%s'" %(self.doc.name), as_dict=1):
|
||||
sql("delete from `tabAddress` where name=%s",(rec['name']))
|
||||
|
||||
def delete_customer_contact(self):
|
||||
for rec in sql("select * from `tabContact` where customer='%s'" %(self.doc.name), as_dict=1):
|
||||
sql("delete from `tabContact` where name=%s",(rec['name']))
|
||||
|
||||
# ******************************************************* on trash *********************************************************
|
||||
def on_trash(self):
|
||||
self.delete_customer_address()
|
||||
self.delete_customer_contact()
|
||||
if self.doc.lead_name:
|
||||
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
|
||||
485
selling/doctype/customer/customer.txt
Normal file
485
selling/doctype/customer/customer.txt
Normal file
@@ -0,0 +1,485 @@
|
||||
# DocType, Customer
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:08:56',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-05-26 17:31:31',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1306834669',
|
||||
'allow_print': 0,
|
||||
'allow_trash': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Selling',
|
||||
'name': '__common__',
|
||||
'search_fields': 'customer_name,customer_group,country,territory',
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': "eval:'%(customer_name)s'=='%(name)s' ? ' ' : '%(customer_name)s'",
|
||||
'tag_fields': 'customer_group,customer_type',
|
||||
'version': 431
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Customer',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Customer',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'submit': 0
|
||||
},
|
||||
|
||||
# DocType, Customer
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Customer'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Manager',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Manager',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales User',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales User',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 0,
|
||||
'role': 'Sales Master Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 1,
|
||||
'role': 'Sales Master Manager',
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Basic Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 2,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer Name',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'customer_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'label': 'Customer Type',
|
||||
'oldfieldname': 'customer_type',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nCompany\nIndividual',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 4,
|
||||
'label': 'Series',
|
||||
'no_copy': 1,
|
||||
'options': '\nCUST\nCUSTMUM',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Fetch lead which will be converted into customer.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'lead_name',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 5,
|
||||
'in_filter': 1,
|
||||
'label': 'Lead Ref',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'lead_name',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Lead',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 6,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': '<a href="javascript:cur_frm.cscript.CGHelp();">To manage Customer Groups, click here</a>',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_group',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 7,
|
||||
'in_filter': 1,
|
||||
'label': 'Customer Group',
|
||||
'oldfieldname': 'customer_group',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Customer Group',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': '<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'territory',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 8,
|
||||
'label': 'Territory',
|
||||
'oldfieldname': 'territory',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Territory',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 9,
|
||||
'label': 'Address & Contacts',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 10,
|
||||
'label': 'Address Desc',
|
||||
'options': '<em>Addresses will appear only when you save the customer</em>',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 11,
|
||||
'label': 'Address HTML',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 12,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 13,
|
||||
'label': 'Contact Desc',
|
||||
'options': '<em>Contact Details will appear only when you save the customer</em>',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 14,
|
||||
'label': 'Contact HTML',
|
||||
'oldfieldtype': 'HTML',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 15,
|
||||
'label': 'More Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'To create an Account Head under a different company, then set the company and click the button below.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 16,
|
||||
'in_filter': 1,
|
||||
'label': 'Company',
|
||||
'oldfieldname': 'company',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Company',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': "Your Customer's TAX registration numbers (if applicable) or any general information",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'customer_details',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 17,
|
||||
'label': 'Customer Details',
|
||||
'oldfieldname': 'customer_details',
|
||||
'oldfieldtype': 'Code',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 18,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'credit_days',
|
||||
'fieldtype': 'Int',
|
||||
'idx': 19,
|
||||
'label': 'Credit Days',
|
||||
'oldfieldname': 'credit_days',
|
||||
'oldfieldtype': 'Int',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'credit_limit',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 20,
|
||||
'label': 'Credit Limit',
|
||||
'oldfieldname': 'credit_limit',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'website',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 21,
|
||||
'label': 'Website',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 22,
|
||||
'label': 'Sales Team',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'default_sales_partner',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 23,
|
||||
'label': 'Default Sales Partner',
|
||||
'oldfieldname': 'default_sales_partner',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Sales Partner',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'default_commission_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 24,
|
||||
'label': 'Default Commission Rate',
|
||||
'oldfieldname': 'default_commission_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_team',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 25,
|
||||
'label': 'Sales Team Details',
|
||||
'oldfieldname': 'sales_team',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Sales Team',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 26,
|
||||
'label': 'Transaction History',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 27,
|
||||
'label': 'History HTML',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 28,
|
||||
'label': 'Trash Reason',
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user