Esempio n. 1
0
	def on_update(self):
		"""
			Sets or cancels the event in the scheduler
		"""
		if cint(self.doc.integrate_incoming):
			from webnotes.utils.scheduler import set_event
			set_event('maintenance.doctype.support_ticket.get_support_mails', 60*5, 1)
		else:
			from webnotes.utils.scheduler import cancel_event
			cancel_event('maintenance.doctype.support_ticket.get_support_mails')
			
    def manage_scheduler(self):
        """ set/cancel event in scheduler """
        event = "accounts.doctype.gl_control.gl_control.manage_recurring_invoices"

        if webnotes.conn.sql(
            "select name from `tabReceivable Voucher` where ifnull(convert_into_recurring_invoice, 0) = 1 and next_date <= end_date"
        ):
            if not self.check_event_exists(event):
                set_event(event, interval=60 * 60, recurring=1)
        else:
            cancel_event(event)
	def on_update(self):
		"""
			Sets or cancels the event in the scheduler
		"""
		# update control panel
		for f in ('outgoing_mail_server', 'mail_login', 'mail_password', 'auto_email_id', 'mail_port', 'use_ssl'):
			self.set_cp_value(f)

		# setup scheduler for support emails
		if cint(self.doc.sync_support_mails):
			if not (self.doc.support_host and self.doc.support_username and self.doc.support_password):
				webnotes.msgprint("You must give the incoming POP3 settings for support emails to activiate mailbox integration", raise_exception=1)
			
			from webnotes.utils.scheduler import set_event
			set_event('support.doctype.support_ticket.get_support_mails', 60*5, 1)
		else:
			from webnotes.utils.scheduler import cancel_event
			cancel_event('support.doctype.support_ticket.get_support_mails')