fix: asociar ticketRefund refs #7586
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Carlos Andrés 2024-06-14 17:56:24 +02:00
parent 51078c804b
commit 9b118f83e5
1 changed files with 3 additions and 8 deletions

View File

@ -145,15 +145,10 @@ module.exports = Self => {
const newTicket = await models.Ticket.new(ctx, myOptions);
const ticketRefund = await models.TicketRefund.findOne({
where: {refundTicketFk: ticketId}
await models.TicketRefund.create({
originalTicketFk: ticketId,
refundTicketFk: newTicket.id
}, myOptions);
if (negative && (withWarehouse || !ticketRefund?.id)) {
await models.TicketRefund.create({
originalTicketFk: ticketId,
refundTicketFk: newTicket.id
}, myOptions);
}
return newTicket;
}