forked from elmau/empresa-libre
Fix - Pasar notas de ticket a factura
This commit is contained in:
commit
5f6ccf1a77
|
@ -2317,6 +2317,8 @@ class ImportFacturaLibre(object):
|
||||||
nombre = 'COMERCIALIZADORA PECOLLA SA DE CV'
|
nombre = 'COMERCIALIZADORA PECOLLA SA DE CV'
|
||||||
elif rfc == 'SMA850101TQ4':
|
elif rfc == 'SMA850101TQ4':
|
||||||
nombre = 'SECRETARIA DE MARINA ARMADA DE MEXICO DRAGA BAHIA CHAMELA ADR-05'
|
nombre = 'SECRETARIA DE MARINA ARMADA DE MEXICO DRAGA BAHIA CHAMELA ADR-05'
|
||||||
|
elif rfc == 'GTR0610314Z0':
|
||||||
|
nombre = 'GRUPO TORQUE SA DE CV'
|
||||||
|
|
||||||
tipo_persona = 1
|
tipo_persona = 1
|
||||||
if rfc == 'XEXX010101000':
|
if rfc == 'XEXX010101000':
|
||||||
|
|
|
@ -4099,6 +4099,11 @@ class Tickets(BaseModel):
|
||||||
else:
|
else:
|
||||||
return user.sucursal.serie_tickets or default_serie
|
return user.sucursal.serie_tickets or default_serie
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_notes(cls, tickets):
|
||||||
|
rows = Tickets.select(Tickets.notas).where(Tickets.id.in_(tickets))
|
||||||
|
return '\n'.join([r.notas for r in rows])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add(cls, values, user):
|
def add(cls, values, user):
|
||||||
productos = util.loads(values.pop('productos'))
|
productos = util.loads(values.pop('productos'))
|
||||||
|
@ -4153,6 +4158,7 @@ class Tickets(BaseModel):
|
||||||
totals_tax = {}
|
totals_tax = {}
|
||||||
total_trasladados = None
|
total_trasladados = None
|
||||||
total_retenciones = None
|
total_retenciones = None
|
||||||
|
notes = Tickets.get_notes(tickets)
|
||||||
|
|
||||||
details = TicketsDetalle.select().where(TicketsDetalle.ticket.in_(tickets))
|
details = TicketsDetalle.select().where(TicketsDetalle.ticket.in_(tickets))
|
||||||
|
|
||||||
|
@ -4226,6 +4232,7 @@ class Tickets(BaseModel):
|
||||||
'total_mn': total_mn,
|
'total_mn': total_mn,
|
||||||
'total_trasladados': total_trasladados,
|
'total_trasladados': total_trasladados,
|
||||||
'total_retenciones': total_retenciones,
|
'total_retenciones': total_retenciones,
|
||||||
|
'notas': notes,
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -4277,6 +4284,7 @@ class Tickets(BaseModel):
|
||||||
obj.total = totals['total']
|
obj.total = totals['total']
|
||||||
obj.saldo = totals['total']
|
obj.saldo = totals['total']
|
||||||
obj.total_mn = totals['total_mn']
|
obj.total_mn = totals['total_mn']
|
||||||
|
obj.notas = totals['notas']
|
||||||
obj.save()
|
obj.save()
|
||||||
cls._cancel_tickets(cls, obj, tickets)
|
cls._cancel_tickets(cls, obj, tickets)
|
||||||
|
|
||||||
|
@ -5085,6 +5093,8 @@ def _importar_facturas(rows):
|
||||||
detalles = row.pop('detalles')
|
detalles = row.pop('detalles')
|
||||||
impuestos = row.pop('impuestos')
|
impuestos = row.pop('impuestos')
|
||||||
cliente = row.pop('cliente')
|
cliente = row.pop('cliente')
|
||||||
|
if cliente['rfc'] == 'GTR0610314Z0':
|
||||||
|
cliente['slug'] = 'grupo_torque_sa_de_cv'
|
||||||
row['cliente'] = Socios.get(**cliente)
|
row['cliente'] = Socios.get(**cliente)
|
||||||
with database_proxy.atomic() as txn:
|
with database_proxy.atomic() as txn:
|
||||||
if _existe_factura(row):
|
if _existe_factura(row):
|
||||||
|
@ -5157,8 +5167,12 @@ def _get_id_unidad(unidad):
|
||||||
def _get_impuestos(impuestos):
|
def _get_impuestos(impuestos):
|
||||||
lines = '|'
|
lines = '|'
|
||||||
for impuesto in impuestos:
|
for impuesto in impuestos:
|
||||||
|
# ~ print (dict(impuesto))
|
||||||
if impuesto['tasa'] == '-2/3':
|
if impuesto['tasa'] == '-2/3':
|
||||||
tasa = str(round(2/3, 6))
|
tasa = str(round(2/3, 6))
|
||||||
|
else:
|
||||||
|
if impuesto['tasa'] == 'EXENTO':
|
||||||
|
tasa = '0.00'
|
||||||
else:
|
else:
|
||||||
tasa = str(round(float(impuesto['tasa']) / 100.0, 6))
|
tasa = str(round(float(impuesto['tasa']) / 100.0, 6))
|
||||||
|
|
||||||
|
@ -5472,6 +5486,7 @@ def _importar_productos(archivo):
|
||||||
taxes = [SATImpuestos.select().where(SATImpuestos.id==6)]
|
taxes = [SATImpuestos.select().where(SATImpuestos.id==6)]
|
||||||
else:
|
else:
|
||||||
taxes = []
|
taxes = []
|
||||||
|
try:
|
||||||
for i in range(0, len(impuestos), 4):
|
for i in range(0, len(impuestos), 4):
|
||||||
w = {
|
w = {
|
||||||
'key': impuestos[i],
|
'key': impuestos[i],
|
||||||
|
@ -5480,6 +5495,9 @@ def _importar_productos(archivo):
|
||||||
'tasa': float(impuestos[i+3]),
|
'tasa': float(impuestos[i+3]),
|
||||||
}
|
}
|
||||||
taxes.append(SATImpuestos.get_o_crea(w))
|
taxes.append(SATImpuestos.get_o_crea(w))
|
||||||
|
except IndexError:
|
||||||
|
print (data)
|
||||||
|
continue
|
||||||
|
|
||||||
with database_proxy.transaction():
|
with database_proxy.transaction():
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -109,6 +109,7 @@ IMPUESTOS = {
|
||||||
'ISR': '001',
|
'ISR': '001',
|
||||||
'IVA': '002',
|
'IVA': '002',
|
||||||
'IEPS': '003',
|
'IEPS': '003',
|
||||||
|
'EXENTO': '000',
|
||||||
'ISH': '000',
|
'ISH': '000',
|
||||||
'INSPECCION DE OBRA': '000',
|
'INSPECCION DE OBRA': '000',
|
||||||
'ICIC': '000',
|
'ICIC': '000',
|
||||||
|
|
Loading…
Reference in New Issue