Fix - Pasar notas de ticket a factura

This commit is contained in:
Mauricio Baeza 2018-01-04 21:29:40 -06:00
parent ca9fe39f5e
commit d88caeb8c6
1 changed files with 8 additions and 0 deletions

View File

@ -4099,6 +4099,11 @@ class Tickets(BaseModel):
else:
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
def add(cls, values, user):
productos = util.loads(values.pop('productos'))
@ -4153,6 +4158,7 @@ class Tickets(BaseModel):
totals_tax = {}
total_trasladados = None
total_retenciones = None
notes = Tickets.get_notes(tickets)
details = TicketsDetalle.select().where(TicketsDetalle.ticket.in_(tickets))
@ -4226,6 +4232,7 @@ class Tickets(BaseModel):
'total_mn': total_mn,
'total_trasladados': total_trasladados,
'total_retenciones': total_retenciones,
'notas': notes,
}
return data
@ -4277,6 +4284,7 @@ class Tickets(BaseModel):
obj.total = totals['total']
obj.saldo = totals['total']
obj.total_mn = totals['total_mn']
obj.notas = totals['notas']
obj.save()
cls._cancel_tickets(cls, obj, tickets)