def sidebarvars(): return { 'categories': Category.query.order_by('title').all(), 'budgets': Budget.query.order_by('title').all(), 'report_states': ExpenseReportWorkflow.states(), 'permissions': lastuser.permissions(), }
def sidebarvars(): if g.user: # TODO: Need more advanced access control org_ids = g.user.organizations_memberof_ids() else: org_ids = [] if org_ids: workspaces = Workspace.query.filter( Workspace.userid.in_(org_ids)).order_by('title').all() else: workspaces = [] if hasattr(g, 'workspace'): return { 'workspaces': workspaces, 'categories': Category.query.filter_by( workspace=g.workspace).order_by('title').all(), 'budgets': Budget.query.filter_by( workspace=g.workspace).order_by('title').all(), 'report_states': ExpenseReportWorkflow.states(), } else: return { 'workspaces': workspaces, }
def budget(workspace, budget): unsorted_reports = available_reports(workspace).filter_by(budget=budget).all() if unsorted_reports: noreports = False else: noreports = True reports = ExpenseReportWorkflow.sort_documents(unsorted_reports) return render_template('budget.html', budget=budget, reports=reports, noreports=noreports)
def budget(name): budget = Budget.query.filter_by(name=name).first_or_404() unsorted_reports = available_reports().filter_by(budget=budget).all() if unsorted_reports: noreports = False else: noreports = True reports = ExpenseReportWorkflow.sort_documents(unsorted_reports) return render_template('budget.html', budget=budget, reports=reports, noreports=noreports)
def budget(workspace, budget): unsorted_reports = available_reports(workspace).filter_by( budget=budget).all() if unsorted_reports: noreports = False else: noreports = True reports = ExpenseReportWorkflow.sort_documents(unsorted_reports) return render_template('budget.html', budget=budget, reports=reports, noreports=noreports)
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 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 sidebarvars(): if g.user: # TODO: Need more advanced access control org_ids = g.user.organizations_memberof_ids() else: org_ids = [] workspaces = Workspace.query.filter(Workspace.userid.in_(org_ids)).order_by('title').all() if hasattr(g, 'workspace'): return { 'workspaces': workspaces, 'categories': Category.query.filter_by(workspace=g.workspace).order_by('title').all(), 'budgets': Budget.query.filter_by(workspace=g.workspace).order_by('title').all(), 'report_states': ExpenseReportWorkflow.states(), } else: return { 'workspaces': workspaces, }
def reports(): # Sort reports by status reports = ExpenseReportWorkflow.sort_documents(available_reports().all()) return render_template('reports.html', reports=reports, reportspage=True)
def reports_all(workspace): # Sort reports by status reports = ExpenseReportWorkflow.sort_documents( available_reports(workspace, all=True).all()) return render_template('reports.html', reports=reports)
def reports_all(workspace): # Sort reports by status reports = ExpenseReportWorkflow.sort_documents(available_reports(workspace, all=True).all()) return render_template('reports.html', reports=reports)