Ejemplo n.º 1
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
Ejemplo n.º 2
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
Ejemplo n.º 3
0
class TaskConfiguration(colander.MappingSchema):
    """
        Main fields to be configured
    """
    name = colander.SchemaNode(
        colander.String(),
        title=u"Nom du document",
        description=u"Ce nom n'apparaît pas dans le document final",
        validator=colander.Length(max=255),
        default=deferred_default_name,
        missing="",
        )
    customer_id = colander.SchemaNode(
        colander.Integer(),
        title=u"Choix du client",
        widget=deferred_customer_list,
        validator=deferred_customer_validator
    )
    address = forms.textarea_node(
        title=u"Nom et adresse du client",
        widget_options={'rows': 4}
    )
    workplace = forms.textarea_node(
        title=u"Lieu d'exécution des travaux",
        widget_options={'rows': 3},
        missing=colander.drop,
    )
    mention_ids = colander.SchemaNode(
        colander.Set(),
        title=u"Mentions facultatives",
        description=u"Choisissez les mentions à ajouter au document",
        widget=deferred_mention_select_widget,
        missing=colander.drop,
    )
    phase_id = colander.SchemaNode(
        colander.String(),
        title=u"Phase où insérer le devis",
        widget=deferred_phases_widget,
        default=deferred_default_phase
        )
    date = forms.today_node(title=u"Date du devis")
    description = forms.textarea_node(title=u"Objet du devis")
    course = colander.SchemaNode(
        colander.Integer(),
        title=u"",
        label=deferred_course_title,
        widget=deform.widget.CheckboxWidget(true_val="1", false_val="0"),
        missing=0,
    )
    display_units = colander.SchemaNode(
        colander.Integer(),
        title="",
        label=u"Afficher le détail des prestations dans la sortie PDF ?",
        widget=deform.widget.CheckboxWidget(true_val="1", false_val="0"),
        missing=0,
    )
Ejemplo n.º 4
0
class EstimationPaymentLine(colander.MappingSchema):
    """
        Payment line
    """
    description = colander.SchemaNode(
        colander.String(),
        default=u"Solde",
    )
    paymentDate = forms.today_node()
    amount = colander.SchemaNode(AmountType(), default=0)
Ejemplo n.º 5
0
def add_date_field_after_bind(schema, kw):
    """
    Add a date edition field if the current user has the appropriate rights
    """
    req = kw['request']
    ctx_type = req.context.__name__
    if req.has_permission('set_date.%s' % ctx_type):
        schema.add(today_node(
            default=req.context.date,
            name='date',
        ))
Ejemplo n.º 6
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'},
            ))

    schema.insert(
        0,
        trainer_filter_node_factory(name='trainer_id'),
    )

    if not company:
        schema.insert(
            0,
            participant_filter_node_factory(name='participant_id')
        )
        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(
        name='year',
        query_func=get_invoice_years,
        widget_options={'default_val': (-1, u"Toutes les années")},
        missing=colander.null,
        description=u"Année"
    )
    schema.insert(0, year)

    info_id_1 = colander.SchemaNode (
            colander.Integer(),
            name='info_1_id',
            missing=colander.drop,
            widget=deferred_filter_info1,
        )
    schema.insert(0, info_id_1)

    schema['search'].description = u"Intitulé de l'atelier"
    return schema
Ejemplo n.º 7
0
def add_date_field_after_bind(schema, kw):
    """
    Add a date edition field if the current user has the appropriate rights
    """
    req = kw['request']
    ctx_type = req.context.__name__
    if req.has_permission('set_date.%s' % ctx_type):
        schema.add(
            today_node(
                default=req.context.date,
                name='date',
            )
        )
Ejemplo n.º 8
0
class BaseLineSchema(colander.MappingSchema):
    """
        Base Expenseline schema
    """
    date = forms.today_node(missing=forms.deferred_today)
    category = colander.SchemaNode(colander.String(),
                                   validator=colander.OneOf(('1', '2')))
    description = colander.SchemaNode(colander.String(), missing=u'')
    valid = colander.SchemaNode(colander.Boolean(), missing=False)
    type_id = colander.SchemaNode(
        colander.Integer(),
        validator=deferred_type_id_validator,
    )
Ejemplo n.º 9
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'},
        ))

    schema.insert(
        0,
        trainer_filter_node_factory(name='trainer_id'),
    )

    if not company:
        schema.insert(0,
                      participant_filter_node_factory(name='participant_id'))
        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(
        name='year',
        query_func=get_invoice_years,
        widget_options={'default_val': (-1, u"Toutes les années")},
        missing=colander.null,
        description=u"Année")
    schema.insert(0, year)

    info_id_1 = colander.SchemaNode(
        colander.Integer(),
        name='info_1_id',
        missing=colander.drop,
        widget=deferred_filter_info1,
    )
    schema.insert(0, info_id_1)

    schema['search'].description = u"Intitulé de l'atelier"
    return schema
Ejemplo n.º 10
0
class EditMetadataSchema(colander.MappingSchema):
    """
        Colander schema for moving a task from a phase to another
    """
    name = colander.SchemaNode(
        colander.String(),
        title=u"Nom du document",
        validator=colander.Length(max=255),
        missing="",
    )
    date = forms.today_node(title=u"Date")
    phase_id = colander.SchemaNode(colander.Integer(),
                                   title=u"Phase",
                                   widget=deferred_phase_choice,
                                   validator=deferred_phase_validator)
Ejemplo n.º 11
0
class PaymentSchema(colander.MappingSchema):
    """
        colander schema for payment recording
    """
    come_from = forms.come_from_node()
    bank_remittance_id = colander.SchemaNode(
        colander.String(),
        title=u"Identifiant de la remise en banque",
        description=u"Ce champ est un indicateur permettant de \
retrouver la remise en banque à laquelle cet encaissement est associé",
        default=deferred_bank_remittance_id_default,
    )
    amount = colander.SchemaNode(
        AmountType(5),
        title=u"Montant de l'encaissement",
        validator=deferred_total_validator,
        default=deferred_amount_default,
    )
    date = forms.today_node()
    mode = colander.SchemaNode(
        colander.String(),
        title=u"Mode de paiement",
        widget=deferred_payment_mode_widget,
        validator=deferred_payment_mode_validator,
    )
    bank_id = colander.SchemaNode(
        colander.Integer(),
        title=u"Banque",
        missing=colander.drop,
        widget=deferred_bank_widget,
        validator=deferred_bank_validator,
        default=forms.get_deferred_default(BankAccount),
    )
    tva_id = colander.SchemaNode(colander.Integer(),
                                 title=u"Tva liée à cet encaissement",
                                 widget=forms.get_deferred_select(
                                     Tva, mandatory=True, keys=('id', 'name')),
                                 validator=deferred_tva_id_validator)
    resulted = colander.SchemaNode(
        colander.Boolean(),
        title=u"Soldé",
        description="""Indique que le document est soldé (
ne recevra plus de paiement), si le montant indiqué correspond au
montant de la facture celle-ci est soldée automatiquement""",
        default=False,
    )
Ejemplo n.º 12
0
class MultiplePaymentSchema(colander.MappingSchema):
    """
        colander schema for payment recording
    """
    come_from = forms.come_from_node()
    bank_remittance_id = colander.SchemaNode(
        colander.String(),
        title=u"Identifiant de la remise en banque",
        default=
        deferred_remittance_amount_default,  # FIXME: C'est quoi cette ligne ?
    )
    payment_amount = colander.SchemaNode(
        AmountType(5),
        title=u"Montant du paiement",
        description=u"Ce champ permet de contrôler que la somme des \
encaissements saisis dans ce formulaire correspondent bien au montant du \
paiement.",
        validator=deferred_total_validator,
        default=deferred_amount_default,
    )
    date = forms.today_node(title=u"Date de la remise")
    mode = colander.SchemaNode(
        colander.String(),
        title=u"Mode de paiement",
        widget=deferred_payment_mode_widget,
        validator=deferred_payment_mode_validator,
    )
    bank_id = colander.SchemaNode(
        colander.Integer(),
        title=u"Banque",
        missing=colander.drop,
        widget=deferred_bank_widget,
        default=forms.get_deferred_default(BankAccount),
    )
    tvas = TvaPaymentSequence(title=u'Encaissements par taux de Tva')
    resulted = colander.SchemaNode(
        colander.Boolean(),
        title=u"Soldé",
        description="""Indique que le document est soldé (
ne recevra plus de paiement), si le montant indiqué correspond au
montant de la facture celle-ci est soldée automatiquement""",
        default=False,
    )
Ejemplo n.º 13
0
class ExpensePaymentSchema(colander.MappingSchema):
    """
    Schéma de saisi des paiements des notes de dépense
    """
    come_from = forms.come_from_node()
    amount = colander.SchemaNode(
        AmountType(),
        title=u"Montant du paiement",
        validator=deferred_expense_total_validator,
        default=deferred_amount_default,
    )
    date = forms.today_node()
    mode = colander.SchemaNode(
        colander.String(),
        title=u"Mode de paiement",
        widget=deferred_payment_mode_widget,
        validator=deferred_payment_mode_validator,
    )
    bank_id = colander.SchemaNode(
        colander.Integer(),
        title=u"Banque",
        missing=colander.drop,
        widget=deferred_bank_widget,
        validator=deferred_bank_validator,
        default=forms.get_deferred_default(BankAccount),
    )
    waiver = colander.SchemaNode(
        colander.Boolean(),
        title=u"Abandon de créance",
        description="""Indique que ce paiement correspond à un abandon de
créance à la hauteur du montant indiqué (le Mode de paiement et la Banque sont
alors ignorés)""",
        default=False,
    )
    resulted = colander.SchemaNode(
        colander.Boolean(),
        title=u"Soldé",
        description="""Indique que le document est soldé (
ne recevra plus de paiement), si le montant indiqué correspond au
montant de feuille de notes de dépense celle-ci est soldée automatiquement""",
        default=False,
    )
Ejemplo n.º 14
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
Ejemplo n.º 15
0
class TaskConfiguration(colander.MappingSchema):
    """
        Main fields to be configured
    """
    name = colander.SchemaNode(
        colander.String(),
        title=u"Libellé du document",
        validator=colander.Length(max=255),
        default=deferred_default_name,
        missing="",
    )
    customer_id = colander.SchemaNode(colander.Integer(),
                                      title=u"Choix du client",
                                      widget=deferred_customer_list,
                                      validator=deferred_customer_validator)
    address = forms.textarea_node(title=u"Nom et adresse du client",
                                  widget_options={'rows': 4})
    phase_id = colander.SchemaNode(colander.String(),
                                   title=u"Phase où insérer le devis",
                                   widget=deferred_phases_widget,
                                   default=deferred_default_phase)
    taskDate = forms.today_node(title=u"Date du devis")
    description = forms.textarea_node(title=u"Objet du devis")
    course = colander.SchemaNode(
        colander.Integer(),
        title=u"",
        label=deferred_course_title,
        widget=deform.widget.CheckboxWidget(true_val="1", false_val="0"),
        missing=0,
    )
    display_units = colander.SchemaNode(
        colander.Integer(),
        title="",
        label=u"Afficher le détail des prestations dans la sortie PDF ?",
        widget=deform.widget.CheckboxWidget(true_val="1", false_val="0"),
        missing=0,
    )
Ejemplo n.º 16
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
Ejemplo n.º 17
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, participant_filter_node_factory(name='participant_id'))
        schema.insert(0, conseiller_filter_node_factory(name='conseiller_id'))

    year = forms.year_select_node(
        name='year',
        query_func=get_invoice_years,
        widget_options={'default_val': (-1, u"Toutes les années")},
        missing=colander.null,
        description=u"Année"
    )
    schema.insert(0, year)

    del schema['search']
    return schema
Ejemplo n.º 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,
                      participant_filter_node_factory(name='participant_id'))
        schema.insert(0, conseiller_filter_node_factory(name='conseiller_id'))

    year = forms.year_select_node(
        name='year',
        query_func=get_invoice_years,
        widget_options={'default_val': (-1, u"Toutes les années")},
        missing=colander.null,
        description=u"Année")
    schema.insert(0, year)

    del schema['search']
    return schema
Ejemplo n.º 19
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