From 8d4ba6c7ec53674c267ebc8979ef69a3db1b2cb1 Mon Sep 17 00:00:00 2001 From: Anupam K Date: Tue, 16 Jun 2020 16:19:33 +0530 Subject: [PATCH 1/9] Adding filter in academic term --- erpnext/education/doctype/fee_structure/fee_structure.js | 8 ++++++++ .../education/doctype/fee_structure/fee_structure.json | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/erpnext/education/doctype/fee_structure/fee_structure.js b/erpnext/education/doctype/fee_structure/fee_structure.js index 7606565fad..f09d2efcb9 100644 --- a/erpnext/education/doctype/fee_structure/fee_structure.js +++ b/erpnext/education/doctype/fee_structure/fee_structure.js @@ -9,6 +9,14 @@ frappe.ui.form.on('Fee Structure', { }, onload: function(frm) { + frm.set_query("academic_term", function() { + return { + "filters": { + "academic_year": frm.doc.academic_year + } + }; + }); + frm.set_query("receivable_account", function(doc) { return { filters: { diff --git a/erpnext/education/doctype/fee_structure/fee_structure.json b/erpnext/education/doctype/fee_structure/fee_structure.json index 8ff6851d90..67e46372f8 100644 --- a/erpnext/education/doctype/fee_structure/fee_structure.json +++ b/erpnext/education/doctype/fee_structure/fee_structure.json @@ -1,4 +1,5 @@ { + "actions": [], "allow_import": 1, "allow_rename": 1, "autoname": "naming_series:", @@ -11,8 +12,8 @@ "program", "student_category", "column_break_2", - "academic_term", "academic_year", + "academic_term", "section_break_4", "components", "section_break_6", @@ -157,7 +158,8 @@ ], "icon": "fa fa-flag", "is_submittable": 1, - "modified": "2019-05-26 09:04:17.765758", + "links": [], + "modified": "2020-06-16 15:34:57.295010", "modified_by": "Administrator", "module": "Education", "name": "Fee Structure", From 17422a3e45fc61cf686931a89321fede0cde8141 Mon Sep 17 00:00:00 2001 From: marination Date: Wed, 17 Jun 2020 13:46:21 +0530 Subject: [PATCH 2/9] fix: Message Formatting --- erpnext/controllers/stock_controller.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 2888c764ef..759c6cd73e 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -227,7 +227,9 @@ class StockController(AccountsController): def check_expense_account(self, item): if not item.get("expense_account"): - frappe.throw(_("Expense Account not set for Item {0}. Please set an Expense Account for the item in the Items table").format(item.item_code)) + frappe.throw(_("Row #{0}: Expense Account not set for Item {1}. Please set an Expense \ + Account in the Items table").format(item.idx, frappe.bold(item.item_code)), + title=_("Expense Account Missing")) else: is_expense_account = frappe.db.get_value("Account", From 8546b71358534ecfb13e519ac8d49815f0382d91 Mon Sep 17 00:00:00 2001 From: Afshan <33727827+AfshanKhan@users.noreply.github.com> Date: Wed, 17 Jun 2020 16:16:59 +0530 Subject: [PATCH 3/9] feat: /support (#22194) * added: /support * refactor code and implemented fail checks * removed unused imports * changed filter from from title to name * refactor code to move context inside main * removed unused variable * added: /support * refactor code and implemented fail checks * removed unused imports * changed filter from from title to name * refactor code to move context inside main * removed unused variable * refactor: renamed set to get Co-authored-by: Shivam Mishra Co-authored-by: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> --- .../support_settings/support_settings.json | 37 +++++++++- erpnext/www/support/__init__.py | 0 erpnext/www/support/index.html | 55 ++++++++++++++ erpnext/www/support/index.py | 74 +++++++++++++++++++ 4 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 erpnext/www/support/__init__.py create mode 100644 erpnext/www/support/index.html create mode 100644 erpnext/www/support/index.py diff --git a/erpnext/support/doctype/support_settings/support_settings.json b/erpnext/support/doctype/support_settings/support_settings.json index 1c1b0c3517..5d3d3ace59 100644 --- a/erpnext/support/doctype/support_settings/support_settings.json +++ b/erpnext/support/doctype/support_settings/support_settings.json @@ -1,5 +1,5 @@ { - "actions": [], + "actions": "", "creation": "2017-02-17 13:07:35.686409", "doctype": "DocType", "editable_grid": 1, @@ -22,6 +22,10 @@ "post_description_key", "post_route_key", "post_route_string", + "greetings_section_section", + "greeting_title", + "column_break_19", + "greeting_subtitle", "search_apis_sb", "search_apis" ], @@ -127,11 +131,40 @@ "fieldname": "allow_resetting_service_level_agreement", "fieldtype": "Check", "label": "Allow Resetting Service Level Agreement" + }, + { + "default": "We're here to help", + "fieldname": "greeting_title", + "fieldtype": "Data", + "label": "Greeting Title", + "show_days": 1, + "show_seconds": 1 + }, + { + "fieldname": "column_break_19", + "fieldtype": "Column Break", + "show_days": 1, + "show_seconds": 1 + }, + { + "default": "Browse help topics", + "fieldname": "greeting_subtitle", + "fieldtype": "Data", + "label": "Greeting Subtitle", + "show_days": 1, + "show_seconds": 1 + }, + { + "fieldname": "greetings_section_section", + "fieldtype": "Section Break", + "label": "Greetings Section", + "show_days": 1, + "show_seconds": 1 } ], "issingle": 1, "links": [], - "modified": "2020-06-05 17:56:17.491684", + "modified": "2020-06-11 13:08:38.473616", "modified_by": "Administrator", "module": "Support", "name": "Support Settings", diff --git a/erpnext/www/support/__init__.py b/erpnext/www/support/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/www/support/index.html b/erpnext/www/support/index.html new file mode 100644 index 0000000000..824f0bd5ba --- /dev/null +++ b/erpnext/www/support/index.html @@ -0,0 +1,55 @@ +{% extends "templates/web.html" %} + +{% block content %} +
+
+
+

{{ _(greeting_title) or _("We're here to help") }}

+

{{ greeting_subtitle or _("Browse help topics.") }}

+
+
+
+ +{% if favorite_article_list %} +
+
+

{{ _("Frequently Read Articles") }}

+
+ {% for favorite_article in favorite_article_list %} +
+
+
+
{{ favorite_article['category'] }}
+

{{ favorite_article['title'] }}

+

{{ favorite_article['description'] }}

+
+ +
+
+ {% endfor %} +
+
+
+{% endif %} + +{% if help_article_list %} +
+
+

{{ _("Help Articles") }}

+
+ {% for item in help_article_list %} +
+
{{ item['category'].name }}
+
+ {% for article in item['articles'] %} + {{ article.title }} + {% endfor %} +
+
+ {% endfor %} +
+
+
+{% endif %} + +{% endblock %} \ No newline at end of file diff --git a/erpnext/www/support/index.py b/erpnext/www/support/index.py new file mode 100644 index 0000000000..58ca8f7281 --- /dev/null +++ b/erpnext/www/support/index.py @@ -0,0 +1,74 @@ +from __future__ import unicode_literals +import frappe + +def get_context(context): + context.no_cache = 1 + context.align_greeting = '' + setting = frappe.get_doc("Support Settings") + + context.greeting_title = setting.greeting_title + context.greeting_subtitle = setting.greeting_subtitle + + # Support content + favorite_articles = get_favorite_articles_by_page_view() + if len(favorite_articles) < 6: + name_list = [] + if favorite_articles: + for article in favorite_articles: + name_list.append(article.name) + for record in (frappe.get_all("Help Article", + fields=["title", "content", "route", "category"], + filters={"name": ['not in', tuple(name_list)], "published": 1}, + order_by="creation desc", limit=(6-len(favorite_articles)))): + favorite_articles.append(record) + + context.favorite_article_list = get_favorite_articles(favorite_articles) + context.help_article_list = get_help_article_list() + +def get_favorite_articles_by_page_view(): + return frappe.db.sql( + """ + SELECT + t1.name as name, + t1.title as title, + t1.content as content, + t1.route as route, + t1.category as category, + count(t1.route) as count + FROM `tabHelp Article` AS t1 + INNER JOIN + `tabWeb Page View` AS t2 + ON t1.route = t2.path + WHERE t1.published = 1 + GROUP BY route + ORDER BY count DESC + LIMIT 6; + """, as_dict=True) + +def get_favorite_articles(favorite_articles): + favorite_article_list=[] + for article in favorite_articles: + description = frappe.utils.strip_html(article.content) + if len(description) > 175: + description = description[:172] + '...' + favorite_article_dict = { + 'title': article.title, + 'description': description, + 'route': article.route, + 'category': article.category, + } + favorite_article_list.append(favorite_article_dict) + return favorite_article_list + +def get_help_article_list(): + help_article_list=[] + category_list = frappe.get_all("Help Category", fields="name") + for category in category_list: + help_articles = frappe.get_all("Help Article", fields="*", filters={"category": category.name, "published": 1}, order_by="modified desc", limit=5) + if help_articles: + help_aricles_per_caetgory = { + 'category': category, + 'articles': help_articles, + } + help_article_list.append(help_aricles_per_caetgory) + return help_article_list \ No newline at end of file From fec894f530a60a75cdc035d8bc1ffce423245fa8 Mon Sep 17 00:00:00 2001 From: Kaviya Periyasamy <36359901+KaviyaPeriyasamy@users.noreply.github.com> Date: Wed, 17 Jun 2020 17:39:12 +0530 Subject: [PATCH 4/9] fix: modified time updated with the latest date (#22286) --- erpnext/accounts/doctype/cost_center/cost_center.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/cost_center/cost_center.json b/erpnext/accounts/doctype/cost_center/cost_center.json index c9bbbabe79..e7fa954e01 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.json +++ b/erpnext/accounts/doctype/cost_center/cost_center.json @@ -146,7 +146,7 @@ "idx": 1, "is_tree": 1, "links": [], - "modified": "2020-04-29 16:09:30.025214", + "modified": "2020-06-17 16:09:30.025214", "modified_by": "Administrator", "module": "Accounts", "name": "Cost Center", From 7057a807ca175cdd1d7f1f20f425c332f6768ab9 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 17 Jun 2020 18:35:38 +0530 Subject: [PATCH 5/9] refactor: minor layout fixes to portal --- erpnext/public/scss/website.scss | 6 ++++++ erpnext/www/support/index.html | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/erpnext/public/scss/website.scss b/erpnext/public/scss/website.scss index 735b417da1..617e916724 100644 --- a/erpnext/public/scss/website.scss +++ b/erpnext/public/scss/website.scss @@ -81,4 +81,10 @@ .place-order-container { text-align: right; +} + +.kb-card { + .card-body > .card-title { + line-height: 1.3; + } } \ No newline at end of file diff --git a/erpnext/www/support/index.html b/erpnext/www/support/index.html index 824f0bd5ba..afc437052d 100644 --- a/erpnext/www/support/index.html +++ b/erpnext/www/support/index.html @@ -11,13 +11,13 @@ {% if favorite_article_list %} -
+

{{ _("Frequently Read Articles") }}

{% for favorite_article in favorite_article_list %}
-
+
{{ favorite_article['category'] }}

{{ favorite_article['title'] }}

@@ -33,7 +33,7 @@ {% endif %} {% if help_article_list %} -
+

{{ _("Help Articles") }}

From 2b18bdfe72479cc3936e5dd7f1d4c164080e7ac6 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 17 Jun 2020 18:36:51 +0530 Subject: [PATCH 6/9] fix: title for support --- erpnext/www/support/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/www/support/index.html b/erpnext/www/support/index.html index afc437052d..36cd8c68f3 100644 --- a/erpnext/www/support/index.html +++ b/erpnext/www/support/index.html @@ -4,7 +4,7 @@
-

{{ _(greeting_title) or _("We're here to help") }}

+

{{ _(greeting_title) or _("We're here to help") }}

{{ greeting_subtitle or _("Browse help topics.") }}

From 2462f07c87d1fe3d3d69a8814bd7ef7a9230b05a Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 17 Jun 2020 18:39:49 +0530 Subject: [PATCH 7/9] refactor: update titles --- erpnext/www/support/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/www/support/index.html b/erpnext/www/support/index.html index 36cd8c68f3..491604f09c 100644 --- a/erpnext/www/support/index.html +++ b/erpnext/www/support/index.html @@ -4,7 +4,7 @@
-

{{ _(greeting_title) or _("We're here to help") }}

+

{{ _(greeting_title) or _("We're here to help") }}

{{ greeting_subtitle or _("Browse help topics.") }}

@@ -13,7 +13,7 @@ {% if favorite_article_list %}
-

{{ _("Frequently Read Articles") }}

+

{{ _("Frequently Read Articles") }}

{% for favorite_article in favorite_article_list %}
@@ -35,7 +35,7 @@ {% if help_article_list %}
-

{{ _("Help Articles") }}

+

{{ _("Help Articles") }}

{% for item in help_article_list %}
From 6e231ae0cba6f5decb83293c8ebb87ddff5eac8c Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 17 Jun 2020 18:43:59 +0530 Subject: [PATCH 8/9] refactor: remove translation --- erpnext/www/support/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/www/support/index.html b/erpnext/www/support/index.html index 491604f09c..2b1c282d18 100644 --- a/erpnext/www/support/index.html +++ b/erpnext/www/support/index.html @@ -4,7 +4,7 @@
-

{{ _(greeting_title) or _("We're here to help") }}

+

{{ greeting_title or _("We're here to help") }}

{{ greeting_subtitle or _("Browse help topics.") }}

From 64d772480b0d0dc7dc5a6ce9f5c99f442322d899 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Wed, 17 Jun 2020 13:18:15 +0000 Subject: [PATCH 9/9] fix: limit max length for cards (#22289) --- erpnext/www/support/index.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/www/support/index.py b/erpnext/www/support/index.py index 58ca8f7281..5d267430c1 100644 --- a/erpnext/www/support/index.py +++ b/erpnext/www/support/index.py @@ -49,8 +49,8 @@ def get_favorite_articles(favorite_articles): favorite_article_list=[] for article in favorite_articles: description = frappe.utils.strip_html(article.content) - if len(description) > 175: - description = description[:172] + '...' + if len(description) > 120: + description = description[:120] + '...' favorite_article_dict = { 'title': article.title, 'description': description,