From 57d7c815d26c93d31adc3925564c17aa09c22b47 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 1 May 2012 12:35:12 +0530 Subject: [PATCH] field arrangement in sales cycle --- .../doctype/sales_invoice/sales_invoice.js | 12 +- .../doctype/sales_invoice/sales_invoice.txt | 488 ++++++++++-------- .../selling/doctype/quotation/quotation.js | 3 + .../doctype/sales_order/sales_order.js | 3 + .../doctype/delivery_note/delivery_note.js | 3 + .../doctype/delivery_note/delivery_note.txt | 3 +- 6 files changed, 297 insertions(+), 215 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index cddb92e90b..9aaf620b94 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -38,7 +38,6 @@ cur_frm.cscript.onload = function(doc,dt,dn) { if(!doc.currency && sys_defaults.currency) set_multiple(dt,dn,{currency:sys_defaults.currency}); if(!doc.price_list_currency) set_multiple(dt, dn, {price_list_currency: doc.currency, plc_conversion_rate: 1}); - hide_field(['customer_address', 'contact_person','customer_name','address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']); } } @@ -100,6 +99,9 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) { if (doc.docstatus==1) $(cur_frm.fields_dict.recurring_invoice.row.wrapper).toggle(true); else $(cur_frm.fields_dict.recurring_invoice.row.wrapper).toggle(false); + if(doc.customer) $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true); + else $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(false); + // India related fields var cp = wn.control_panel; if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']); @@ -113,6 +115,8 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) { cur_frm.cscript.refresh = function(doc, dt, dn) { cur_frm.cscript.is_opening(doc, dt, dn); cur_frm.cscript.hide_fields(doc, dt, dn); + erpnext.hide_naming_series(); + // Show / Hide button cur_frm.clear_custom_buttons(); @@ -188,7 +192,7 @@ cur_frm.cscript.customer = function(doc,dt,dn,onload) { var args = onload ? 'onload':'' if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', args, callback); - if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']); + if(doc.customer) unhide_field(['customer_address','contact_person', 'territory','customer_group']); } @@ -228,7 +232,7 @@ cur_frm.cscript.debit_to = function(doc,dt,dn) { var callback = function(r,rt) { var doc = locals[cur_frm.doctype][cur_frm.docname]; if(doc.customer) $c_obj(make_doclist(dt,dn), 'get_default_customer_address', '', callback2); - if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']); + if(doc.customer) unhide_field(['customer_address','contact_person','territory','customer_group']); cur_frm.refresh(); } @@ -298,7 +302,7 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) { // Get Items based on SO or DN Selected cur_frm.cscript.get_items = function(doc, dt, dn) { var callback = function(r,rt) { - unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']); + unhide_field(['customer_address','contact_person', 'territory','customer_group']); cur_frm.refresh(); } get_server_fields('pull_details','','',doc, dt, dn,1,callback); diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt index 6e76145291..a69dcbf2e0 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt @@ -5,7 +5,7 @@ { 'creation': '2012-04-13 11:56:18', 'docstatus': 0, - 'modified': '2012-04-20 11:52:36', + 'modified': '2012-05-01 12:15:53', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -197,50 +197,12 @@ 'trigger': u'Client' }, - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'customer', - 'fieldtype': u'Link', - 'hidden': 0, - 'label': u'Customer', - 'no_copy': 0, - 'oldfieldname': u'customer', - 'oldfieldtype': u'Link', - 'options': u'Customer', - 'permlevel': 0, - 'print_hide': 1, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'customer_address', - 'fieldtype': u'Link', - 'label': u'Customer Address', - 'options': u'Address', - 'permlevel': 0, - 'print_hide': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'contact_person', - 'fieldtype': u'Link', - 'label': u'Contact Person', - 'options': u'Contact', - 'permlevel': 0, - 'print_hide': 1 - }, - # DocField { 'doctype': u'DocField', 'fieldname': u'customer_name', 'fieldtype': u'Data', + 'hidden': 1, 'label': u'Name', 'oldfieldname': u'customer_name', 'oldfieldtype': u'Data', @@ -252,6 +214,7 @@ 'doctype': u'DocField', 'fieldname': u'address_display', 'fieldtype': u'Small Text', + 'hidden': 1, 'label': u'Address', 'permlevel': 1 }, @@ -261,6 +224,7 @@ 'doctype': u'DocField', 'fieldname': u'contact_display', 'fieldtype': u'Small Text', + 'hidden': 1, 'label': u'Contact', 'permlevel': 1 }, @@ -270,6 +234,7 @@ 'doctype': u'DocField', 'fieldname': u'contact_mobile', 'fieldtype': u'Text', + 'hidden': 1, 'label': u'Mobile No', 'permlevel': 1 }, @@ -279,6 +244,7 @@ 'doctype': u'DocField', 'fieldname': u'contact_email', 'fieldtype': u'Text', + 'hidden': 1, 'label': u'Contact Email', 'permlevel': 1, 'print_hide': 1 @@ -344,73 +310,6 @@ 'search_index': 0 }, - # DocField - { - 'description': u'The date at which current entry is corrected in the system.', - 'doctype': u'DocField', - 'fieldname': u'amendment_date', - 'fieldtype': u'Date', - 'label': u'Amendment Date', - 'no_copy': 1, - 'oldfieldname': u'amendment_date', - 'oldfieldtype': u'Date', - 'permlevel': 0, - 'print_hide': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'amended_from', - 'fieldtype': u'Link', - 'label': u'Amended From', - 'no_copy': 1, - 'oldfieldname': u'amended_from', - 'oldfieldtype': u'Link', - 'options': u'Sales Invoice', - 'permlevel': 1, - 'print_hide': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'mode_of_payment', - 'fieldtype': u'Select', - 'label': u'Mode of Payment', - 'oldfieldname': u'mode_of_payment', - 'oldfieldtype': u'Select', - 'options': u'link:Mode of Payment', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'territory', - 'fieldtype': u'Link', - 'in_filter': 1, - 'label': u'Territory', - 'options': u'Territory', - 'permlevel': 0, - 'print_hide': 1, - 'reqd': 1, - 'search_index': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'customer_group', - 'fieldtype': u'Link', - 'in_filter': 1, - 'label': u'Customer Group', - 'options': u'Customer Group', - 'permlevel': 0, - 'print_hide': 1, - 'search_index': 0 - }, - # DocField { 'colour': u'White:FFF', @@ -422,6 +321,134 @@ 'permlevel': 0 }, + # DocField + { + 'allow_on_submit': 1, + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'entries', + 'fieldtype': u'Table', + 'label': u'Entries', + 'oldfieldname': u'entries', + 'oldfieldtype': u'Table', + 'options': u'Sales Invoice Item', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'section_break0', + 'fieldtype': u'Section Break', + 'options': u'Simple', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'col_break26', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'description': u'Will be calculated automatically when you enter the details', + 'doctype': u'DocField', + 'fieldname': u'net_total', + 'fieldtype': u'Currency', + 'label': u'Net Total*', + 'oldfieldname': u'net_total', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'recalculate_values', + 'fieldtype': u'Button', + 'label': u'Re-Calculate Values', + 'oldfieldtype': u'Button', + 'permlevel': 0, + 'print_hide': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'col_break25', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Select Items from Sales Order', + 'doctype': u'DocField', + 'fieldname': u'sales_order_main', + 'fieldtype': u'Link', + 'label': u'Sales Order', + 'oldfieldname': u'sales_order_main', + 'oldfieldtype': u'Link', + 'options': u'Sales Order', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Select Items from Delivery Note', + 'doctype': u'DocField', + 'fieldname': u'delivery_note_main', + 'fieldtype': u'Link', + 'label': u'Delivery Note', + 'oldfieldname': u'delivery_note_main', + 'oldfieldtype': u'Link', + 'options': u'Delivery Note', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'get_items', + 'fieldtype': u'Button', + 'label': u'Get Items', + 'oldfieldtype': u'Button', + 'permlevel': 0, + 'print_hide': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'currency_section', + 'fieldtype': u'Section Break', + 'label': u'Price List and Currency', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'col_break27', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + # DocField { 'doctype': u'DocField', @@ -502,98 +529,6 @@ 'reqd': 1 }, - # DocField - { - 'colour': u'White:FFF', - 'description': u'Select Items from Sales Order', - 'doctype': u'DocField', - 'fieldname': u'sales_order_main', - 'fieldtype': u'Link', - 'label': u'Sales Order', - 'oldfieldname': u'sales_order_main', - 'oldfieldtype': u'Link', - 'options': u'Sales Order', - 'permlevel': 0, - 'print_hide': 1 - }, - - # DocField - { - 'colour': u'White:FFF', - 'description': u'Select Items from Delivery Note', - 'doctype': u'DocField', - 'fieldname': u'delivery_note_main', - 'fieldtype': u'Link', - 'label': u'Delivery Note', - 'oldfieldname': u'delivery_note_main', - 'oldfieldtype': u'Link', - 'options': u'Delivery Note', - 'permlevel': 0, - 'print_hide': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'get_items', - 'fieldtype': u'Button', - 'label': u'Get Items', - 'oldfieldtype': u'Button', - 'permlevel': 0, - 'print_hide': 1, - 'trigger': u'Client' - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'section_break0', - 'fieldtype': u'Section Break', - 'options': u'Simple', - 'permlevel': 0 - }, - - # DocField - { - 'allow_on_submit': 1, - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'entries', - 'fieldtype': u'Table', - 'label': u'Entries', - 'oldfieldname': u'entries', - 'oldfieldtype': u'Table', - 'options': u'Sales Invoice Item', - 'permlevel': 0 - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'recalculate_values', - 'fieldtype': u'Button', - 'label': u'Re-Calculate Values', - 'oldfieldtype': u'Button', - 'permlevel': 0, - 'print_hide': 1, - 'trigger': u'Client' - }, - - # DocField - { - 'description': u'Will be calculated automatically when you enter the details', - 'doctype': u'DocField', - 'fieldname': u'net_total', - 'fieldtype': u'Currency', - 'label': u'Net Total*', - 'oldfieldname': u'net_total', - 'oldfieldtype': u'Currency', - 'permlevel': 1, - 'print_hide': 0, - 'reqd': 1 - }, - # DocField { 'doctype': u'DocField', @@ -1009,6 +944,99 @@ 'permlevel': 0 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'contact_section', + 'fieldtype': u'Section Break', + 'label': u'Contact Info', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'col_break23', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'customer', + 'fieldtype': u'Link', + 'hidden': 0, + 'label': u'Customer', + 'no_copy': 0, + 'oldfieldname': u'customer', + 'oldfieldtype': u'Link', + 'options': u'Customer', + 'permlevel': 0, + 'print_hide': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'customer_address', + 'fieldtype': u'Link', + 'label': u'Customer Address', + 'options': u'Address', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'contact_person', + 'fieldtype': u'Link', + 'label': u'Contact Person', + 'options': u'Contact', + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'col_break24', + 'fieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'territory', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Territory', + 'options': u'Territory', + 'permlevel': 0, + 'print_hide': 1, + 'reqd': 1, + 'search_index': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'customer_group', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Customer Group', + 'options': u'Customer Group', + 'permlevel': 0, + 'print_hide': 1, + 'search_index': 0 + }, + # DocField { 'colour': u'White:FFF', @@ -1078,6 +1106,18 @@ 'print_hide': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'mode_of_payment', + 'fieldtype': u'Select', + 'label': u'Mode of Payment', + 'oldfieldname': u'mode_of_payment', + 'oldfieldtype': u'Select', + 'options': u'link:Mode of Payment', + 'permlevel': 0 + }, + # DocField { 'doctype': u'DocField', @@ -1135,17 +1175,6 @@ 'trigger': u'Client' }, - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'column_break8', - 'fieldtype': u'Column Break', - 'oldfieldtype': u'Column Break', - 'permlevel': 0, - 'print_hide': 1 - }, - # DocField { 'allow_on_submit': 1, @@ -1164,6 +1193,17 @@ 'trigger': u'Client' }, + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'column_break8', + 'fieldtype': u'Column Break', + 'oldfieldtype': u'Column Break', + 'permlevel': 0, + 'print_hide': 1 + }, + # DocField { 'doctype': u'DocField', @@ -1210,6 +1250,34 @@ 'search_index': 0 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'amended_from', + 'fieldtype': u'Link', + 'label': u'Amended From', + 'no_copy': 1, + 'oldfieldname': u'amended_from', + 'oldfieldtype': u'Link', + 'options': u'Sales Invoice', + 'permlevel': 1, + 'print_hide': 1 + }, + + # DocField + { + 'description': u'The date at which current entry is corrected in the system.', + 'doctype': u'DocField', + 'fieldname': u'amendment_date', + 'fieldtype': u'Date', + 'label': u'Amendment Date', + 'no_copy': 1, + 'oldfieldname': u'amendment_date', + 'oldfieldtype': u'Date', + 'permlevel': 0, + 'print_hide': 1 + }, + # DocField { 'colour': u'White:FFF', diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index bf869f05d4..28008f5468 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -92,6 +92,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { } erpnext.hide_naming_series(); + + if(doc.customer || doc.lead) $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true); + else $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(false); } diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 3ddc6074e0..7435593eb4 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -61,6 +61,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { erpnext.hide_naming_series(); if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn); + + if(doc.customer) $(cur_frm.fields_dict.contact_info.row.wrapper).toggle(true); + else $(cur_frm.fields_dict.contact_info.row.wrapper).toggle(false); if(doc.docstatus==1) { if(doc.status != 'Stopped') { diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 51dcf12db0..28ba99ecb5 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -70,6 +70,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.add_custom_button('Make Packing Slip', cur_frm.cscript['Make Packing Slip']); } + if(doc.customer) $(cur_frm.fields_dict.contact_info.row.wrapper).toggle(true); + else $(cur_frm.fields_dict.contact_info.row.wrapper).toggle(false); + set_print_hide(doc, cdt, cdn); } diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt index 996c1d65ee..e4de1cc639 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.txt +++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt @@ -5,7 +5,7 @@ { 'creation': '2012-04-13 11:56:34', 'docstatus': 0, - 'modified': '2012-04-30 20:41:10', + 'modified': '2012-05-01 12:33:31', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -877,6 +877,7 @@ # DocField { 'doctype': u'DocField', + 'fieldname': u'contact_info', 'fieldtype': u'Section Break', 'label': u'Contact Info', 'permlevel': 0