Ejemplo n.º 1
0
 def last_closed_event(self):
     query = Activity.query().options(
         orm.load_only('action', 'datetime', 'id'))
     query = self.filter_participant(query, None)
     query = query.filter_by(status='closed')
     query = query.order_by(desc(Activity.datetime))
     return query.first()
Ejemplo n.º 2
0
 def last_closed_event(self):
     query = Activity.query().options(
         orm.load_only('action', 'datetime', 'id'))
     query = self.filter_participant(query, None)
     query = query.filter_by(status='closed')
     query = query.order_by(desc(Activity.datetime))
     last = query.first()
     if last is not None:
         if not last.action.strip():
             last = None
     return last
Ejemplo n.º 3
0
 def last_closed_event(self):
     query = Activity.query().options(
         orm.load_only('action', 'datetime', 'id')
     )
     query = self.filter_participant(query, None)
     query = query.filter_by(status='closed')
     query = query.order_by(desc(Activity.datetime))
     last = query.first()
     if last is not None:
         if not last.action.strip():
             last = None
     return last
Ejemplo n.º 4
0
def manage(request):
    """
        The manage view
    """
    query = Estimation.query()
    query = query.join(Estimation.phase)
    query = query.filter(
        and_(
            Estimation.CAEStatus == 'wait',
            Phase.name is not None
        )
    )
    estimations = query.order_by(Task.statusDate).all()
    for item in estimations:
        item.url = request.route_path(item.type_, id=item.id)

    invoices = Task.query()\
            .filter(Task.type_.in_(('invoice', 'cancelinvoice',)))\
            .join(Task.phase)\
            .filter(and_(Task.CAEStatus == 'wait', Phase.name is not None))\
            .order_by(Task.type_).order_by(Task.statusDate).all()

    for item in invoices:
        item.url = request.route_path(item.type_, id=item.id)

    expenses = ExpenseSheet.query()\
        .filter(ExpenseSheet.status == 'wait')\
        .order_by(ExpenseSheet.month)\
        .order_by(ExpenseSheet.status_date).all()
    for expense in expenses:
        expense.url = request.route_path("expensesheet", id=expense.id)


    user_id = request.user.id
    query = Activity.query()
    query = query.join(Activity.conseillers)
    query = query.filter(
        Activity.conseillers.any(User.id==user_id)
    )
    query = query.filter(Activity.status=='planned')
    query = query.order_by(Activity.datetime).limit(10)
    activities = query.all()

    for activity in activities:
        activity.url = request.route_path("activity", id=activity.id)

    return dict(title=u"Documents en attente de validation",
                invoices=invoices,
                estimations=estimations,
                expenses = expenses,
                activities=activities)
Ejemplo n.º 5
0
def manage(request):
    """
        The manage view
    """
    query = Estimation.query()
    query = query.join(Estimation.phase)
    query = query.filter(
        and_(Estimation.CAEStatus == 'wait', Phase.name is not None))
    estimations = query.order_by(Task.statusDate).all()
    for item in estimations:
        item.url = request.route_path(item.type_, id=item.id)

    invoices = Task.query()\
            .filter(Task.type_.in_(('invoice', 'cancelinvoice',)))\
            .join(Task.phase)\
            .filter(and_(Task.CAEStatus == 'wait', Phase.name is not None))\
            .order_by(Task.type_).order_by(Task.statusDate).all()

    for item in invoices:
        item.url = request.route_path(item.type_, id=item.id)

    expenses = ExpenseSheet.query()\
            .filter(ExpenseSheet.status == 'wait')\
            .order_by(ExpenseSheet.month).all()
    for expense in expenses:
        expense.url = request.route_path("expensesheet", id=expense.id)

    user_id = request.user.id
    query = Activity.query()
    query = query.join(Activity.conseillers)
    query = query.filter(Activity.conseillers.any(User.id == user_id))
    query = query.filter(Activity.status == 'planned')
    query = query.order_by(Activity.datetime).limit(10)
    activities = query.all()

    for activity in activities:
        activity.url = request.route_path("activity", id=activity.id)

    return dict(title=u"Documents en attente de validation",
                invoices=invoices,
                estimations=estimations,
                expenses=expenses,
                activities=activities)
Ejemplo n.º 6
0
def manage(request):
    """
    The manage view
    """
    estimations = Task.get_waiting_estimations().all()

    invoices = Task.get_waiting_invoices().all()

    for item in estimations:
        item.url = request.route_path(item.type_, id=item.id)

    for item in invoices:
        item.url = request.route_path(item.type_, id=item.id)

    expenses = ExpenseSheet.query()\
        .filter(ExpenseSheet.status == 'wait')\
        .order_by(ExpenseSheet.month)\
        .order_by(ExpenseSheet.status_date).all()
    for expense in expenses:
        expense.url = request.route_path("expensesheet", id=expense.id)

    user_id = request.user.id
    query = Activity.query()
    query = query.join(Activity.conseillers)
    query = query.filter(
        Activity.conseillers.any(User.id == user_id)
    )
    query = query.filter(Activity.status == 'planned')
    query = query.order_by(Activity.datetime).limit(10)
    activities = query.all()

    for activity in activities:
        activity.url = request.route_path("activity", id=activity.id)

    return dict(
        title=u"Documents en attente de validation",
        invoices=invoices,
        estimations=estimations,
        expenses=expenses,
        activities=activities,
    )
Ejemplo n.º 7
0
 def query(self):
     query = Activity.query()
     return query
Ejemplo n.º 8
0
def query():
    return Activity.query().first()
Ejemplo n.º 9
0
 def query(self):
     query = Activity.query()
     return query
Ejemplo n.º 10
0
def query():
    return Activity.query().first()