From be5e5059c398959153ed61f28525dc89ead4d6db Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 8 Jun 2012 16:15:08 +0530 Subject: [PATCH 1/4] Lead Organization field added in quotation --- .../selling/doctype/quotation/quotation.js | 6 ++-- .../selling/doctype/quotation/quotation.txt | 33 ++++++++----------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index e89ad15de2..e444a668f5 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -43,7 +43,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']); @@ -64,11 +64,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){ - hide_field(['lead', 'lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','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_name = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = ""; + doc.lead = doc.lead_name = doc.customer = doc.customer_name = 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 = ""; } diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt index e5f8e752dd..1b34c51ebc 100644 --- a/erpnext/selling/doctype/quotation/quotation.txt +++ b/erpnext/selling/doctype/quotation/quotation.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-21 11:43:59', + 'creation': '2012-06-08 15:33:49', 'docstatus': 0, - 'modified': '2012-05-31 11:43:18', + 'modified': '2012-06-08 16:10:44', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -51,7 +51,8 @@ 'name': '__common__', 'parent': u'Quotation', 'parentfield': u'permissions', - 'parenttype': u'DocType' + 'parenttype': u'DocType', + 'read': 1 }, # DocType, Quotation @@ -60,13 +61,6 @@ 'name': u'Quotation' }, - # DocPerm - { - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'user print' - }, - # DocPerm { 'amend': 0, @@ -74,7 +68,6 @@ 'create': 0, 'doctype': u'DocPerm', 'permlevel': 1, - 'read': 1, 'role': u'Sales Manager', 'submit': 0, 'write': 0 @@ -87,7 +80,6 @@ 'create': 1, 'doctype': u'DocPerm', 'permlevel': 0, - 'read': 1, 'role': u'Sales Manager', 'submit': 1, 'write': 1 @@ -100,7 +92,6 @@ 'create': 1, 'doctype': u'DocPerm', 'permlevel': 0, - 'read': 1, 'role': u'Sales User', 'submit': 1, 'write': 1 @@ -113,7 +104,6 @@ 'create': 0, 'doctype': u'DocPerm', 'permlevel': 1, - 'read': 1, 'role': u'Sales User', 'submit': 0, 'write': 0 @@ -124,7 +114,6 @@ 'doctype': u'DocPerm', 'match': u'customer_name', 'permlevel': 0, - 'read': 1, 'role': u'Customer' }, @@ -135,7 +124,6 @@ 'create': 1, 'doctype': u'DocPerm', 'permlevel': 0, - 'read': 1, 'role': u'Maintenance Manager', 'submit': 1, 'write': 1 @@ -145,7 +133,6 @@ { 'doctype': u'DocPerm', 'permlevel': 1, - 'read': 1, 'role': u'Maintenance Manager' }, @@ -156,7 +143,6 @@ 'create': 1, 'doctype': u'DocPerm', 'permlevel': 0, - 'read': 1, 'role': u'Maintenance User', 'submit': 1, 'write': 1 @@ -166,7 +152,6 @@ { 'doctype': u'DocPerm', 'permlevel': 1, - 'read': 1, 'role': u'Maintenance User' }, @@ -284,6 +269,16 @@ 'permlevel': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'organization', + 'fieldtype': u'Data', + 'hidden': 1, + 'label': u'Organization', + 'permlevel': 1 + }, + # DocField { 'colour': u'White:FFF', From 7357fc18173d80b1c6172df4da89ca0696a2d7a9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 8 Jun 2012 18:02:38 +0530 Subject: [PATCH 2/4] fetch organization from lead to quote --- erpnext/patches/june_2012/fetch_organization_from_lead.py | 3 +++ erpnext/patches/patch_list.py | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 erpnext/patches/june_2012/fetch_organization_from_lead.py diff --git a/erpnext/patches/june_2012/fetch_organization_from_lead.py b/erpnext/patches/june_2012/fetch_organization_from_lead.py new file mode 100644 index 0000000000..d40099731d --- /dev/null +++ b/erpnext/patches/june_2012/fetch_organization_from_lead.py @@ -0,0 +1,3 @@ +def execute(): + import webnotes + webnotes.conn.sql("update `tabQuotation` t1, `tabLead` t2 set t1.organization = t2.company where ifnull(t1.lead, '') = '' and t1.quotation_to = 'Lead' and ifnull(t1.organization, '') = '' and t1.lead = t2.name") \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 96bf161197..7404b55889 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -422,4 +422,9 @@ patch_list = [ 'patch_file': 'copy_uom_for_pur_inv_item', 'description': 'Copy uom for pur inv item from PO and PR item table' }, + { + 'patch_module': 'patches.june_2012', + 'patch_file': 'fetch_organization_from_lead', + 'description': 'Fetch organization from lead in quote' + }, ] \ No newline at end of file From f74b023106ebb10ea34a365961570bef66e57c8c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 8 Jun 2012 18:14:38 +0530 Subject: [PATCH 3/4] fetch organization from lead to quote --- erpnext/patches/june_2012/fetch_organization_from_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/june_2012/fetch_organization_from_lead.py b/erpnext/patches/june_2012/fetch_organization_from_lead.py index d40099731d..fe178dd746 100644 --- a/erpnext/patches/june_2012/fetch_organization_from_lead.py +++ b/erpnext/patches/june_2012/fetch_organization_from_lead.py @@ -1,3 +1,3 @@ def execute(): import webnotes - webnotes.conn.sql("update `tabQuotation` t1, `tabLead` t2 set t1.organization = t2.company where ifnull(t1.lead, '') = '' and t1.quotation_to = 'Lead' and ifnull(t1.organization, '') = '' and t1.lead = t2.name") \ No newline at end of file + webnotes.conn.sql("update `tabQuotation` t1, `tabLead` t2 set t1.organization = t2.company_name where ifnull(t1.lead, '') = '' and t1.quotation_to = 'Lead' and ifnull(t1.organization, '') = '' and t1.lead = t2.name") \ No newline at end of file From 6581ef944988ba1cd42d62926ae086918cd37dcb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 8 Jun 2012 18:19:32 +0530 Subject: [PATCH 4/4] fetch organization from lead to quote --- erpnext/patches/june_2012/fetch_organization_from_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/june_2012/fetch_organization_from_lead.py b/erpnext/patches/june_2012/fetch_organization_from_lead.py index fe178dd746..1d2485289a 100644 --- a/erpnext/patches/june_2012/fetch_organization_from_lead.py +++ b/erpnext/patches/june_2012/fetch_organization_from_lead.py @@ -1,3 +1,3 @@ def execute(): import webnotes - webnotes.conn.sql("update `tabQuotation` t1, `tabLead` t2 set t1.organization = t2.company_name where ifnull(t1.lead, '') = '' and t1.quotation_to = 'Lead' and ifnull(t1.organization, '') = '' and t1.lead = t2.name") \ No newline at end of file + webnotes.conn.sql("update `tabQuotation` t1, `tabLead` t2 set t1.organization = t2.company_name where ifnull(t1.lead, '') != '' and t1.quotation_to = 'Lead' and ifnull(t1.organization, '') = '' and t1.lead = t2.name") \ No newline at end of file