Пример #1
0
 def before(self, form):
     """
         Add appstruct to the current form object
     """
     appstruct = [mode.label for mode in WorkUnit.query()]
     form.set_appstruct({'workunits': appstruct})
     populate_actionmenu(self.request)
Пример #2
0
 def before(self, form):
     """
         Add appstruct to the current form object
     """
     appstruct = [mode.label for mode in WorkUnit.query()]
     form.set_appstruct({'workunits':appstruct})
     populate_actionmenu(self.request)
Пример #3
0
def downgrade():
    for factory in (EstimationLine, InvoiceLine, CancelInvoiceLine):
        for line in factory.query():
            line.unity = translate_inverse(line.unity)
            DBSESSION().merge(line)
    for value in WorkUnit.query():
        DBSESSION().delete(value)
def downgrade():
    for factory in (EstimationLine, InvoiceLine, CancelInvoiceLine):
        for line in factory.query():
            line.unity = translate_inverse(line.unity)
            DBSESSION().merge(line)
    for value in WorkUnit.query():
        DBSESSION().delete(value)
Пример #5
0
def company_products_options_ajax_view(context, request):
    """
    The view for company products options load

    :param obj context: The context : The company object
    :param obj request: the Pyramid's request object
    """
    return dict(tvas=Tva.query().all(), unities=WorkUnit.query().all())
Пример #6
0
def json_workunits(request):
    """
    Return the workunit objects available for the given form

    :param obj request: The current request object
    :returns: List of Workunits in their json repr
    """
    query = WorkUnit.query()
    return [item.__json__(request) for item in query]
Пример #7
0
def json_workunits(request):
    """
    Return the workunit objects available for the given form

    :param obj request: The current request object
    :returns: List of Workunits in their json repr
    """
    query = WorkUnit.query()
    return [item.__json__(request) for item in query]
Пример #8
0
 def submit_success(self, appstruct):
     """
         Handle successfull work unit configuration
     """
     for unit in WorkUnit.query():
         self.dbsession.delete(unit)
     for data in appstruct['workunits']:
         unit = WorkUnit(label=data)
         self.dbsession.add(unit)
     self.request.session.flash(self.validation_msg)
     return HTTPFound(self.request.route_path("admin_workunit"))
Пример #9
0
 def submit_success(self, appstruct):
     """
         Handle successfull work unit configuration
     """
     for unit in WorkUnit.query():
         self.dbsession.delete(unit)
     for data in appstruct['workunits']:
         unit = WorkUnit(label=data)
         self.dbsession.add(unit)
     self.request.session.flash(self.validation_msg)
     return HTTPFound(self.request.route_path("admin_workunit"))
Пример #10
0
def company_products_options_ajax_view(context, request):
    """
    The view for company products options load

    :param obj context: The context : The company object
    :param obj request: the Pyramid's request object
    """
    return dict(
        tvas=Tva.query().all(),
        unities=WorkUnit.query().all()
    )
def downgrade():
    from autonomie.models.task import WorkUnit
    from autonomie.models.task.estimation import EstimationLine
    from autonomie.models.task.invoice import InvoiceLine
    from autonomie.models.task.invoice import CancelInvoiceLine
    from autonomie_base.models.base import DBSESSION
    for factory in (EstimationLine, InvoiceLine, CancelInvoiceLine):
        for line in factory.query():
            line.unity = translate_inverse(line.unity)
            DBSESSION().merge(line)
    for value in WorkUnit.query():
        DBSESSION().delete(value)
Пример #12
0
def get_unities():
    unities =  ["",]
    unities.extend([workunit.label  for workunit in WorkUnit.query()])
    return unities
Пример #13
0
def get_unities():
    unities = [
        "",
    ]
    unities.extend([workunit.label for workunit in WorkUnit.query()])
    return unities
Пример #14
0
 def before(self, form):
     """
         Add appstruct to the current form object
     """
     appstruct = [mode.label for mode in WorkUnit.query()]
     form.set_appstruct({'workunits': appstruct})