Beispiel #1
0
def get_list_schema(is_admin=False):
    schema = lists.BaseListsSchema().clone()

    schema.insert(
        0,
        colander.SchemaNode(
            colander.Integer(),
            name="type_id",
            widget=get_deferred_select_type(True),
            validator=deferred_type_validator,
            missing=colander.drop,
        ),
    )

    schema.insert(
        0,
        colander.SchemaNode(
            colander.String(),
            name="status",
            widget=deform.widget.SelectWidget(values=STATUS_SEARCH),
            validator=colander.OneOf([s[0] for s in STATUS_SEARCH]),
            missing=colander.drop,
        ),
    )

    schema.insert(
        0,
        colander.SchemaNode(
            colander.String(),
            name="user_status",
            widget=deform.widget.SelectWidget(values=ATTENDANCE_STATUS_SEARCH),
            validator=colander.OneOf([s[0] for s in ATTENDANCE_STATUS_SEARCH]),
            missing=colander.drop,
        ),
    )

    if is_admin:
        schema.insert(
            0,
            user.user_node(
                missing=colander.drop,
                name="participant_id",
                widget_options={"default_option": ("", u"- Sélectionner un participant -")},
            ),
        )

        schema.insert(
            0,
            user.user_node(
                roles=["manager", "admin"],
                missing=colander.drop,
                name="conseiller_id",
                widget_options={"default_option": ("", u"- Sélectionner un conseiller -")},
            ),
        )

    del schema["search"]
    return schema
Beispiel #2
0
def get_list_schema(is_admin=False):
    schema = lists.BaseListsSchema().clone()

    schema.insert(
        0,
        colander.SchemaNode(colander.Integer(),
                            name='type_id',
                            widget=get_deferred_select_type(True),
                            validator=deferred_type_validator,
                            missing=colander.drop))

    schema.insert(
        0,
        colander.SchemaNode(
            colander.String(),
            name='status',
            widget=deform.widget.SelectWidget(values=STATUS_SEARCH),
            validator=colander.OneOf([s[0] for s in STATUS_SEARCH]),
            missing=colander.drop))

    schema.insert(
        0,
        colander.SchemaNode(
            colander.String(),
            name='user_status',
            widget=deform.widget.SelectWidget(values=ATTENDANCE_STATUS_SEARCH),
            validator=colander.OneOf([s[0] for s in ATTENDANCE_STATUS_SEARCH]),
            missing=colander.drop))

    if is_admin:
        schema.insert(
            0,
            user.user_node(missing=colander.drop,
                           name='participant_id',
                           widget_options={
                               'default_option':
                               ("", u"- Sélectionner un participant -"),
                           }))

        schema.insert(
            0,
            user.user_node(roles=['manager', 'admin'],
                           missing=colander.drop,
                           name='conseiller_id',
                           widget_options={
                               'default_option':
                               ("", u"- Sélectionner un conseiller -"),
                           }))

    del schema['search']
    return schema
Beispiel #3
0
def get_userdatas_list_schema():
    """
    Return a list schema for user datas
    """
    schema = forms.lists.BaseListsSchema().clone()

    schema['search'].description = u"Nom, prénom, entreprise"

    schema.insert(
        0,
        colander.SchemaNode(
            colander.Integer(),
            name='situation_situation',
            widget=deferred_situation_select,
            validator=deferred_situation_id_validator,
            missing=colander.drop,
        ))

    schema.insert(
        0,
        user.user_node(
            roles=['manager', 'admin'],
            missing=-1,
            default=forms.deferred_current_user_id,
            name='situation_follower_id',
            widget_options={
                'default_option': (-1, ''),
                'placeholder': u"Sélectionner un conseiller"
            },
        ))
    return schema
Beispiel #4
0
class _CompetenceGridQuerySchema(colander.Schema):
    contractor_id = user_node(roles=['contractor'])
    deadline = colander.SchemaNode(
        colander.Integer(),
        validator=deferred_deadline_id_validator,
        missing=colander.drop,
    )
Beispiel #5
0
def get_userdatas_list_schema():
    """
    Return a list schema for user datas
    """
    schema = forms.lists.BaseListsSchema().clone()

    schema['search'].description = u"Nom, prénom, entreprise"

    schema.insert(0, colander.SchemaNode(
        colander.Integer(),
        name='situation_situation',
        widget=deferred_situation_select,
        validator=deferred_situation_id_validator,
        missing=colander.drop,
    )
    )

    schema.insert(
        0,
        user.user_node(
            roles=['manager', 'admin'],
            missing=-1,
            default=forms.deferred_current_user_id,
            name='situation_follower_id',
            widget_options={
                'default_option': (-1, ''),
                'placeholder': u"Sélectionner un conseiller"},
        )
    )
    return schema
Beispiel #6
0
def get_list_schema():
    schema = forms.lists.BaseListsSchema().clone()

    schema["search"].description = u"Identifiant du document"

    schema.insert(
        0,
        colander.SchemaNode(
            colander.String(),
            name=u"status",
            widget=deform.widget.SelectWidget(values=STATUS_OPTIONS),
            validator=colander.OneOf([s[0] for s in STATUS_OPTIONS]),
            missing="all",
        ),
    )

    schema.insert(0, forms.year_select_node(name="year", title=u"Année", query_func=get_expense_years))

    schema.insert(
        0, forms.month_select_node(title=u"Mois", missing=-1, name="month", widget_options={"default_val": (-1, "")})
    )

    schema.insert(
        0,
        user.user_node(
            title=u"Utilisateur",
            missing=-1,
            name=u"owner_id",
            widget_options={"default_option": (-1, ""), "placeholder": u"Sélectionner un entrepreneur"},
        ),
    )

    return schema
Beispiel #7
0
def get_list_schema(company=False):
    """
    Return a schema for filtering workshop list
    """
    schema = lists.BaseListsSchema().clone()

    schema.insert(0,
        forms.today_node(
            name='date',
            default=colander.null,
            missing=colander.drop,
            description=u"Date de l'atelier",
            widget_options={'css_class': 'input-medium search-query'},
            ))

    if not company:
        schema.insert(0, user.user_node(
            missing=colander.drop,
            name='participant_id',
            widget_options={
                'default_option': ('', u"- Sélectionner un participant -"),
                }
        ))

    schema['search'].description = u"Intitulé de l'atelier"
    return schema
Beispiel #8
0
def get_list_schema(company=False):
    """
    Return a schema for filtering workshop list
    """
    schema = lists.BaseListsSchema().clone()

    schema.insert(
        0,
        forms.today_node(
            name='date',
            default=colander.null,
            missing=colander.drop,
            description=u"Date de l'atelier",
            widget_options={'css_class': 'input-medium search-query'},
        ))

    if not company:
        schema.insert(
            0,
            user.user_node(missing=colander.drop,
                           name='participant_id',
                           widget_options={
                               'default_option':
                               ('', u"- Sélectionner un participant -"),
                           }))

    schema['search'].description = u"Intitulé de l'atelier"
    return schema
Beispiel #9
0
def get_list_schema(is_admin=False):
    schema = forms.lists.BaseListsSchema().clone()

    schema.insert(0, colander.SchemaNode(
        colander.Integer(),
        name='type_id',
        widget=get_deferred_select_type(True),
        validator=deferred_type_validator,
        missing=colander.drop))

    schema.insert(0, colander.SchemaNode(
        colander.String(),
        name='status',
        widget=deform.widget.SelectWidget(values=STATUS_SEARCH),
        validator=colander.OneOf([s[0] for s in STATUS_SEARCH]),
        missing=colander.drop))

    schema.insert(0, colander.SchemaNode(
        colander.String(),
        name='user_status',
        widget=deform.widget.SelectWidget(values=ATTENDANCE_STATUS_SEARCH),
        validator=colander.OneOf([s[0] for s in ATTENDANCE_STATUS_SEARCH]),
        missing=colander.drop))


    if is_admin:
        schema.insert(0, user.user_node(
            missing=colander.drop,
            name='participant_id',
            widget_options={
                'default_option': ("", u"- Sélectionner un participant -"),
            }
            )
        )

        schema.insert(0, user.user_node(
            roles=['manager', 'admin'],
            missing=colander.drop,
            name='conseiller_id',
            widget_options={
                'default_option': ("", u"- Sélectionner un conseiller -"),
            }
            )
        )

    del schema['search']
    return schema
Beispiel #10
0
class ConseillerSequence(colander.SequenceSchema):
    """
    Schema for the list of conseiller
    """
    conseiller_id = user.user_node(
        title=u"un conseiller",
        roles=['manager', 'admin'],
    )
Beispiel #11
0
class ExpenseSchema(colander.MappingSchema):
    """
    Schema for sage expense export
    """
    user_id = user.user_node(title=u"Nom de l'entrepreneur",
        widget_options={'default_option':(u'0', u'Tous les entrepreneurs',)})
    year = forms.year_select_node(title=u"Année", query_func=get_expense_years)
    month = forms.month_select_node(title=u"Mois")
    exported = EXPORTEDFIELD
Beispiel #12
0
def get_list_schema():
    from autonomie.models.expense.sheet import get_expense_years

    schema = forms.lists.BaseListsSchema().clone()

    schema['search'].description = u"Identifiant du document"

    schema.insert(
        0,
        colander.SchemaNode(
            colander.String(),
            name=u'status',
            widget=deform.widget.SelectWidget(values=STATUS_OPTIONS),
            validator=colander.OneOf([s[0] for s in STATUS_OPTIONS]),
            missing='all',
            default='all',
        ))

    schema.insert(
        0,
        forms.year_select_node(
            name='year',
            title=u"Année",
            query_func=get_expense_years,
        ))

    schema.insert(
        0,
        forms.month_select_node(
            title=u"Mois",
            missing=-1,
            default=-1,
            name='month',
            widget_options={'default_val': (-1, '')},
        ))

    schema.insert(
        0,
        user.user_node(
            title=u"Utilisateur",
            missing=colander.drop,
            name=u'owner_id',
            widget_options={
                'default_option': ('', u'Tous les entrepreneurs'),
                'placeholder': u"Sélectionner un entrepreneur"
            },
        ))

    return schema
Beispiel #13
0
def get_list_schema(company=False):
    """
    Return a schema for filtering workshop list
    """
    schema = lists.BaseListsSchema().clone()

    schema.insert(
        0,
        forms.today_node(
            name='date',
            default=colander.null,
            missing=colander.drop,
            description=u"Date de l'atelier",
            widget_options={'css_class': 'input-medium search-query'},
            ))

    if not company:
        schema.insert(0, user.user_node(
            missing=colander.drop,
            name='participant_id',
            widget_options={
                'default_option': ('', u"- Sélectionner un participant -"),
                }
        ))
        notfilled_node = colander.SchemaNode(
            colander.Boolean(),
            name='notfilled',
            title="",
            description=u"N'afficher que les ateliers non renseignés",
            missing=colander.drop,
        )
        schema.insert(1, notfilled_node)
    year = forms.year_select_node(get_invoice_years)
    year.name = 'year'
    schema.insert(0, year)

    schema['search'].description = u"Intitulé de l'atelier"
    return schema
Beispiel #14
0
def get_list_schema():
    schema = forms.lists.BaseListsSchema().clone()

    schema['search'].description = u"Identifiant du document"

    schema.insert(0, colander.SchemaNode(
        colander.String(),
        name=u'status',
        widget=deform.widget.SelectWidget(values=STATUS_OPTIONS),
        validator=colander.OneOf([s[0] for s in STATUS_OPTIONS]),
        missing='all',
    ))

    schema.insert(0, forms.year_select_node(
        name='year',
        title=u"Année",
        query_func=get_expense_years,
    ))

    schema.insert(0, forms.month_select_node(
        title=u"Mois",
        missing=-1,
        name='month',
        widget_options={'default_val': (-1, '')},
    ))

    schema.insert(0, user.user_node(
        title=u"Utilisateur",
        missing=-1,
        name=u'owner_id',
        widget_options={
            'default_option': (-1, ''),
            'placeholder': u"Sélectionner un entrepreneur"},
    ))

    return schema
Beispiel #15
0
def get_list_schema(is_admin=False):
    schema = lists.BaseListsSchema().clone()

    schema.insert(
        0,
        forms.today_node(
            name="date_range_end",
            default=colander.null,
            missing=colander.drop,
            description=u"Et le",
            widget_options={'css_class': 'input-medium search-query'},
        )
    )

    schema.insert(
        0,
        forms.today_node(
            name="date_range_start",
            default=colander.null,
            missing=colander.drop,
            description=u"Entre le",
            widget_options={'css_class': 'input-medium search-query'},
        )
    )

    schema.insert(0, colander.SchemaNode(
        colander.Integer(),
        name='type_id',
        widget=get_deferred_select_type(True),
        validator=deferred_type_validator,
        missing=colander.drop))

    schema.insert(0, colander.SchemaNode(
        colander.String(),
        name='status',
        widget=deform.widget.SelectWidget(values=STATUS_SEARCH),
        validator=colander.OneOf([s[0] for s in STATUS_SEARCH]),
        missing=colander.drop))

    schema.insert(0, colander.SchemaNode(
        colander.String(),
        name='user_status',
        widget=deform.widget.SelectWidget(values=ATTENDANCE_STATUS_SEARCH),
        validator=colander.OneOf([s[0] for s in ATTENDANCE_STATUS_SEARCH]),
        missing=colander.drop))

    if is_admin:
        schema.insert(0, user.user_node(
            missing=colander.drop,
            name='participant_id',
            widget_options={
                'default_option': ("", u"- Sélectionner un participant -"),
            }
            )
        )

        schema.insert(0, user.user_node(
            roles=['manager', 'admin'],
            missing=colander.drop,
            name='conseiller_id',
            widget_options={
                'default_option': ("", u"- Sélectionner un conseiller -"),
            }
            )
        )
    year = forms.year_select_node(get_invoice_years)
    year.name = 'year'
    schema.insert(0, year)

    del schema['search']
    return schema
Beispiel #16
0
class SearchHolidaysSchema(colander.MappingSchema):
    start_date = colander.SchemaNode(colander.Date(), title=u"Date de début")
    end_date = colander.SchemaNode(colander.Date(), title=u"Date de fin")
    user_id = user.user_node(title=u"Entrepreneur",
                             missing=colander.drop,
                             widget_options={'default_option': ('', u"Tous")})
Beispiel #17
0
class ParticipantsSequence(colander.SequenceSchema):
    """
    Schema for the list of participants
    """
    participant_id = user.user_node(title=u"un participant", )
Beispiel #18
0
def get_list_schema(is_admin=False):
    schema = lists.BaseListsSchema().clone()

    schema.insert(
        0,
        forms.today_node(
            name="date_range_end",
            default=colander.null,
            missing=colander.drop,
            description=u"Et le",
            widget_options={'css_class': 'input-medium search-query'},
        )
    )

    schema.insert(
        0,
        forms.today_node(
            name="date_range_start",
            default=colander.null,
            missing=colander.drop,
            description=u"Entre le",
            widget_options={'css_class': 'input-medium search-query'},
        )
    )

    schema.insert(0, colander.SchemaNode(
        colander.Integer(),
        name='type_id',
        widget=get_deferred_select_type(True),
        validator=deferred_type_validator,
        missing=colander.drop))

    schema.insert(0, colander.SchemaNode(
        colander.String(),
        name='status',
        widget=deform.widget.SelectWidget(values=STATUS_SEARCH),
        validator=colander.OneOf([s[0] for s in STATUS_SEARCH]),
        missing=colander.drop))

    schema.insert(0, colander.SchemaNode(
        colander.String(),
        name='user_status',
        widget=deform.widget.SelectWidget(values=ATTENDANCE_STATUS_SEARCH),
        validator=colander.OneOf([s[0] for s in ATTENDANCE_STATUS_SEARCH]),
        missing=colander.drop))

    if is_admin:
        schema.insert(0, user.user_node(
            missing=colander.drop,
            name='participant_id',
            widget_options={
                'default_option': ("", u"- Sélectionner un participant -"),
            }
            )
        )

        schema.insert(0, user.user_node(
            roles=['manager', 'admin'],
            missing=colander.drop,
            name='conseiller_id',
            widget_options={
                'default_option': ("", u"- Sélectionner un conseiller -"),
            }
            )
        )
    year = forms.year_select_node(get_invoice_years)
    year.name = 'year'
    schema.insert(0, year)

    del schema['search']
    return schema