Rushabh Mehta | 3966f1d | 2012-02-23 12:35:32 +0530 | [diff] [blame] | 1 | # ERPNext - web based ERP (http://erpnext.com) |
| 2 | # Copyright (C) 2012 Web Notes Technologies Pvt Ltd |
| 3 | # |
| 4 | # This program is free software: you can redistribute it and/or modify |
| 5 | # it under the terms of the GNU General Public License as published by |
| 6 | # the Free Software Foundation, either version 3 of the License, or |
| 7 | # (at your option) any later version. |
| 8 | # |
| 9 | # This program is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | # GNU General Public License for more details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU General Public License |
| 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | |
Anand Doshi | 486f9df | 2012-07-19 13:40:31 +0530 | [diff] [blame] | 17 | from __future__ import unicode_literals |
Rushabh Mehta | 1a35574 | 2012-02-23 11:46:28 +0530 | [diff] [blame] | 18 | """will be called by scheduler""" |
| 19 | |
| 20 | import webnotes |
Anand Doshi | f9e4b16 | 2012-02-28 11:31:46 +0530 | [diff] [blame] | 21 | from webnotes.utils import scheduler |
Rushabh Mehta | 1a35574 | 2012-02-23 11:46:28 +0530 | [diff] [blame] | 22 | |
| 23 | def execute_all(): |
Anand Doshi | f9e4b16 | 2012-02-28 11:31:46 +0530 | [diff] [blame] | 24 | """ |
| 25 | * get support email |
| 26 | * recurring invoice |
| 27 | """ |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 28 | # pull emails |
| 29 | from support.doctype.support_ticket import get_support_mails |
| 30 | run_fn(get_support_mails) |
Anand Doshi | f9e4b16 | 2012-02-28 11:31:46 +0530 | [diff] [blame] | 31 | |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 32 | # bulk email |
| 33 | from webnotes.utils.email_lib.bulk import flush |
| 34 | run_fn(flush) |
Rushabh Mehta | 1a35574 | 2012-02-23 11:46:28 +0530 | [diff] [blame] | 35 | |
| 36 | def execute_daily(): |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 37 | # email digest |
| 38 | from setup.doctype.email_digest.email_digest import send |
| 39 | run_fn(send) |
| 40 | |
Rushabh Mehta | 48f5f40 | 2012-08-06 14:19:11 +0530 | [diff] [blame] | 41 | # run recurring invoices |
Anand Doshi | 420e1b4 | 2012-11-30 15:11:12 +0530 | [diff] [blame] | 42 | from accounts.doctype.sales_invoice.sales_invoice import manage_recurring_invoices |
Rushabh Mehta | 48f5f40 | 2012-08-06 14:19:11 +0530 | [diff] [blame] | 43 | run_fn(manage_recurring_invoices) |
| 44 | |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 45 | # send bulk emails |
Rushabh Mehta | 52006ca | 2012-08-03 14:15:25 +0530 | [diff] [blame] | 46 | from webnotes.utils.email_lib.bulk import clear_outbox |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 47 | run_fn(clear_outbox) |
Anand Doshi | f9e4b16 | 2012-02-28 11:31:46 +0530 | [diff] [blame] | 48 | |
| 49 | def execute_weekly(): |
| 50 | pass |
| 51 | |
| 52 | def execute_monthly(): |
| 53 | pass |
| 54 | |
| 55 | def execute_hourly(): |
| 56 | pass |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 57 | |
| 58 | def run_fn(fn): |
| 59 | try: |
| 60 | fn() |
| 61 | except Exception, e: |
| 62 | scheduler.log(fn.func_name) |