Fix - Al borrar impuestos

This commit is contained in:
Mauricio Baeza 2017-11-17 21:45:47 -06:00
parent eb89b8e8fa
commit ff21b3c8bc
2 changed files with 9 additions and 3 deletions

View File

@ -785,8 +785,11 @@ class SATImpuestos(BaseModel):
@classmethod
def remove(cls, id):
with database_proxy.transaction():
q = SATImpuestos.delete().where(SATImpuestos.id==id)
return bool(q.execute())
try:
q = SATImpuestos.delete().where(SATImpuestos.id==id)
return bool(q.execute())
except IntegrityError:
return False
@classmethod
def get_(self):

View File

@ -1099,10 +1099,13 @@ function borrar_impuesto(row){
var grid = $$('grid_admin_taxes')
webix.ajax().del('/values/satimpuesto', {id: row}, function(text, xml, xhr){
var msg = 'Impuesto eliminado correctamente'
msg = 'Impuesto eliminado correctamente'
if(xhr.status == 200){
grid.remove(row)
msg_sucess(msg)
}else{
msg = 'Impuesto en uso, no se pudo eliminar.'
msg_sucess(msg)
}
})
}