forked from elmau/empresa-libre
FIX - Obtener cliente
This commit is contained in:
parent
e0532b7cb0
commit
03a7c5cf67
|
@ -183,6 +183,8 @@ class Emisor(BaseModel):
|
||||||
correo = TextField(default='')
|
correo = TextField(default='')
|
||||||
web = TextField(default='')
|
web = TextField(default='')
|
||||||
curp = TextField(default='')
|
curp = TextField(default='')
|
||||||
|
token_timbrado = TextField(default='')
|
||||||
|
token_soporte = TextField(default='')
|
||||||
regimenes = ManyToManyField(SATRegimenes, related_name='emisores')
|
regimenes = ManyToManyField(SATRegimenes, related_name='emisores')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -683,12 +685,12 @@ class Socios(BaseModel):
|
||||||
Socios.id, Socios.nombre, Socios.rfc,
|
Socios.id, Socios.nombre, Socios.rfc,
|
||||||
SATFormaPago.key.alias('forma_pago'),
|
SATFormaPago.key.alias('forma_pago'),
|
||||||
SATUsoCfdi.key.alias('uso_cfdi'))
|
SATUsoCfdi.key.alias('uso_cfdi'))
|
||||||
.join(SATFormaPago).switch(Socios)
|
.join(SATFormaPago, JOIN.LEFT_OUTER).switch(Socios)
|
||||||
.join(SATUsoCfdi).switch(Socios)
|
.join(SATUsoCfdi, JOIN.LEFT_OUTER).switch(Socios)
|
||||||
.where(
|
.where((Socios.id==id) & (Socios.es_cliente==True))
|
||||||
(Socios.id==id) & (Socios.es_cliente==True))
|
|
||||||
.dicts()
|
.dicts()
|
||||||
)
|
)
|
||||||
|
print (id, row)
|
||||||
if len(row):
|
if len(row):
|
||||||
return {'ok': True, 'row': row[0]}
|
return {'ok': True, 'row': row[0]}
|
||||||
return {'ok': False}
|
return {'ok': False}
|
||||||
|
@ -699,8 +701,8 @@ class Socios(BaseModel):
|
||||||
.select(Socios.id, Socios.nombre, Socios.rfc,
|
.select(Socios.id, Socios.nombre, Socios.rfc,
|
||||||
SATFormaPago.key.alias('forma_pago'),
|
SATFormaPago.key.alias('forma_pago'),
|
||||||
SATUsoCfdi.key.alias('uso_cfdi'))
|
SATUsoCfdi.key.alias('uso_cfdi'))
|
||||||
.join(SATFormaPago).switch(Socios)
|
.join(SATFormaPago, JOIN.LEFT_OUTER).switch(Socios)
|
||||||
.join(SATUsoCfdi).switch(Socios)
|
.join(SATUsoCfdi, JOIN.LEFT_OUTER).switch(Socios)
|
||||||
.where((Socios.es_cliente==True) &
|
.where((Socios.es_cliente==True) &
|
||||||
(Socios.rfc.contains(name) |
|
(Socios.rfc.contains(name) |
|
||||||
Socios.nombre.contains(name)))
|
Socios.nombre.contains(name)))
|
||||||
|
@ -763,7 +765,7 @@ class Socios(BaseModel):
|
||||||
class Productos(BaseModel):
|
class Productos(BaseModel):
|
||||||
categoria = ForeignKeyField(Categorias, null=True)
|
categoria = ForeignKeyField(Categorias, null=True)
|
||||||
clave = TextField(unique=True, index=True)
|
clave = TextField(unique=True, index=True)
|
||||||
clave_sat = TextField()
|
clave_sat = TextField(default='')
|
||||||
descripcion = TextField(index=True)
|
descripcion = TextField(index=True)
|
||||||
unidad = ForeignKeyField(SATUnidades)
|
unidad = ForeignKeyField(SATUnidades)
|
||||||
valor_unitario = DecimalField(default=0.0, decimal_places=6, auto_round=True)
|
valor_unitario = DecimalField(default=0.0, decimal_places=6, auto_round=True)
|
||||||
|
@ -979,6 +981,7 @@ class Facturas(BaseModel):
|
||||||
name = '{}{}_{}.xml'.format(obj.serie, obj.folio, obj.cliente.rfc)
|
name = '{}{}_{}.xml'.format(obj.serie, obj.folio, obj.cliente.rfc)
|
||||||
return obj.xml, name
|
return obj.xml, name
|
||||||
|
|
||||||
|
#~ Revisar
|
||||||
def _get_data_cfdi_to_pdf(self, xml, cancel, version):
|
def _get_data_cfdi_to_pdf(self, xml, cancel, version):
|
||||||
pre_nomina = PRE['NOMINA'][version]
|
pre_nomina = PRE['NOMINA'][version]
|
||||||
|
|
||||||
|
@ -1089,7 +1092,10 @@ class Facturas(BaseModel):
|
||||||
@classmethod
|
@classmethod
|
||||||
def send(cls, id, rfc):
|
def send(cls, id, rfc):
|
||||||
values = Configuracion.get_({'fields': 'correo'})
|
values = Configuracion.get_({'fields': 'correo'})
|
||||||
#~ print (server)
|
if not values:
|
||||||
|
msg = 'No esta configurado el servidor de correo de salida'
|
||||||
|
return {'ok': False, 'msg': msg}
|
||||||
|
|
||||||
obj = Facturas.get(Facturas.id==id)
|
obj = Facturas.get(Facturas.id==id)
|
||||||
if obj.uuid is None:
|
if obj.uuid is None:
|
||||||
msg = 'La factura no esta timbrada'
|
msg = 'La factura no esta timbrada'
|
||||||
|
@ -1576,7 +1582,7 @@ def _crear_tablas():
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
msg = 'El usuario ya existe'
|
msg = 'El usuario ya existe'
|
||||||
log.error(msg)
|
log.error(msg)
|
||||||
return
|
return False
|
||||||
|
|
||||||
log.info('SuperUsuario creado correctamente...')
|
log.info('SuperUsuario creado correctamente...')
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -135,7 +135,9 @@ function get_emisor(){
|
||||||
var emisor = values.row.emisor
|
var emisor = values.row.emisor
|
||||||
$$('lst_emisor_regimen').parse(values.row.regimenes)
|
$$('lst_emisor_regimen').parse(values.row.regimenes)
|
||||||
form.setValues(emisor, true)
|
form.setValues(emisor, true)
|
||||||
$$('lst_emisor_regimen').select(emisor.regimenes)
|
if(emisor.regimenes){
|
||||||
|
$$('lst_emisor_regimen').select(emisor.regimenes)
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
msg_error(values.msg)
|
msg_error(values.msg)
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ function get_monedas(){
|
||||||
$$('lst_moneda').setValue(pre.id)
|
$$('lst_moneda').setValue(pre.id)
|
||||||
if(values.length == 1){
|
if(values.length == 1){
|
||||||
$$('fs_moneda').hide()
|
$$('fs_moneda').hide()
|
||||||
$$('fs_moneda').refresh()
|
//~ $$('fs_moneda').refresh()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ function get_regimen_fiscal(){
|
||||||
$$('lst_regimen_fiscal').setValue(pre.id)
|
$$('lst_regimen_fiscal').setValue(pre.id)
|
||||||
if(values.length == 1){
|
if(values.length == 1){
|
||||||
$$('fs_regimen_fiscal').hide()
|
$$('fs_regimen_fiscal').hide()
|
||||||
$$('fs_regimen_fiscal').refresh()
|
//~ $$('fs_regimen_fiscal').refresh()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,11 @@ var emisor_otros_datos= [
|
||||||
{cols: [{view: 'datepicker', id: 'ong_fecha_dof', name: 'ong_fecha_dof',
|
{cols: [{view: 'datepicker', id: 'ong_fecha_dof', name: 'ong_fecha_dof',
|
||||||
label: 'Fecha de DOF: ', disabled: true, format: '%d-%M-%Y',
|
label: 'Fecha de DOF: ', disabled: true, format: '%d-%M-%Y',
|
||||||
placeholder: 'Fecha de publicación en el DOF'}, {}]},
|
placeholder: 'Fecha de publicación en el DOF'}, {}]},
|
||||||
|
{template: 'Timbrado y Soporte', type: 'section'},
|
||||||
|
{view: 'text', id: 'token_timbrado',
|
||||||
|
name: 'token_timbrado', label: 'Token de Timbrado: '},
|
||||||
|
{view: 'text', id: 'token_soporte',
|
||||||
|
name: 'token_soporte', label: 'Token de Soporte: '},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue