'This Function is called by scheduler.'

@api.model
def _check(self, automatic=False, use_new_cursor=False):

    if ('__action_done' not in self._context):
        self = self.with_context(__action_done={})
    eval_context = self._get_eval_context()
    for action in self.with_context(active_test=True).search([('kind', '=', 'on_time')]):
        last_run = (fields.Datetime.from_string(action.last_run) or datetime.datetime.utcfromtimestamp(0))
        domain = []
        context = dict(self._context)
        if action.filter_domain:
            domain = safe_eval(action.filter_domain, eval_context)
        elif action.filter_id:
            domain = safe_eval(action.filter_id.domain, eval_context)
            context.update(safe_eval(action.filter_id.context))
            if ('lang' not in context):
                filter_meta = action.filter_id.get_metadata()[0]
                user_id = (filter_meta['write_uid'] or filter_meta['create_uid'])[0]
                context['lang'] = self.env['res.users'].browse(user_id).lang
        records = self.env[action.model].with_context(context).search(domain)
        if ((action.trg_date_id.name == 'date_action_last') and ('create_date' in records._fields)):
            get_record_dt = (lambda record: (record[action.trg_date_id.name] or record.create_date))
        else:
            get_record_dt = (lambda record: record[action.trg_date_id.name])
        now = datetime.datetime.now()
        for record in records:
            record_dt = get_record_dt(record)
            if (not record_dt):
                continue
            action_dt = self._check_delay(action, record, record_dt)
            if (last_run <= action_dt < now):
                try:
                    action._process(record)
                except Exception:
                    _logger.error(traceback.format_exc())
        action.write({'last_run': fields.Datetime.now()})
        if automatic:
            self._cr.commit()
