'Prepare the context used when evaluating python code, like the
condition or code server actions.
:param action: the current server action
:type action: browse record
:returns: dict -- evaluation context given to (safe_)safe_eval'

@api.model
def _get_eval_context(self, action=None):

    def log(message, level='info'):
        with self.pool.cursor() as cr:
            cr.execute("\n                                                                                INSERT    INTO    ir_logging(create_date,    create_uid,    type,    dbname,    name,    level,    message,    path,    line,    func)\n                                                                                VALUES    (NOW()    at    time    zone    'UTC',    %s,    %s,    %s,    %s,    %s,    %s,    %s,    %s,    %s)\n                                                                ", (self.env.uid, 'server', self._cr.dbname, __name__, level, message, 'action', action.id, action.name))
    eval_context = super(IrActionsServer, self)._get_eval_context(action=action)
    model = self.env[action.model_id.model]
    record = None
    records = None
    if ((self._context.get('active_model') == action.model_id.model) and self._context.get('active_id')):
        record = model.browse(self._context['active_id'])
    if ((self._context.get('active_model') == action.model_id.model) and self._context.get('active_ids')):
        records = model.browse(self._context['active_ids'])
    if self._context.get('onchange_self'):
        record = self._context['onchange_self']
    eval_context.update({'env': self.env, 'model': model, 'Warning': odoo.exceptions.Warning, 'record': record, 'records': records, 'workflow': workflow, 'object': record, 'obj': record, 'pool': self.pool, 'cr': self._cr, 'context': self._context, 'user': self.env.user, 'log': log})
    return eval_context
