def available_reports(user=None): if user is None: user = g.user query = ExpenseReport.query.order_by('datetime') if 'reviewer' in lastuser.permissions(): # Get all reports owned by this user and in states where the user can review them query = ExpenseReport.query.filter(db.or_( ExpenseReport.user == user, ExpenseReport.status.in_(ExpenseReportWorkflow.reviewable.values))) else: query = ExpenseReport.query.filter_by(user=user) return query
def reports(): # Sort reports by status query = ExpenseReport.query.order_by('updated_at') if 'reviewer' in lastuser.permissions(): # Get all reports owned by this user and in states where the user can review them query = ExpenseReport.query.filter(db.or_( ExpenseReport.user == g.user, ExpenseReport.status.in_(ExpenseReportWorkflow.reviewable.value))) else: query = ExpenseReport.query.filter_by(user=g.user) reports = ExpenseReportWorkflow.sort_documents(query.order_by('updated_at').all()) return render_template('reports.html', reports=reports)
def available_reports(workspace, user=None, all=False): if user is None: user = g.user query = ExpenseReport.query.filter_by(workspace=workspace).order_by('datetime') # FIXME+TODO: Replace with per-workspace permissions if all and 'review' in g.permissions: # Get all reports owned by this user and in states where the user can review them query = query.filter(db.or_( ExpenseReport.user == user, ExpenseReport.status.in_(ExpenseReportWorkflow.reviewable.values))) else: query = query.filter_by(user=user) return query
def reports(): # Sort reports by status query = ExpenseReport.query.order_by('updated_at') if 'reviewer' in lastuser.permissions(): # Get all reports owned by this user and in states where the user can review them query = ExpenseReport.query.filter( db.or_( ExpenseReport.user == g.user, ExpenseReport.status.in_( ExpenseReportWorkflow.reviewable.value))) else: query = ExpenseReport.query.filter_by(user=g.user) reports = ExpenseReportWorkflow.sort_documents( query.order_by('updated_at').all()) return render_template('reports.html', reports=reports)
def available_reports(workspace, user=None, all=False): if user is None: user = g.user query = ExpenseReport.query.filter_by( workspace=workspace).order_by('datetime') # FIXME+TODO: Replace with per-workspace permissions if all and 'review' in g.permissions: # Get all reports owned by this user and in states where the user can review them query = query.filter( db.or_( ExpenseReport.user == user, ExpenseReport.status.in_( ExpenseReportWorkflow.reviewable.values))) else: query = query.filter_by(user=user) return query