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
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
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
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
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
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
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