From 73c6542e6c592ab28f3c6b0b9a9b08269445628a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 22 Aug 2012 14:57:35 +0530 Subject: [PATCH 1/5] minor fix in communication.js --- erpnext/support/doctype/communication/communication.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/support/doctype/communication/communication.js b/erpnext/support/doctype/communication/communication.js index d6af592048..59e2ee9c55 100644 --- a/erpnext/support/doctype/communication/communication.js +++ b/erpnext/support/doctype/communication/communication.js @@ -64,7 +64,7 @@ cur_frm.cscript.render_communication_list = function(doc, dt, dn) { ListView, function(doctype) { var new_doc = LocalDB.create(doctype); new_doc = locals[doctype][new_doc]; - new_doc[doc.doctype.toLowerCase()] = doc.name; + new_doc[doc.doctype.toLowerCase().replace(" ", "_")] = doc.name; loaddoc(new_doc.doctype, new_doc.name); }); } @@ -79,7 +79,7 @@ cur_frm.cscript.render_list = function(doc, doctype, wrapper, ListView, make_new var RecordListView = wn.views.RecordListView.extend({ default_docstatus: ['0', '1', '2'], default_filters: [ - [doctype, doc.doctype.toLowerCase(), '=', doc.name], + [doctype, doc.doctype.toLowerCase().replace(" ", "_"), '=', doc.name], ], }); From 6db2ac51e6440f24c1a5c8f72b224d5494698277 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 23 Aug 2012 15:24:21 +0530 Subject: [PATCH 2/5] changed blog comments date format to global date format i.e. 1 January 2012 --- erpnext/patches/august_2012/changed_blog_date_format.py | 4 ++++ erpnext/patches/patch_list.py | 4 ++++ erpnext/website/doctype/blog/blog.py | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/august_2012/changed_blog_date_format.py diff --git a/erpnext/patches/august_2012/changed_blog_date_format.py b/erpnext/patches/august_2012/changed_blog_date_format.py new file mode 100644 index 0000000000..d2dd87069c --- /dev/null +++ b/erpnext/patches/august_2012/changed_blog_date_format.py @@ -0,0 +1,4 @@ +def execute(): + import webnotes + from webnotes.model.doclist import DocList + DocList("Website Settings", "Website Settings").save() \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 83da5c3fa3..5a0a9d7857 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -521,4 +521,8 @@ patch_list = [ 'patch_module': 'patches.august_2012', 'patch_file': 'report_supplier_quotations', }, + { + 'patch_module': 'patches.august_2012', + 'patch_file': 'changed_blog_date_format', + }, ] \ No newline at end of file diff --git a/erpnext/website/doctype/blog/blog.py b/erpnext/website/doctype/blog/blog.py index 786941c7e1..fc389d09d7 100644 --- a/erpnext/website/doctype/blog/blog.py +++ b/erpnext/website/doctype/blog/blog.py @@ -83,4 +83,4 @@ class DocType(website.web_page.Page): self.doc.comment_list = comment_list or [] for comment in self.doc.comment_list: - comment['comment_date'] = webnotes.utils.pretty_date(comment['creation']) \ No newline at end of file + comment['comment_date'] = webnotes.utils.global_date_format(comment['creation']) \ No newline at end of file From 7e657d79fd1695407965b33cb35da2eb6998305b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 23 Aug 2012 17:15:13 +0530 Subject: [PATCH 3/5] global date format for blog comments --- erpnext/website/blog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/website/blog.py b/erpnext/website/blog.py index ea1992b1fe..482800ec4e 100644 --- a/erpnext/website/blog.py +++ b/erpnext/website/blog.py @@ -98,7 +98,7 @@ def add_comment(args=None): import webnotes.utils - comment['comment_date'] = webnotes.utils.pretty_date(comment['creation']) + comment['comment_date'] = webnotes.utils.global_date_format(comment['creation']) template_args = { 'comment_list': [comment], 'template': 'html/comment.html' } # get html of comment row From 763e4c93bc950bafd76bcb2159ccecdd4cefaba1 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 23 Aug 2012 18:33:58 +0530 Subject: [PATCH 4/5] added permission checking to show add child, edit and view ledger links in chart of accounts --- .../page/accounts_browser/accounts_browser.js | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js index 734e4de18a..4f35fd4156 100644 --- a/erpnext/accounts/page/accounts_browser/accounts_browser.js +++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js @@ -116,15 +116,23 @@ erpnext.AccountsChart = Class.extend({ if(!data) return; link.toolbar = $('').insertAfter(link); + + var node_links = []; // edit - $('Edit').appendTo(link.toolbar); - - if(data.expandable) { - link.toolbar.append(' | Add Child'); - } else if(this.ctype=='Account') { - link.toolbar.append(' | View Ledger'); + if (wn.boot.profile.can_read.indexOf(this.ctype) !== -1) { + node_links.push('Edit'); } + if (data.expandable) { + if (wn.boot.profile.can_create.indexOf(this.ctype) !== -1 || + wn.boot.profile.in_create.indexOf(this.ctype) !== -1) { + node_links.push('Add Child'); + } + } else if (this.ctype === 'Account' && wn.boot.profile.can_read.indexOf("GL Entry") !== -1) { + node_links.push('View Ledger'); + } + + link.toolbar.append(node_links.join(" | ")); }, show_ledger: function() { var me = this; From ba278000d7b13d925875f54fd40d4e0c034cd75e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 24 Aug 2012 12:15:44 +0530 Subject: [PATCH 5/5] edit / add nodes allowed in sales browser, only if user has valid permissions --- .../selling/page/sales_browser/sales_browser.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/page/sales_browser/sales_browser.js b/erpnext/selling/page/sales_browser/sales_browser.js index 66e1d52bc0..532728a99d 100644 --- a/erpnext/selling/page/sales_browser/sales_browser.js +++ b/erpnext/selling/page/sales_browser/sales_browser.js @@ -79,12 +79,21 @@ erpnext.SalesChart = Class.extend({ link.toolbar = $('').insertAfter(link); // edit - $('Edit').appendTo(link.toolbar); + var node_links = []; + + if (wn.boot.profile.can_read.indexOf(this.ctype) !== -1) { + node_links.push('Edit'); + } if(data.expandable) { - link.toolbar.append(' | Add Child'); + if (wn.boot.profile.can_create.indexOf(this.ctype) !== -1 || + wn.boot.profile.in_create.indexOf(this.ctype) !== -1) { + node_links.push('Add Child'); + } } + + link.toolbar.append(node_links.join(" | ")); }, new_node: function() { var me = this;