diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 9c8f15a94..e108aceaf 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -195,14 +195,6 @@ "This document already exists on this ticket": "Este documento ya existe en el ticket", "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables", "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes", - "This client is not invoiceable": "Este cliente no es facturable", - "serial non editable": "Esta serie no permite asignar la referencia", - "Max shipped required": "La fecha límite es requerida", - "Can't invoice to future": "No se puede facturar a futuro", - "Can't invoice to past": "No se puede facturar a pasado", - "This ticket is already invoiced": "Este ticket ya está facturado", - "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero", - "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa", - "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes", - "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes" + "INACTIVE_PROVIDER": "INACTIVE_PROVIDER", + "nickname": "nickname" } \ No newline at end of file diff --git a/modules/monitor/back/methods/sales-monitor/deleteOrders.js b/modules/monitor/back/methods/sales-monitor/deleteOrders.js index 15a8d862a..d9e1e35f9 100644 --- a/modules/monitor/back/methods/sales-monitor/deleteOrders.js +++ b/modules/monitor/back/methods/sales-monitor/deleteOrders.js @@ -18,7 +18,7 @@ module.exports = Self => { } }); - Self.deleteOrders = async(deletes, options) => { + Self.deleteOrders = async(deletes = [], options) => { const models = Self.app.models; let myOptions = {}; diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index 9ebd51bf4..7cf6da831 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -167,35 +167,26 @@ module.exports = Self => { args.option ], myOptions); - if (originalTicket.addressFk != updatedTicket.addressFk) { - const ticketObservation = await models.TicketObservation.findOne({ - where: { - ticketFk: args.id, - observationTypeFk: observationTypeDelivery.id} + if (originalTicket.addressFk != updatedTicket.addressFk && args.id) { + await models.TicketObservation.destroyAll({ + ticketFk: args.id }, myOptions); - if (ticketObservation) - await ticketObservation.destroy(myOptions); - const address = await models.Address.findOne({ where: {id: args.addressFk}, include: { - relation: 'observations', - scope: { - where: {observationTypeFk: observationTypeDelivery.id}, - include: { - relation: 'observationType' - } - } + relation: 'observations' } }, myOptions); - const [observation] = address.observations(); - if (observation) { - await models.TicketObservation.create({ - ticketFk: args.id, - observationTypeFk: observation.observationTypeFk, - description: observation.description - }, myOptions); + const observations = address.observations(); + if (observations.length) { + const clonedObservations = observations.map(observation => { + observation.ticketFk = args.id; + observation.id = undefined; + return observation; + }); + + await models.TicketObservation.create(clonedObservations, myOptions); } }