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 |
Rushabh Mehta | 133d752 | 2013-01-15 14:17:31 +0530 | [diff] [blame] | 29 | from support.doctype.support_ticket.get_support_mails import get_support_mails |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 30 | run_fn(get_support_mails) |
Rushabh Mehta | 3169ef0 | 2013-01-15 17:23:23 +0530 | [diff] [blame] | 31 | |
| 32 | from hr.doctype.job_applicant.get_job_applications import get_job_applications |
| 33 | run_fn(get_job_applications) |
Rushabh Mehta | 2e5db35 | 2013-01-16 11:34:26 +0530 | [diff] [blame] | 34 | |
| 35 | from selling.doctype.lead.get_leads import get_leads |
Rushabh Mehta | 1a0b27e | 2013-01-16 12:36:07 +0530 | [diff] [blame] | 36 | run_fn(get_leads) |
Rushabh Mehta | 2e5db35 | 2013-01-16 11:34:26 +0530 | [diff] [blame] | 37 | |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 38 | from webnotes.utils.email_lib.bulk import flush |
| 39 | run_fn(flush) |
Rushabh Mehta | 1a35574 | 2012-02-23 11:46:28 +0530 | [diff] [blame] | 40 | |
| 41 | def execute_daily(): |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 42 | # email digest |
| 43 | from setup.doctype.email_digest.email_digest import send |
| 44 | run_fn(send) |
| 45 | |
Rushabh Mehta | 48f5f40 | 2012-08-06 14:19:11 +0530 | [diff] [blame] | 46 | # run recurring invoices |
Anand Doshi | 420e1b4 | 2012-11-30 15:11:12 +0530 | [diff] [blame] | 47 | from accounts.doctype.sales_invoice.sales_invoice import manage_recurring_invoices |
Rushabh Mehta | 48f5f40 | 2012-08-06 14:19:11 +0530 | [diff] [blame] | 48 | run_fn(manage_recurring_invoices) |
| 49 | |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 50 | # send bulk emails |
Rushabh Mehta | 52006ca | 2012-08-03 14:15:25 +0530 | [diff] [blame] | 51 | from webnotes.utils.email_lib.bulk import clear_outbox |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 52 | run_fn(clear_outbox) |
Anand Doshi | f9e4b16 | 2012-02-28 11:31:46 +0530 | [diff] [blame] | 53 | |
| 54 | def execute_weekly(): |
| 55 | pass |
| 56 | |
| 57 | def execute_monthly(): |
| 58 | pass |
| 59 | |
| 60 | def execute_hourly(): |
| 61 | pass |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 62 | |
| 63 | def run_fn(fn): |
| 64 | try: |
| 65 | fn() |
| 66 | except Exception, e: |
| 67 | scheduler.log(fn.func_name) |