예제 #1
0
class trainb_problem(interna_problem):

    idproblem = baseraw.AutoField(
        db_column="idproblem",
        verbose_name=FLUtil.translate(u"Identificador", u"MetaData"),
        primary_key=True
    )

    description = baseraw.TextField(
        db_column="description",
        verbose_name=FLUtil.translate(u"Descripción", u"MetaData"),
        blank=False,
        null=False
    )

    improvement = baseraw.ForeignKey(
        "improvement",
        db_column="improvement",
        verbose_name=FLUtil.translate(u"Mejora", u"MetaData"),
        blank=False,
        null=False,
        to_field="idimprovement",
        on_delete=baseraw.PROTECT,
        related_name="problems"
    )

    class Meta:
        abstract = True
예제 #2
0
class trainb_action(interna_action):

    idaction = baseraw.AutoField(db_column="idaction",
                                 verbose_name=FLUtil.translate(
                                     u"Identificador", u"MetaData"),
                                 primary_key=True)

    description = baseraw.TextField(db_column="description",
                                    verbose_name=FLUtil.translate(
                                        u"Descripción", u"MetaData"),
                                    blank=False,
                                    null=False)

    state = baseraw.CharField(db_column="state",
                              verbose_name=FLUtil.translate(
                                  u"Estado", u"MetaData"),
                              blank=False,
                              null=False,
                              max_length=100,
                              unique=False)

    improvement = baseraw.ForeignKey("improvement",
                                     db_column="improvement",
                                     verbose_name=FLUtil.translate(
                                         u"Mejora", u"MetaData"),
                                     blank=False,
                                     null=False,
                                     to_field="idimprovement",
                                     on_delete=baseraw.PROTECT,
                                     related_name="actions")

    class Meta:
        abstract = True
예제 #3
0
class trainb_comment(interna_comment):

    idcomment = baseraw.AutoField(db_column="idcomment",
                                  verbose_name=FLUtil.translate(
                                      u"Identificador", u"MetaData"),
                                  primary_key=True)._miextend(
                                      REQUIRED=True,
                                      OLDTIPO="SERIAL",
                                      visiblegrid=False,
                                  )
    description = baseraw.TextField(
        db_column="description",
        verbose_name=FLUtil.translate(u"Descripcion", u"MetaData"),
        blank=False,
        null=True,
    )
    date = baseraw.DateTimeField(db_column="date",
                                 verbose_name=FLUtil.translate(
                                     u"Fecha y hora", u"MetaData"),
                                 blank=True,
                                 default=datetime.now)
    task = baseraw.ForeignKey("task",
                              db_column="idtask",
                              verbose_name=FLUtil.translate(
                                  u"Tarea", u"MetaData"),
                              blank=False,
                              null=False,
                              max_length=30,
                              to_field="idtask",
                              on_delete=baseraw.PROTECT,
                              related_name="comments")
    user = baseraw.ForeignKey("user",
                              db_column="iduser",
                              verbose_name=FLUtil.translate(
                                  u"Líder del cambio", u"MetaData"),
                              blank=False,
                              null=False,
                              max_length=30,
                              to_field="iduser",
                              on_delete=baseraw.PROTECT,
                              related_name="user")

    def create(self, data):
        data["task"] = Task().load({"idtask": data["task"]})
        data["user"] = User().load({"iduser": data["user"]})
        return super().create(data)

    def update(self, data):
        if "task" in data:
            del data["task"]
        if "user" in data:
            del data["user"]
        return super().update(data)

    def get_projects(self):
        return self.projects.all()

    class Meta:
        abstract = True
예제 #4
0
class trainb_consultant(interna_consultant):

    idconsultant = baseraw.AutoField(db_column="idconsultant",
                                     verbose_name=FLUtil.translate(
                                         u"Identificador", u"MetaData"),
                                     primary_key=True)._miextend(
                                         REQUIRED=True,
                                         OLDTIPO="SERIAL",
                                         visiblegrid=False,
                                     )

    def get_projects(self):
        return self.projects.all()

    class Meta:
        abstract = True
예제 #5
0
class trainb_address(interna_address):

    idaddress = baseraw.AutoField(db_column="idaddress",
                                  verbose_name=FLUtil.translate(
                                      u"Identificador", u"MetaData"),
                                  primary_key=True)._miextend(
                                      REQUIRED=True,
                                      OLDTIPO="SERIAL",
                                      visiblegrid=False,
                                  )
    description = baseraw.CharField(db_column="description",
                                    verbose_name=FLUtil.translate(
                                        u"Descripcion", u"MetaData"),
                                    blank=False,
                                    null=False,
                                    max_length=140)._miextend(OLDTIPO="STRING")
    street_address = baseraw.CharField(
        db_column="street_address",
        verbose_name=FLUtil.translate(u"Dirección", u"MetaData"),
        blank=False,
        null=False,
        max_length=100)._miextend(OLDTIPO="STRING")
    city = baseraw.CharField(db_column="city",
                             verbose_name=FLUtil.translate(
                                 u"Ciudad", u"MetaData"),
                             blank=False,
                             null=False,
                             max_length=100)._miextend(OLDTIPO="STRING")
    country = baseraw.CharField(db_column="country",
                                verbose_name=FLUtil.translate(
                                    u"País", u"MetaData"),
                                blank=False,
                                null=False,
                                max_length=100)._miextend(OLDTIPO="STRING")
    postal_code = baseraw.CharField(db_column="postal_code",
                                    verbose_name=FLUtil.translate(
                                        u"Código postal", u"MetaData"),
                                    blank=False,
                                    null=False,
                                    max_length=10)._miextend(OLDTIPO="STRING")

    def getName(self):
        return self.name

    class Meta:
        abstract = True
예제 #6
0
class trainb_sprint(interna_sprint):

    idsprint = baseraw.AutoField(
        db_column="idsprint",
        verbose_name=FLUtil.translate(u"Identificador", u"MetaData"),
        primary_key=True
    )._miextend(
        REQUIRED=True,
        OLDTIPO="SERIAL",
        visiblegrid=False,
    )
    objective = baseraw.TextField(
        db_column="objective",
        verbose_name=FLUtil.translate(u"Definición de hecho", u"MetaData"),
        blank=True,
        null=True
    )._miextend(
        OLDTIPO="STRING"
    )
    cost = baseraw.FloatField(
        db_column="cost",
        verbose_name=FLUtil.translate(u"Coste", u"MetaData"),
        blank=True,
        null=True,
        default=None
    )._miextend(
        OLDTIPO="STRING"
    )
    start_date = baseraw.DateField(
        db_column="start_date",
        verbose_name=FLUtil.translate(u"Fecha de inicio", u"MetaData"),
        blank=True,
        null=True
    )._miextend(
        OLDTIPO="DATE"
    )
    finish_date = baseraw.DateField(
        db_column="finish_date",
        verbose_name=FLUtil.translate(u"Fecha de fin", u"MetaData"),
        blank=True,
        null=True
    )._miextend(
        OLDTIPO="DATE"
    )
    state = baseraw.CharField(
        db_column="state",
        verbose_name=FLUtil.translate(u"Estado", u"MetaData"),
        blank=False,
        null=False,
        default="Propuesta",
        max_length=30
    )._miextend(
        optionslist=u",Propuesta,Rechazado,Aceptado",
        OLDTIPO="STRING"
    )
    project = baseraw.ForeignKey(
        "project",
        db_column="idproject",
        verbose_name=FLUtil.translate(u"Proyecto", u"MetaData"),
        blank=False,
        null=False,
        to_field="idproject",
        on_delete=baseraw.PROTECT,
        related_name="sprints"
    )._miextend(
            OLDTIPO="SERIAL"
    )
    improvement = baseraw.ForeignKey(
        "improvement",
        db_column="idimprovement",
        verbose_name=FLUtil.translate(u"Mejora", u"MetaData"),
        blank=False,
        null=False,
        to_field="idimprovement",
        on_delete=baseraw.PROTECT,
        related_name="improvements"
    )._miextend(
            OLDTIPO="SERIAL"
    )
    action = baseraw.ForeignKey(
        "action",
        db_column="idaction",
        verbose_name=FLUtil.translate(u"Acción", u"MetaData"),
        blank=False,
        null=False,
        to_field="idaction",
        on_delete=baseraw.PROTECT,
        related_name="actions"
    )._miextend(
            OLDTIPO="SERIAL"
    )
    users = baseraw.ManyToManyField(User)

    def create(self, data):
        data['project'] = Project().load({'idproject':data['project']})
        data['improvement'] = Improvement().load({'idimprovement':data['improvement']})
        data['action'] = Action().load({'idaction':data['action']})
        users = data['users']
        del data['users']
        sprint = super().create(data)
        sprint.add_users(users)
        return sprint

    def update(self, data):
        if "project" in data:
            del data['project']
        if "users" in data:
            del data['users']
        data['improvement'] = Improvement().load({'idimprovement':data['improvement']})
        data['action'] = Action().load({'idaction':data['action']})
        return super().update(data)

    def get_improvements(self):
        return self.improvements.all()

    def get_action(self):
        return self.action.all()

    def get_users(self):
        return self.users.all()

    def get_tasks(self):
        return self.tasks.all()

    def add_users(self, users):
        for idUser in users:
            self.users.add(User().load(idUser))

    class Meta:
        abstract = True
예제 #7
0
class trainb_improvement(interna_improvement):

    idimprovement = baseraw.AutoField(
        db_column="idimprovement",
        verbose_name=FLUtil.translate(u"Identificador", u"MetaData"),
        primary_key=True
    )._miextend(
        REQUIRED=True,
        OLDTIPO="SERIAL",
        visiblegrid=False,
    )
    objective = baseraw.TextField(
        db_column="objective",
        verbose_name=FLUtil.translate(u"Objetivo", u"MetaData"),
        blank=True,
        null=True
    )
    cost = baseraw.FloatField(
        db_column="cost",
        verbose_name=FLUtil.translate(u"Coste", u"MetaData"),
        blank=True,
        null=True,
        default=None
    )
    priority = baseraw.IntegerField(
        db_column="priority",
        verbose_name=FLUtil.translate(u"Prioridad", u"MetaData"),
        blank=False,
        null=False,
        default=0
    )
    state = baseraw.CharField(
        db_column="state",
        verbose_name=FLUtil.translate(u"Estado", u"MetaData"),
        blank=False,
        null=False,
        default="Propuesta",
        max_length=30
    )._miextend(
        optionslist=u",Propuesta,Rechazada,Pendiente,En ejecución,En ejecución En medicion, En medicion finalizando, Finalizado",
        OLDTIPO="STRING"
    )
    project = baseraw.ForeignKey(
        "project",
        db_column="idproject",
        verbose_name=FLUtil.translate(u"Proyecto", u"MetaData"),
        blank=False,
        null=False,
        to_field="idproject",
        on_delete=baseraw.PROTECT,
        related_name="project"
    )._miextend(
        OLDTIPO="SERIAL"
    )

    def create(self, data):
        data['project'] = Project().load({'idproject':data['project']})
        problems = data['problems']
        actions = data['actions']
        # Limpio data para crear con sus campos unicamente
        del data['problems']
        del data['actions']
        mejora = super().create(data)

        mejora.createProblems(problems)
        mejora.createActions(actions)
        mejora.save()
        return mejora

    def update(self, data):
        if "problems" in data:
            del data['problems']
        if "actions" in data:
            del data['actions']
        if "project" in data:
            del data['project']
        return super().update(data)

    def createProblems(self, data):
        from models.fltrainb.problem import problem as Problem
        problems = []
        for problem in data:
            problem['improvement'] = self
            p = Problem().create(problem)
            problems.append(p)
        return problems

    def createActions(self, data):
        from models.fltrainb.action import action as Action

        actions = []
        for action in data:
            action['improvement'] = self
            action['state'] = 'Pendiente'
            actions.append(Action().create(action))
        return actions

    def get_problems(self):
        return self.problems.all()

    def get_actions(self):
        return self.actions.all()

    class Meta:
        abstract = True
예제 #8
0
class trainb_project(interna_project):

    idproject = baseraw.AutoField(
        db_column="idproject",
        verbose_name=FLUtil.translate(u"Identificador", u"MetaData"),
        primary_key=True
    )._miextend(
        REQUIRED=True,
        OLDTIPO="SERIAL",
        visiblegrid=False,
    )
    name = baseraw.CharField(
        db_column="name",
        verbose_name=FLUtil.translate(u"Nombre", u"MetaData"),
        blank=False,
        null=False,
        max_length=200
    )._miextend(
        OLDTIPO="STRING"
    )

    description = baseraw.TextField(
        db_column="description",
        verbose_name=FLUtil.translate(u"Descripcion", u"MetaData"),
        blank=False,
        null=True,
    )._miextend(
        OLDTIPO="STRING"
    )

    budget = baseraw.CharField(
        db_column="budget",
        verbose_name=FLUtil.translate(u"Presupuesto", u"MetaData"),
        blank=False,
        null=True,
        max_length=12
    )._miextend(
        OLDTIPO="STRING"
    )

    cost = baseraw.CharField(
        db_column="cost",
        verbose_name=FLUtil.translate(u"Coste", u"MetaData"),
        blank=False,
        null=True,
        max_length=12
    )._miextend(
        OLDTIPO="STRING"
    )

    start_date = baseraw.DateField(
        db_column="start_date",
        verbose_name=FLUtil.translate(u"Fecha de comienzo", u"MetaData"),
        blank=True,
        null=True
    )._miextend(
        OLDTIPO="DATE"
    )

    finish_date = baseraw.DateField(
        db_column="finish_date",
        verbose_name=FLUtil.translate(u"Fecha de finalización", u"MetaData"),
        blank=True,
        null=True
    )._miextend(
        OLDTIPO="DATE"
    )

    leader = baseraw.ForeignKey(
        "leader",
        db_column="leader",
        verbose_name=FLUtil.translate(u"Líder del cambio", u"MetaData"),
        blank=False,
        null=False,
        max_length=30,
        to_field="idleader",
        on_delete=baseraw.PROTECT,
        related_name="project_leader__fk__leader_idleader"
    )._miextend(
        OLDTIPO="SERIAL"
    )

    consultant = baseraw.ForeignKey(
        "consultant",
        db_column="consultant",
        verbose_name=FLUtil.translate(u"Consultor", u"MetaData"),
        blank=False,
        null=False,
        max_length=30,
        to_field="idconsultant",
        on_delete=baseraw.PROTECT,
        related_name="projects"
    )._miextend(
        OLDTIPO="SERIAL"
    )

    def create(self, data):
        data['leader'] = Leader().load(data['leader'])
        data['consultant'] = Consultant().load(data['consultant'])
        return super().create(data)

    def update(self, data):
        data['leader'] = Leader().load(data['leader'])
        data['consultant'] = Consultant().load(data['consultant'])
        return super().update(data)

    class Meta:
        abstract = True
예제 #9
0
class trainb_task(interna_task):

    idtask = baseraw.AutoField(
        db_column="idtask",
        verbose_name=FLUtil.translate(u"Identificador", u"MetaData"),
        primary_key=True
    )._miextend(
        REQUIRED=True,
        OLDTIPO="SERIAL",
        visiblegrid=False,
    )
    name = baseraw.CharField(
        db_column="name",
        verbose_name=FLUtil.translate(u"Nombre", u"MetaData"),
        blank=False,
        null=False,
        max_length=200
    )._miextend(
        OLDTIPO="STRING"
    )
    description = baseraw.TextField(
        db_column="description",
        verbose_name=FLUtil.translate(u"Descripcion", u"MetaData"),
        blank=False,
        null=True,
    )._miextend(
        OLDTIPO="STRING"
    )
    cost = baseraw.CharField(
        db_column="cost",
        verbose_name=FLUtil.translate(u"Coste", u"MetaData"),
        blank=True,
        null=True,
        max_length=12,
        default=0
    )._miextend(
        OLDTIPO="STRING"
    )
    finish_date = baseraw.DateField(
        db_column="finish_date",
        verbose_name=FLUtil.translate(u"Fecha de comienzo", u"MetaData"),
        blank=True,
        null=True
    )._miextend(
        OLDTIPO="DATE"
    )
    order = baseraw.IntegerField(
        db_column="order",
        verbose_name=FLUtil.translate(u"Orden", u"MetaData"),
        blank=False,
        null=False,
        default=0
    )._miextend(
        OLDTIPO="STRING"
    )
    sprint = baseraw.ForeignKey(
        "sprint",
        db_column="idsprint",
        verbose_name=FLUtil.translate(u"Líder del cambio", u"MetaData"),
        blank=False,
        null=False,
        max_length=30,
        to_field="idsprint",
        on_delete=baseraw.PROTECT,
        related_name="tasks"
    )._miextend(
        OLDTIPO="SERIAL"
    )
    responsable = baseraw.ForeignKey(
        "user",
        db_column="idresponsable",
        verbose_name=FLUtil.translate(u"Responsable", u"MetaData"),
        blank=True,
        null=True,
        max_length=30,
        to_field="iduser",
        on_delete=baseraw.PROTECT,
        related_name="responsable"
    )._miextend(
        OLDTIPO="SERIAL"
    )

    def create(self, data):
        data["sprint"] = Sprint().load({"idsprint":data["sprint"]})
        data["responsable"] = User().load({"iduser":data["responsable"]})
        return super().create(data)

    def update(self, data):
        data["sprint"] = Sprint().load({"idsprint":data["sprint"]})
        data["responsable"] = User().load({"iduser":data["responsable"]})
        return super().update(data)

    def get_user(self):
        return self.users.all()

    def get_comments(self):
        return self.comments.all()

    class Meta:
        abstract = True
예제 #10
0
class trainb_company(interna_company):

    idcompany = baseraw.AutoField(
        db_column="idcompany",
        verbose_name=FLUtil.translate(u"Identificador", u"MetaData"),
        primary_key=True
    )._miextend(
        REQUIRED=True,
        OLDTIPO="SERIAL",
        visiblegrid=False,
    )
    name = baseraw.CharField(
        db_column="name",
        verbose_name=FLUtil.translate(u"Nombre de la empresa", u"MetaData"),
        blank=False,
        null=False,
        max_length=100
    )._miextend(
        OLDTIPO="STRING"
    )
    nif = baseraw.CharField(
        db_column="nif",
        verbose_name=FLUtil.translate(u"NIF", u"MetaData"),
        blank=False,
        null=False,
        max_length=20,
        unique=True
    )._miextend(
        OLDTIPO="STRING"
    )
    email = baseraw.CharField(
        db_column="email",
        verbose_name=FLUtil.translate(u"Email", u"MetaData"),
        blank=False,
        null=True,
        max_length=150
    )._miextend(
        OLDTIPO="STRING"
    )
    phone = baseraw.CharField(
        db_column="phone",
        verbose_name=FLUtil.translate(u"Teléfono", u"MetaData"),
        blank=False,
        null=True,
        max_length=20
    )._miextend(
        OLDTIPO="STRING"
    )
    address = baseraw.ForeignKey(
        "address",
        db_column="address",
        verbose_name=FLUtil.translate(u"Dirección", u"MetaData"),
        blank=False,
        null=False,
        to_field="idaddress",
        on_delete=baseraw.CASCADE,
        related_name="company_address__fk__address_idaddress"
    )._miextend(
        OLDTIPO="SERIAL"
    )

    def getName(self):
        return self.name

    def create(self, data):
        data['address'] = Address().load(data['address'])
        return super().create(data)

    def get_address(self):
        return self.address

    class Meta:
        abstract = True
예제 #11
0
class trainb_user(interna_user):

    iduser = baseraw.AutoField(
        db_column="iduser",
        verbose_name=FLUtil.translate(u"Identificador", u"MetaData"),
        primary_key=True
    )._miextend(
        REQUIRED=True,
        OLDTIPO="SERIAL",
        visiblegrid=False,
    )
    email = baseraw.CharField(
        db_column="email",
        verbose_name=FLUtil.translate(u"E-mail", u"MetaData"),
        blank=False,
        null=False,
        max_length=100,
        unique=True
    )._miextend(
        OLDTIPO="STRING"
    )
    password = baseraw.CharField(
        db_column="password",
        verbose_name=FLUtil.translate(u"Contraseña", u"MetaData"),
        blank=False,
        null=False,
        max_length=50
    )._miextend(
        OLDTIPO="STRING"
    )
    name = baseraw.CharField(
        db_column="name",
        verbose_name=FLUtil.translate(u"Nombre", u"MetaData"),
        blank=False,
        null=False,
        max_length=100
    )._miextend(
        OLDTIPO="STRING"
    )
    surname = baseraw.CharField(
        db_column="surname",
        verbose_name=FLUtil.translate(u"Apellidos", u"MetaData"),
        blank=False,
        null=False,
        max_length=150
    )._miextend(
        OLDTIPO="STRING"
    )
    birtday = baseraw.CharField(
        db_column="birtday",
        verbose_name=FLUtil.translate(u"Fecha Nacimiento", u"MetaData"),
        blank=True,
        null=True,
        max_length=10
    )._miextend(
        OLDTIPO="DATE"
    )
    rol = baseraw.CharField(
        db_column="rol",
        verbose_name=FLUtil.translate(u"Rol", u"MetaData"),
        blank=False,
        null=False,
        max_length=20
    )._miextend(
        optionslist=u",Consultor,Developer,Líder del cambio,Receptor del cambio",
        OLDTIPO="STRING"
    )
    phone = baseraw.CharField(
        db_column="phone",
        verbose_name=FLUtil.translate(u"Teléfono", u"MetaData"),
        blank=False,
        null=True,
        max_length=20
    )._miextend(
        OLDTIPO="STRING"
    )
    company = baseraw.ForeignKey(
        "company",
        db_column="company",
        verbose_name=FLUtil.translate(u"Empresa", u"MetaData"),
        blank=False,
        null=False,
        max_length=30,
        to_field="idcompany",
        on_delete=baseraw.CASCADE,
        related_name="user_company__fk__company_idcompany"
    )._miextend(
            OLDTIPO="SERIAL"
    )

    def create(self, data):
        print("Creo company")
        data['company'] = Company().load(data['company'])
        print("super")
        return super().create(data)

    def get_name(self):
        return self.name + " " + self.surname

    def get_company(self):
        return self.company

    class Meta:
        abstract = True