lead organization fld added in quotation for printing

This commit is contained in:
Nabin Hait 2012-03-20 16:44:15 +05:30
parent 93654a3e04
commit 9ff92369ad
4 changed files with 24 additions and 37 deletions

View File

@ -41,7 +41,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(doc.quotation_to) {
if(doc.quotation_to == 'Customer') {
hide_field(['lead', 'lead_name']);
hide_field(['lead', 'lead_name', 'organization']);
}
else if (doc.quotation_to == 'Lead') {
hide_field(['customer','customer_address','contact_person', 'customer_name','contact_display', 'customer_group']);
@ -60,16 +60,11 @@ cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
// hide - unhide fields based on lead or customer..
// =======================================================================================================================
cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){
if(doc.quotation_to == 'Lead'){
unhide_field(['lead']);
hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
}
else if(doc.quotation_to == 'Customer'){
unhide_field(['customer']);
hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = "";
}
hide_field(['lead', 'lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group', 'organization']);
if(doc.quotation_to == 'Lead') unhide_field(['lead']);
else if(doc.quotation_to == 'Customer') unhide_field(['customer']);
doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = doc.organization = "";
}
@ -140,7 +135,7 @@ cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
cur_frm.cscript.lead = function(doc, cdt, cdn) {
if(doc.lead) get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1);
if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);
if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory', 'organization']);
}

View File

@ -116,26 +116,8 @@ class DocType(TransactionBase):
# Pull details from other charges master (Get Other Charges)
# ----------------------------------------------------------
def get_other_charges(self):
return get_obj('Sales Common').get_other_charges(self)
return get_obj('Sales Common').get_other_charges(self)
# Get Lead Details along with its details
# ==============================================================
def get_lead_details1(self, name):
details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1)
ret = {
'lead_name' : details and details[0]['lead_name'] or '',
'address_display' : (details and details[0]['address_line1']
+ (details[0]['address_line2'] and '\n' + details[0]['address_line2'] or '') + '\n'
+ details[0]['city']
+ (details[0]['pincode'] and ', ' + details[0]['pincode'] or '') + '\n'
+ (details[0]['state'] and details[0]['state']+', ' or '')
+ details[0]['country'] + '\nTel: ' + details[0]['contact_no'] + '\n' or '-'),
'territory' : details and details[0]['territory'] or '',
'contact_mobile' : details and details[0]['mobile_no'] or '-',
'contact_email' : details and details[0]['email_id'] or '-'
}
return ret
# GET TERMS AND CONDITIONS
# ====================================================================================

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:17',
'docstatus': 0,
'modified': '2012-03-02 12:20:40',
'modified': '2012-03-20 14:56:28',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -21,7 +21,7 @@
# These values are common for all DocType
{
'_last_update': u'1330069750',
'_last_update': u'1332235370',
'allow_attach': 1,
'allow_email': 0,
'allow_trash': 1,
@ -41,7 +41,7 @@
'show_in_menu': 0,
'subject': u'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
'tag_fields': u'status',
'version': 618
'version': 621
},
# These values are common for all DocFormat
@ -292,6 +292,15 @@
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'organization',
'fieldtype': u'Data',
'label': u'Organization',
'permlevel': 1
},
# DocField
{
'colour': u'White:FFF',
@ -385,7 +394,7 @@
'oldfieldtype': u'Select',
'options': u'\nSales\nMaintenance',
'permlevel': 0,
'print_hide': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 0
},

View File

@ -145,7 +145,7 @@ class TransactionBase:
# Get Lead Details
# -----------------------
def get_lead_details(self, name):
details = webnotes.conn.sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1)
details = webnotes.conn.sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id, company_name from `tabLead` where name = '%s'" %(name), as_dict = 1)
extract = lambda x: details and details[0] and details[0].get(x,'') or ''
address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','contact_no')]
@ -157,7 +157,8 @@ class TransactionBase:
'address_display' : address_display,
'territory' : extract('territory'),
'contact_mobile' : extract('mobile_no'),
'contact_email' : extract('email_id')
'contact_email' : extract('email_id'),
'organization' : extract('company_name')
}
return ret