From 8f674fe0fb187d52de2302eaf0ea10d658f96ede Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Mon, 3 Feb 2014 17:47:50 +0530 Subject: [PATCH] minor changes --- .../doctype/sales_invoice/sales_invoice.py | 2 +- erpnext/selling/doctype/customer/customer.js | 12 ++-- .../contact_control/contact_control.js | 70 ++++++++----------- 3 files changed, 34 insertions(+), 50 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index bb7d1c1b8c..f57f6f05c0 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -751,7 +751,7 @@ def notify_errors(inv, customer, owner): message = webnotes.get_template("template/emails/recurring_invoice_failed.html").render({ "name": inv, "customer": customer - }) + })) assign_task_to_owner(inv, "Recurring Invoice Failed", recipients) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index f2568d6854..d12527dea7 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -3,7 +3,7 @@ {% include 'setup/doctype/contact_control/contact_control.js' %}; -cur_frm.cscript.onload = function(doc,dt,dn){ +cur_frm.cscript.onload = function(doc, dt, dn) { cur_frm.cscript.load_defaults(doc, dt, dn); } @@ -27,8 +27,8 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { }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_address(doc, dt, dn); + cur_frm.cscript.make_contact(doc, dt, dn); cur_frm.communication_view = new wn.views.CommunicationList({ parent: cur_frm.fields_dict.communication_html.wrapper, @@ -67,7 +67,7 @@ cur_frm.cscript.setup_dashboard = function(doc) { } cur_frm.dashboard.set_badge_count(r.message); } - }) + }); } cur_frm.cscript.make_address = function() { @@ -104,7 +104,6 @@ cur_frm.cscript.make_contact = function() { // note: render_contact_row is defined in contact_control.js } cur_frm.contact_list.run(); - } cur_frm.fields_dict['customer_group'].get_query = function(doc, dt, dn) { @@ -113,7 +112,6 @@ cur_frm.fields_dict['customer_group'].get_query = function(doc, dt, dn) { } } - cur_frm.fields_dict.lead_name.get_query = function(doc, cdt, cdn) { return{ query: "erpnext.controllers.queries.lead_query" @@ -124,4 +122,4 @@ cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) { return{ filters:{'selling': 1} } -} +} \ No newline at end of file diff --git a/erpnext/setup/doctype/contact_control/contact_control.js b/erpnext/setup/doctype/contact_control/contact_control.js index d857ccd2c9..2e45df6dc8 100755 --- a/erpnext/setup/doctype/contact_control/contact_control.js +++ b/erpnext/setup/doctype/contact_control/contact_control.js @@ -1,32 +1,21 @@ // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt -// common partner functions -// ========================= - - -// get sates on country trigger -// ----------------------------- -cur_frm.cscript.get_states=function(doc,dt,dn){ - return $c('runserverobj', args={'method':'check_state', 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name))}, - function(r,rt){ - if(r.message) { - set_field_options('state', r.message); - } - } - ); - +cur_frm.cscript.get_states=function(doc, dt, dn) { + return $c('runserverobj', args={'method': 'check_state', 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name))}, + function(r, rt) { + if(r.message) + set_field_options('state', r.message); + } + ); } cur_frm.cscript.country = function(doc, dt, dn) { - cur_frm.cscript.get_states(doc, dt, dn); + cur_frm.cscript.get_states(doc, dt, dn); } - -// get query select Territory -// --------------------------- -if(cur_frm.fields_dict['territory']){ - cur_frm.fields_dict['territory'].get_query = function(doc,dt,dn) { +if(cur_frm.fields_dict['territory']) { + cur_frm.fields_dict['territory'].get_query = function(doc, dt, dn) { return { filters: { 'is_group': "No" @@ -58,7 +47,7 @@ cur_frm.cscript.render_contact_row = function(wrapper, data) { } }); data.description = description.join('
'); - + cur_frm.cscript.render_row_in_wrapper(wrapper, data, 'Contact'); } @@ -68,17 +57,17 @@ cur_frm.cscript.render_address_row = function(wrapper, data) { data.primary = ''; if (data.is_primary_address) data.primary += ' [Preferred for Billing]'; if (data.is_shipping_address) data.primary += ' [Preferred for Shipping]'; - + // prepare address var address = []; $.each(['address_line1', 'address_line2', 'city', 'state', 'country', 'pincode'], function(i, v) { if(data[v]) address.push(data[v]); }); - + data.address = address.join('
'); data.address = "

" + data.address + "

"; - + // prepare description var description = []; $.each([ @@ -95,9 +84,9 @@ cur_frm.cscript.render_address_row = function(wrapper, data) { } }); data.description = description.join('
'); - + cur_frm.cscript.render_row_in_wrapper(wrapper, data, 'Address'); - + $(wrapper).find('p.address-list').css({ 'padding-left': '10px', 'margin-bottom': '-10px' @@ -107,21 +96,21 @@ cur_frm.cscript.render_address_row = function(wrapper, data) { cur_frm.cscript.render_row_in_wrapper = function(wrapper, data, doctype) { // render var $wrapper = $(wrapper); - + data.doctype = doctype.toLowerCase(); - + $wrapper.append(repl("\

%(fullname)s%(primary)s

\
\

%(description)s

\

delete this %(doctype)s

\
", data)); - + // make link $wrapper.find('h4 a.link_type').click(function() { loaddoc(doctype, data.name); }); - + // css $wrapper.css({ 'margin': '0px' }); $wrapper.find('div.description').css({ @@ -129,17 +118,15 @@ cur_frm.cscript.render_row_in_wrapper = function(wrapper, data, doctype) { 'line-height': '150%', }); $wrapper.find('h6').css({ 'display': 'inline-block' }); - + // show delete var $delete_doc = $wrapper.find('a.delete'); - if (wn.model.can_delete(doctype)) { + if (wn.model.can_delete(doctype)) $delete_doc.toggle(true); - } else { + else $delete_doc.toggle(false); - } - $delete_doc.css({ - 'padding-left': '0px' - }); + + $delete_doc.css({ 'padding-left': '0px' }); $delete_doc.click(function() { cur_frm.cscript.delete_doc(doctype, data.name); @@ -184,17 +171,16 @@ cur_frm.cscript.render_list = function(doc, doctype, wrapper, ListView, make_new [doctype, doc.doctype.toLowerCase().replace(" ", "_"), '=', doc.name], ], }); - + if (make_new_doc) { RecordListView = RecordListView.extend({ make_new_doc: make_new_doc, }); } - + var record_list_view = new RecordListView(doctype, wrapper, ListView); if (!cur_frm[doctype.toLowerCase().replace(" ", "_") + "_list"]) { cur_frm[doctype.toLowerCase().replace(" ", "_") + "_list"] = record_list_view; } }); -} - +} \ No newline at end of file