funciona
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Javi Gallego 2021-08-12 09:23:19 +02:00
parent 80c414d786
commit 3b9bdc18bf
3 changed files with 16 additions and 33 deletions

View File

@ -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"
}

View File

@ -18,7 +18,7 @@ module.exports = Self => {
}
});
Self.deleteOrders = async(deletes, options) => {
Self.deleteOrders = async(deletes = [], options) => {
const models = Self.app.models;
let myOptions = {};

View File

@ -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);
}
}