diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index e62ff0fecd..d1c50efd4a 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -70,19 +70,22 @@ class EmailDigest(Document): def get_msg_html(self): """Build email digest content""" frappe.flags.ignore_account_permission = True + from erpnext.setup.doctype.email_digest.quotes import get_random_quote context = frappe._dict() context.update(self.__dict__) self.set_title(context) self.set_style(context) - self.set_accounting_cards(context) context.events = self.get_calendar_events() context.todo_list = self.get_todo_list() context.notifications = self.get_notifications() + quote = get_random_quote() + context.quote = {"text": quote[0], "author": quote[1]} + if not (context.events or context.todo_list or context.notifications or context.cards): return None diff --git a/erpnext/setup/doctype/email_digest/quotes.py b/erpnext/setup/doctype/email_digest/quotes.py new file mode 100644 index 0000000000..d56117a2c6 --- /dev/null +++ b/erpnext/setup/doctype/email_digest/quotes.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals +import random + +def get_random_quote(): + quotes = [ + ("Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible.", "Francis of Assisi"), + ("The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart.", "Hellen Keller"), + ("I can't change the direction of the wind, but I can adjust my sails to always reach my destination.", "Jimmy Dean"), + ("We know what we are, but know not what we may be.", "William Shakespeare"), + ("There are only two mistakes one can make along the road to truth; not going all the way, and not starting.", "Buddha"), + ("Always remember that you are absolutely unique. Just like everyone else.", "Margaret Mead"), + ("You have to learn the rules of the game. And then you have to play better than anyone else.", "Albert Einstein"), + ("Once we accept our limits, we go beyond them.", "Albert Einstein"), + ("Quality is not an act, it is a habit.", "Aristotle"), + ("The more that you read, the more things you will know. The more that you learn, the more places you'll go.", "Dr. Seuss"), + ("From there to here, and here to there, funny things are everywhere.", "Dr. Seuss"), + ("The secret of getting ahead is getting started.", "Mark Twain"), + ("All generalizations are false, including this one.", "Mark Twain"), + ("Don't let schooling interfere with your education.", "Mark Twain"), + ("Cauliflower is nothing but cabbage with a college education.", "Mark Twain"), + ("It's not the size of the dog in the fight, it's the size of the fight in the dog.", "Mark Twain"), + ("Climate is what we expect, weather is what we get.", "Mark Twain"), + ("There are lies, damned lies and statistics.", "Mark Twain"), + ("Happiness is when what you think, what you say, and what you do are in harmony.", "Mahatma Gandhi"), + ("First they ignore you, then they laugh at you, then they fight you, then you win.", "Mahatma Gandhi"), + ("There is more to life than increasing its speed.", "Mahatma Gandhi"), + ("A small body of determined spirits fired by an unquenchable faith in their mission can alter the course of history.", "Mahatma Gandhi"), + ("If two wrongs don't make a right, try three.", "Laurence J. Peter"), + ] + + return random.choice(quotes) + diff --git a/erpnext/setup/doctype/email_digest/templates/default.html b/erpnext/setup/doctype/email_digest/templates/default.html index c836c466ea..cf35e460d3 100644 --- a/erpnext/setup/doctype/email_digest/templates/default.html +++ b/erpnext/setup/doctype/email_digest/templates/default.html @@ -1,16 +1,15 @@ {% macro show_card(card) %}
{{ card.diff }}%
+{{ card.diff }}%
{% endif %}{% if frequency == "Daily "%} @@ -20,6 +19,7 @@ {% endif %}
+{% if cards %}