Example #1
0
 def submit_success(self, appstruct):
     """
         handle successfull payment mode configuration
     """
     for mode in PaymentMode.query():
         self.dbsession.delete(mode)
     for data in appstruct['paymentmodes']:
         mode = PaymentMode(label=data)
         self.dbsession.add(mode)
     self.request.session.flash(self.validation_msg)
     return HTTPFound(self.request.route_path("admin_paymentmode"))
Example #2
0
 def before(self, form):
     """
         Add appstruct to the current form object
     """
     appstruct = [mode.label for mode in PaymentMode.query()]
     form.set_appstruct({'paymentmodes': appstruct})
     populate_actionmenu(self.request)
Example #3
0
 def before(self, form):
     """
         Add appstruct to the current form object
     """
     appstruct = [mode.label for mode in PaymentMode.query()]
     form.set_appstruct({'paymentmodes':appstruct})
     populate_actionmenu(self.request)
Example #4
0
 def submit_success(self, appstruct):
     """
         handle successfull payment mode configuration
     """
     for mode in PaymentMode.query():
         self.dbsession.delete(mode)
     for data in appstruct['paymentmodes']:
         mode = PaymentMode(label=data)
         self.dbsession.add(mode)
     self.request.session.flash(self.validation_msg)
     return HTTPFound(self.request.route_path("admin_paymentmode"))
def downgrade():
    for p in PaymentMode.query():
        DBSESSION().delete(p)
    for p in Payment.query():
        if p.mode == u"par chèque":
            p.mode = u"cheque"
        elif p.mode == u"par virement":
            p.mode = u"virement"
        elif p.mode == u"en liquide":
            p.mode = u"liquide"
        else:
            p.mode = "inconnu"
        DBSESSION().merge(p)
def downgrade():
    for p in PaymentMode.query():
        DBSESSION().delete(p)
    for p in Payment.query():
        if p.mode == u"par chèque":
            p.mode = u"cheque"
        elif p.mode == u"par virement":
            p.mode = u"virement"
        elif p.mode == u"en liquide":
            p.mode = u"liquide"
        else:
            p.mode = "inconnu"
        DBSESSION().merge(p)
Example #7
0
def downgrade():
    from autonomie.models.task.invoice import PaymentMode, Payment
    for p in PaymentMode.query():
        DBSESSION().delete(p)
    for p in Payment.query():
        if p.mode == u"par chèque":
            p.mode = u"cheque"
        elif p.mode == u"par virement":
            p.mode = u"virement"
        elif p.mode == u"en liquide":
            p.mode = u"liquide"
        else:
            p.mode = "inconnu"
        DBSESSION().merge(p)
def upgrade():
    for payment in Payment.query():
        if payment.mode in (u"cheque", u"CHEQUE"):
            payment.mode = u"par chèque"
        elif payment.mode in (u"virement", u"VIREMENT"):
            payment.mode = u"par virement"
        elif payment.mode in (u"liquide", u"LIQUIDE"):
            payment.mode = u"en liquide"
        else:
            payment.mode = "mode de paiement inconnu"
        DBSESSION().merge(payment)

    for mode in (u"par chèque", u"par virement", u"en liquide"):
        pmode = PaymentMode(label=mode)
        DBSESSION().add(pmode)
Example #9
0
def add_payment_mode(label):
    p = PaymentMode(label=label)
    session = DBSESSION()
    session.add(p)
    session.flush()
Example #10
0
def deferred_payment_mode_validator(node, kw):
    return colander.OneOf([mode.label for mode in PaymentMode.query()])
Example #11
0
def deferred_payment_mode_widget(node, kw):
    """
        dynamically retrieves the payment modes
    """
    modes = [(mode.label, mode.label) for mode in PaymentMode.query()]
    return deform.widget.SelectWidget(values=modes)
Example #12
0
def mode(dbsession):
    from autonomie.models.task.invoice import PaymentMode
    mode = PaymentMode(label=u"Chèque")
    dbsession.add(mode)
    dbsession.flush()
    return mode
Example #13
0
def deferred_payment_mode_validator(node, kw):
    return colander.OneOf([mode.label for mode in PaymentMode.query()])
Example #14
0
def deferred_payment_mode_widget(node, kw):
    """
        dynamically retrieves the payment modes
    """
    modes = [(mode.label, mode.label) for mode in PaymentMode.query()]
    return deform.widget.SelectWidget(values=modes)