本文整理汇总了Python中sgp.managers.ItemMan.ItemManager.getByCodigo方法的典型用法代码示例。如果您正苦于以下问题:Python ItemManager.getByCodigo方法的具体用法?Python ItemManager.getByCodigo怎么用?Python ItemManager.getByCodigo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sgp.managers.ItemMan.ItemManager
的用法示例。
在下文中一共展示了ItemManager.getByCodigo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __actions__
# 需要导入模块: from sgp.managers.ItemMan import ItemManager [as 别名]
# 或者: from sgp.managers.ItemMan.ItemManager import getByCodigo [as 别名]
def __actions__(self, obj):
"""Override this function to define how action links should be displayed for the given record."""
primary_fields = self.__provider__.get_primary_fields(self.__entity__)
pklist = '/'.join(map(lambda x: str(getattr(obj, x)), primary_fields))
estado = obj.estado
lista = []
lista.append(str(obj.id_fase))
lista.append(str(obj.id_item))
if estado != 'finalizado':
value = '<div width="10em"><div><a class="edit_link" href="'+pklist+'/edit" title = "Editar" style="text-decoration:none">edit</a>'\
'</div><div>'\
'<form method="POST" action="'+pklist+'" class="button-to">'\
'<input type="hidden" name="_method" value="DELETE" />'\
'<input title = "Editar" class="delete-button" onclick="return confirm(\'Are you sure?\');" value="delete" type="submit" '\
'style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0;"/>'\
'</form></div>'\
'<div><a href="/item/adjuntar?id_item='+pklist+'" title="Adjuntar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/adjunto.png" width="17" height="17" /></a></div>'\
'<div><a href="/item/impacto?id_item='+pklist+'" title="Calcular Impacto" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/calculo_impacto.png" width="17" height="17" /></a></div>'
# '<div><a href="/item/impacto?id_item='+pklist+'" style="text-decoration:none">Impacto </a>'\
# '</div>'
if estado == "inicial":
value +='<div><a href="/item/listo?id_item='+pklist+'" title="Listo" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/listo.png" width="17" height="17" /></a></div>'
#
# '<div><a href="/item/listo?id_item='+str(obj.id_item)+'" style="text-decoration:none">Listo </a>'\
# '</div>'
if estado == 'listo':
value +='<div><a href="/item/aprobar?id_item='+pklist+'" title="Aprobar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/aprobar.png" width="17" height="17" /></a></div>'\
'<div><a href="/item/desaprobar?id_item='+pklist+'" title="Desaprobar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/desaprobar.png" width="17" height="17" /></a></div>'
# value += '<div><a href="/item/aprobar?id_item='+str(obj.id_item)+'" style="text-decoration:none">Aprobar </a>'\
# '</div>'\
# '<div><a href="/item/desaprobar?id_item='+str(obj.id_item)+'" style="text-decoration:none">Desaprobar </a>'\
# '</div>'
im = ItemManager()
versiones = im.getByCodigo(obj.codigo, obj.id_fase)
cantidad = len(versiones)
# for version in versiones:
# cantidad = cantidad +1
if cantidad > 1 and obj.estado != "finalizado":
value += '<div><a href="/itemRevertir/obtener?id_item='+pklist+'" title="Revertir" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/revert.png" width="21" height="21" /></a></div>'
# '<div><a href="/itemRevertir/obtener?id_item='+str(obj.id_item)+'" style="text-decoration:none">Revertir </a>'\
# '</div>'
else:
value = '<div></div>'
value +='</div>'
return value
示例2: __actions__
# 需要导入模块: from sgp.managers.ItemMan import ItemManager [as 别名]
# 或者: from sgp.managers.ItemMan.ItemManager import getByCodigo [as 别名]
def __actions__(self, obj):
primary_fields = self.__provider__.get_primary_fields(self.__entity__)
pklist = '/'.join(map(lambda x: str(getattr(obj, x)), primary_fields))
estado = obj.estado
lista = []
lista.append(str(obj.id_fase))
lista.append(str(obj.id_item))
lbm = LineaBaseManager()
estado_lb = ""
if obj.id_linea_base != None:
linea_base = lbm.getById(obj.id_linea_base) #Si el item esta en una linea base
estado_lb = linea_base.estado
value = '<div>'
if obj.id_linea_base == None or obj.estado == 'revision' or estado_lb == 'liberado' or (obj.estado == 'listo' and obj.id_linea_base != None):
if EvaluarPermiso("Modificar/eliminar Item", id_fase = obj.id_fase ).is_met(request.environ):
value = '<div width="10em"><div><a class="edit_link" href="'+pklist+'/edit" title = "Editar" style="text-decoration:none">edit</a>'\
'</div><div>'\
'<form method="POST" action="'+pklist+'" class="button-to">'\
'<input type="hidden" name="_method" value="DELETE" />'\
'<input title = "Editar" class="delete-button" onclick="return confirm(\'Are you sure?\');" value="delete" type="submit" '\
'style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0;"/>'\
'</form></div>'\
'<div><a href="/item/adjuntar?id_item='+pklist+'" title="Adjuntar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/adjunto.png" width="17" height="17" /></a></div>'
value += '<div><a href="/item/impacto?id_item='+pklist+'" title="Calcular Impacto" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/calculo_impacto.png" width="17" height="17" /></a></div>'
if estado == "inicial" or estado == 'revision' or estado== 'desaprobado':
if EvaluarPermiso("Modificar/eliminar Item", id_fase = obj.id_fase ).is_met(request.environ):
value +='<div><a href="/item/listo?id_item='+pklist+'" title="Listo" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/listo.png" width="17" height="17" /></a></div>'
if estado == 'listo':
if EvaluarPermiso("Aprobar/Desaprobar Item", id_fase = obj.id_fase ).is_met(request.environ):
value +='<div><a href="/item/aprobar?id_item='+pklist+'" title="Aprobar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/aprobar.png" width="17" height="17" /></a></div>'\
'<div><a href="/item/desaprobar?id_item='+pklist+'" title="Desaprobar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/desaprobar.png" width="17" height="17" /></a></div>'
im = ItemManager()
versiones = im.getByCodigo(obj.codigo, obj.id_fase)
cantidad = len(versiones)
if cantidad > 1 and obj.estado != "finalizado":
if EvaluarPermiso("Modificar/eliminar Item", id_fase = obj.id_fase ).is_met(request.environ):
value += '<div><a href="/itemRevertir/?id_item='+pklist+'" title="Revertir" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/revert.png" width="21" height="21" /></a></div>'
else:
value += '<div><a href="/item/impacto?id_item='+pklist+'" title="Calcular Impacto" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/calculo_impacto.png" width="17" height="17" /></a></div>'
if ItemManager().sePuedeRelacionar(obj) and EvaluarPermiso("Crear Relacion", id_fase = obj.id_fase ).is_met(request.environ):
value+= '<div><a href="/relacion/newRelacion?id_item='+pklist+'" title="Relacionar" style="background-color: transparent; float:left; border:0; color: #286571; display: inline; margin: 0; padding: 0 5 0 0;" ><img src="/images/relaciones.png" width="17" height="17" /></a></div>'
value +='</div>'
return value