From 9ff92369ade985e13051427a9643fbff8abbbc21 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Mar 2012 16:44:15 +0530 Subject: [PATCH] lead organization fld added in quotation for printing --- .../selling/doctype/quotation/quotation.js | 19 +++++++----------- .../selling/doctype/quotation/quotation.py | 20 +------------------ .../selling/doctype/quotation/quotation.txt | 17 ++++++++++++---- erpnext/utilities/transaction_base.py | 5 +++-- 4 files changed, 24 insertions(+), 37 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 7f40782d0c..910f54e06f 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -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']); } diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index de4056d2d6..27206b2d49 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -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 # ==================================================================================== diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt index 32784a8dcb..c8e3ecb37f 100644 --- a/erpnext/selling/doctype/quotation/quotation.txt +++ b/erpnext/selling/doctype/quotation/quotation.txt @@ -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 }, diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index b78bed1c0c..ee23c75fc9 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -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