Obtener regimen fiscal del receptor al facturar desde tickets
This commit is contained in:
parent
b60e2d6a37
commit
de2ab5cedd
|
@ -8425,6 +8425,14 @@ class Tickets(BaseModel):
|
|||
data = {'ok': False, 'msg': msg}
|
||||
return data
|
||||
|
||||
try:
|
||||
receptor_regimen = SociosRegimenes.get_by_key(client)[0]['id']
|
||||
except Exception as e:
|
||||
log.error(e)
|
||||
msg = 'Error al obtener el Regimen Fiscal del receptor'
|
||||
data = {'ok': False, 'msg': msg}
|
||||
return data
|
||||
|
||||
payment_type = cls._get_payment_type(cls, tickets)
|
||||
|
||||
emisor = Emisor.select()[0]
|
||||
|
@ -8432,15 +8440,12 @@ class Tickets(BaseModel):
|
|||
data['cliente'] = client
|
||||
data['serie'] = cls._get_serie(cls, user, True)
|
||||
data['folio'] = cls._get_folio_invoice(cls, data['serie'])
|
||||
# ~ data['forma_pago'] = client.forma_pago.key
|
||||
data['forma_pago'] = payment_type
|
||||
data['tipo_cambio'] = 1.00
|
||||
data['lugar_expedicion'] = emisor.cp_expedicion or emisor.codigo_postal
|
||||
if client.uso_cfdi is None:
|
||||
data['uso_cfdi'] = 'P01'
|
||||
else:
|
||||
data['uso_cfdi'] = client.uso_cfdi.key
|
||||
data['regimen_fiscal'] = emisor.regimenes[0].key
|
||||
data['receptor_regimen'] = receptor_regimen
|
||||
|
||||
with database_proxy.atomic() as txn:
|
||||
obj = Facturas.create(**data)
|
||||
|
|
|
@ -616,7 +616,6 @@ function chk_is_invoice_day_change(new_value, old_value){
|
|||
|
||||
|
||||
function send_timbrar_invoice(id){
|
||||
//~ webix.ajax().get('/values/timbrar', {id: id, update: false}, function(text, data){
|
||||
webix.ajax().post('invoices', {opt: 'timbrar', id: id, update: false}, function(text, data){
|
||||
var values = data.json()
|
||||
if(values.ok){
|
||||
|
|
Loading…
Reference in New Issue