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)
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)
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 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 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]
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"))
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)
def get_unities(): unities = ["",] unities.extend([workunit.label for workunit in WorkUnit.query()]) return unities
def get_unities(): unities = [ "", ] unities.extend([workunit.label for workunit in WorkUnit.query()]) return unities
def before(self, form): """ Add appstruct to the current form object """ appstruct = [mode.label for mode in WorkUnit.query()] form.set_appstruct({'workunits': appstruct})