mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 00:44:45 +00:00
moved directory structure
This commit is contained in:
1
selling/doctype/customer/__init__.py
Normal file
1
selling/doctype/customer/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
||||
209
selling/doctype/customer/customer.js
Normal file
209
selling/doctype/customer/customer.js
Normal file
@@ -0,0 +1,209 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wn.require('erpnext/setup/doctype/contact_control/contact_control.js');
|
||||
wn.require('erpnext/support/doctype/communication/communication.js');
|
||||
|
||||
/* ********************************* 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.cscript.load_defaults(doc, dt, dn);
|
||||
|
||||
cur_frm.cscript.make_communication_body();
|
||||
}
|
||||
|
||||
cur_frm.cscript.load_defaults = function(doc, dt, dn) {
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
if(!(doc.__islocal && doc.lead_name)) { return; }
|
||||
|
||||
var fields_to_refresh = LocalDB.set_default_values(doc);
|
||||
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
||||
}
|
||||
|
||||
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.render_communication_list(doc, cdt, cdn);
|
||||
//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.ui.Listing({
|
||||
parent: cur_frm.fields_dict['address_html'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Address",
|
||||
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: cur_frm.cscript.render_address_row,
|
||||
});
|
||||
// note: render_address_row is defined in contact_control.js
|
||||
}
|
||||
cur_frm.address_list.run();
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_contact = function() {
|
||||
if(!cur_frm.contact_list) {
|
||||
cur_frm.contact_list = new wn.ui.Listing({
|
||||
parent: cur_frm.fields_dict['contact_html'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Contact",
|
||||
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: cur_frm.cscript.render_contact_row,
|
||||
});
|
||||
// note: render_contact_row is defined in contact_control.js
|
||||
}
|
||||
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';
|
||||
}
|
||||
|
||||
|
||||
// -----
|
||||
// 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
|
||||
// functions called by these functions are defined in communication.js
|
||||
cur_frm.cscript.make_qtn_list = function(parent, doc) {
|
||||
cur_frm.cscript.get_common_list_view(parent, doc, 'Quotation');
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_so_list = function(parent, doc) {
|
||||
cur_frm.cscript.get_common_list_view(parent, doc, 'Sales Order');
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_dn_list = function(parent, doc) {
|
||||
cur_frm.cscript.get_common_list_view(parent, doc, 'Delivery Note');
|
||||
}
|
||||
|
||||
cur_frm.cscript.get_common_list_view = function(parent, doc, doctype) {
|
||||
var ListView = wn.views.ListView.extend({
|
||||
init: function(doclistview) {
|
||||
this._super(doclistview);
|
||||
this.fields = this.fields.concat([
|
||||
"`tab" + doctype + "`.status",
|
||||
"`tab" + doctype + "`.currency",
|
||||
"ifnull(`tab" + doctype + "`.grand_total_export, 0) as grand_total_export",
|
||||
|
||||
]);
|
||||
},
|
||||
|
||||
prepare_data: function(data) {
|
||||
this._super(data);
|
||||
data.grand_total_export = data.currency + " " + fmt_money(data.grand_total_export)
|
||||
},
|
||||
|
||||
columns: [
|
||||
{width: '3%', content: 'docstatus'},
|
||||
{width: '25%', content: 'name'},
|
||||
{width: '25%', content: 'status'},
|
||||
{width: '35%', content: 'grand_total_export', css: {'text-align': 'right'}},
|
||||
{width: '12%', content:'modified', css: {'text-align': 'right'}}
|
||||
],
|
||||
});
|
||||
|
||||
cur_frm.cscript.render_list(doc, doctype, parent, ListView);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.make_si_list = function(parent, doc) {
|
||||
var ListView = wn.views.ListView.extend({
|
||||
init: function(doclistview) {
|
||||
this._super(doclistview);
|
||||
this.fields = this.fields.concat([
|
||||
"ifnull(`tabSales Invoice`.outstanding_amount, 0) as outstanding_amount",
|
||||
"`tabSales Invoice`.currency",
|
||||
"ifnull(`tabSales Invoice`.conversion_rate, 0) as conversion_rate",
|
||||
"ifnull(`tabSales Invoice`.grand_total_export, 0) as grand_total_export",
|
||||
|
||||
]);
|
||||
},
|
||||
|
||||
prepare_data: function(data) {
|
||||
this._super(data);
|
||||
if (data.outstanding_amount) {
|
||||
data.outstanding_amount = data.currency + " " +
|
||||
fmt_money(flt(data.outstanding_amount)/flt(data.conversion_rate)) +
|
||||
" [outstanding]";
|
||||
|
||||
} else {
|
||||
data.outstanding_amount = '';
|
||||
}
|
||||
data.grand_total_export = data.currency + " " + fmt_money(data.grand_total_export);
|
||||
},
|
||||
|
||||
columns: [
|
||||
{width: '3%', content: 'docstatus'},
|
||||
{width: '25%', content: 'name'},
|
||||
{width: '25%', content: 'outstanding_amount',
|
||||
css: {'text-align': 'right', 'color': '#777'}},
|
||||
{width: '35%', content: 'grand_total_export', css: {'text-align': 'right'}},
|
||||
{width: '12%', content:'modified', css: {'text-align': 'right'}}
|
||||
],
|
||||
});
|
||||
|
||||
cur_frm.cscript.render_list(doc, 'Sales Invoice', parent, ListView);
|
||||
}
|
||||
288
selling/doctype/customer/customer.py
Normal file
288
selling/doctype/customer/customer.py
Normal file
@@ -0,0 +1,288 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Please edit this list and import only required elements
|
||||
from __future__ import unicode_literals
|
||||
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("You already have a Supplier with same name")
|
||||
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, phone, 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]['phone']
|
||||
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]['phone']
|
||||
c.mobile_no = details[0]['mobile_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']))
|
||||
|
||||
def delete_customer_communication(self):
|
||||
webnotes.conn.sql("""\
|
||||
delete from `tabCommunication`
|
||||
where customer = %s and supplier is null""", self.doc.name)
|
||||
|
||||
def delete_customer_account(self):
|
||||
"""delete customer's ledger if exist and check balance before deletion"""
|
||||
acc = sql("select name from `tabAccount` where master_type = 'Customer' \
|
||||
and master_name = %s and docstatus < 2", self.doc.name)
|
||||
if acc:
|
||||
from webnotes.model import delete_doc
|
||||
delete_doc('Account', acc[0][0])
|
||||
|
||||
def on_trash(self):
|
||||
self.delete_customer_address()
|
||||
self.delete_customer_contact()
|
||||
self.delete_customer_communication()
|
||||
self.delete_customer_account()
|
||||
if self.doc.lead_name:
|
||||
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
|
||||
|
||||
# on rename
|
||||
# ---------
|
||||
def on_rename(self,newdn,olddn):
|
||||
#update customer_name if not naming series
|
||||
if get_defaults().get('cust_master_name') == 'Customer Name':
|
||||
update_fields = [
|
||||
('Customer', 'name'),
|
||||
('Address', 'customer'),
|
||||
('Contact', 'customer'),
|
||||
('Customer Issue', 'customer'),
|
||||
('Delivery Note', 'customer'),
|
||||
('Opportunity', 'customer'),
|
||||
('Installation Note', 'customer'),
|
||||
('Maintenance Schedule', 'customer'),
|
||||
('Maintenance Visit', 'customer'),
|
||||
('Project', 'customer'),
|
||||
('Quotation', 'customer'),
|
||||
('Sales Invoice', 'customer'),
|
||||
('Sales Order', 'customer'),
|
||||
('Serial No', 'customer'),
|
||||
('Shipping Address', 'customer'),
|
||||
('Stock Entry', 'customer'),
|
||||
('Support Ticket', 'customer'),
|
||||
('Task', 'customer')]
|
||||
for rec in update_fields:
|
||||
sql("update `tab%s` set customer_name = '%s' where %s = '%s'" %(rec[0],newdn,rec[1],olddn))
|
||||
|
||||
#update master_name in doctype account
|
||||
sql("update `tabAccount` set master_name = '%s', master_type = 'Customer' where master_name = '%s'" %(newdn,olddn))
|
||||
534
selling/doctype/customer/customer.txt
Normal file
534
selling/doctype/customer/customer.txt
Normal file
@@ -0,0 +1,534 @@
|
||||
# DocType, Customer
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
u'creation': '2012-07-18 20:34:41',
|
||||
u'docstatus': 0,
|
||||
u'modified': '2012-09-17 11:31:55',
|
||||
u'modified_by': u'Administrator',
|
||||
u'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': u'1330501485',
|
||||
'allow_print': 0,
|
||||
'allow_trash': 1,
|
||||
'colour': u'White:FFF',
|
||||
'default_print_format': u'Standard',
|
||||
u'doctype': u'DocType',
|
||||
'document_type': u'Master',
|
||||
'module': u'Selling',
|
||||
u'name': u'__common__',
|
||||
'search_fields': u'customer_name,customer_group,country,territory',
|
||||
'section_style': u'Tabbed',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': u'eval:"%(customer_name)s"=="%(name)s" ? "" : "%(customer_name)s"',
|
||||
'tag_fields': u'customer_group,customer_type',
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
u'name': u'__common__',
|
||||
'parent': u'Customer',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
u'doctype': u'DocPerm',
|
||||
u'name': u'__common__',
|
||||
'parent': u'Customer',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Customer
|
||||
{
|
||||
u'doctype': u'DocType',
|
||||
u'name': u'Customer'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'basic_info',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Basic Info',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0,
|
||||
'reqd': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'customer_name',
|
||||
'fieldtype': u'Data',
|
||||
'hidden': 0,
|
||||
'in_filter': 1,
|
||||
'label': u'Customer Name',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': u'customer_name',
|
||||
'oldfieldtype': u'Data',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'customer_type',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Customer Type',
|
||||
'oldfieldname': u'customer_type',
|
||||
'oldfieldtype': u'Select',
|
||||
'options': u'\nCompany\nIndividual',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'naming_series',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Series',
|
||||
'no_copy': 1,
|
||||
'options': u'\nCUST\nCUSTMUM',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Fetch lead which will be converted into customer.',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'lead_name',
|
||||
'fieldtype': u'Link',
|
||||
'hidden': 0,
|
||||
'in_filter': 1,
|
||||
'label': u'Lead Ref',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': u'lead_name',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Lead',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'column_break0',
|
||||
'fieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'<a href="#!Sales Browser/Customer Group">To manage Customer Groups, click here</a>',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'customer_group',
|
||||
'fieldtype': u'Link',
|
||||
'hidden': 0,
|
||||
'in_filter': 1,
|
||||
'label': u'Customer Group',
|
||||
'oldfieldname': u'customer_group',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Customer Group',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'<a href="#!Sales Browser/Territory">To manage Territory, click here</a>',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'territory',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Territory',
|
||||
'oldfieldname': u'territory',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Territory',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'trigger': u'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'address_contacts',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Address & Contacts',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'depends_on': u'eval:doc.__islocal',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'address_desc',
|
||||
'fieldtype': u'HTML',
|
||||
'label': u'Address Desc',
|
||||
'options': u'<em>Addresses will appear only when you save the customer</em>',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'address_html',
|
||||
'fieldtype': u'HTML',
|
||||
'label': u'Address HTML',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'column_break1',
|
||||
'fieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'depends_on': u'eval:doc.__islocal',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'contact_desc',
|
||||
'fieldtype': u'HTML',
|
||||
'label': u'Contact Desc',
|
||||
'options': u'<em>Contact Details will appear only when you save the customer</em>',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'contact_html',
|
||||
'fieldtype': u'HTML',
|
||||
'label': u'Contact HTML',
|
||||
'oldfieldtype': u'HTML',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'communication_history',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Communication History',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'communication_html',
|
||||
'fieldtype': u'HTML',
|
||||
'label': u'Communication HTML',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'more_info',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'More Info',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'column_break2',
|
||||
'fieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'To create an Account Head under a different company, select the company and save customer.',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'company',
|
||||
'fieldtype': u'Link',
|
||||
'in_filter': 1,
|
||||
'label': u'Company',
|
||||
'oldfieldname': u'company',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Company',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'default_price_list',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Default Price List',
|
||||
'options': u'Price List',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u'This currency will get fetched in Sales transactions of this customer',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'default_currency',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Default Currency',
|
||||
'no_copy': 1,
|
||||
'options': u'link:Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'description': u"Your Customer's TAX registration numbers (if applicable) or any general information",
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'customer_details',
|
||||
'fieldtype': u'Text',
|
||||
'label': u'Customer Details',
|
||||
'oldfieldname': u'customer_details',
|
||||
'oldfieldtype': u'Code',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'column_break3',
|
||||
'fieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': u'50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'credit_days',
|
||||
'fieldtype': u'Int',
|
||||
'label': u'Credit Days',
|
||||
'oldfieldname': u'credit_days',
|
||||
'oldfieldtype': u'Int',
|
||||
'permlevel': 2
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'credit_limit',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Credit Limit',
|
||||
'oldfieldname': u'credit_limit',
|
||||
'oldfieldtype': u'Currency',
|
||||
'permlevel': 2
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'website',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Website',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'sales_team_section_break',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Sales Team',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'default_sales_partner',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Default Sales Partner',
|
||||
'oldfieldname': u'default_sales_partner',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Sales Partner',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'default_commission_rate',
|
||||
'fieldtype': u'Currency',
|
||||
'label': u'Default Commission Rate',
|
||||
'oldfieldname': u'default_commission_rate',
|
||||
'oldfieldtype': u'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'sales_team',
|
||||
'fieldtype': u'Table',
|
||||
'label': u'Sales Team Details',
|
||||
'oldfieldname': u'sales_team',
|
||||
'oldfieldtype': u'Table',
|
||||
'options': u'Sales Team',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'depends_on': u'eval:!doc.__islocal',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'transaction_history',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Transaction History',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'depends_on': u'eval:!doc.__islocal',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'history_html',
|
||||
'fieldtype': u'HTML',
|
||||
'label': u'History HTML',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
u'doctype': u'DocField',
|
||||
'fieldname': u'trash_reason',
|
||||
'fieldtype': u'Small Text',
|
||||
'label': u'Trash Reason',
|
||||
'oldfieldname': u'trash_reason',
|
||||
'oldfieldtype': u'Small Text',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
u'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales Master Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
u'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Accounts Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
u'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
u'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Sales User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
u'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'All',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
u'doctype': u'DocPerm',
|
||||
'permlevel': 2,
|
||||
'role': u'Accounts Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
u'doctype': u'DocPerm',
|
||||
'permlevel': 2,
|
||||
'role': u'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
u'doctype': u'DocPerm',
|
||||
'permlevel': 2,
|
||||
'role': u'All'
|
||||
}
|
||||
]
|
||||
28
selling/doctype/customer/customer_list.js
Normal file
28
selling/doctype/customer/customer_list.js
Normal file
@@ -0,0 +1,28 @@
|
||||
// render
|
||||
wn.doclistviews['Customer'] = wn.views.ListView.extend({
|
||||
init: function(d) {
|
||||
this._super(d)
|
||||
this.fields = this.fields.concat([
|
||||
"`tabCustomer`.customer_name",
|
||||
"`tabCustomer`.territory",
|
||||
]);
|
||||
this.show_hide_check_column();
|
||||
},
|
||||
|
||||
prepare_data: function(data) {
|
||||
this._super(data);
|
||||
data.customer_name = repl("<a href=\"#!Form/Customer/%(name)s\">%(customer_name)s</a>",
|
||||
data);
|
||||
},
|
||||
|
||||
columns: [
|
||||
{width: '3%', content:'check'},
|
||||
{width: '5%', content:'avatar'},
|
||||
{width: '50%', content:'customer_name'},
|
||||
{width: '10%', content:'tags'},
|
||||
{width: '20%', content:'territory',
|
||||
css: {'color': '#aaa'}},
|
||||
{width: '12%', content:'modified',
|
||||
css: {'text-align': 'right', 'color':'#777'}}
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user