Merge pull request 'hotfix length sales' (!1785) from 4764-hotfixServices into master
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1785 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
93db2663a8
|
@ -55,7 +55,7 @@ module.exports = Self => {
|
|||
|
||||
const refoundZoneId = refundAgencyMode.zones()[0].id;
|
||||
|
||||
if (salesIds) {
|
||||
if (salesIds.length) {
|
||||
const salesFilter = {
|
||||
where: {id: {inq: salesIds}},
|
||||
include: {
|
||||
|
@ -91,16 +91,14 @@ module.exports = Self => {
|
|||
await models.SaleComponent.create(components, myOptions);
|
||||
}
|
||||
}
|
||||
|
||||
if (!refundTicket) {
|
||||
const servicesFilter = {
|
||||
where: {id: {inq: servicesIds}}
|
||||
};
|
||||
const services = await models.TicketService.find(servicesFilter, myOptions);
|
||||
const ticketsIds = [...new Set(services.map(service => service.ticketFk))];
|
||||
const firstTicketId = services[0].ticketFk;
|
||||
|
||||
const now = Date.vnNew();
|
||||
const [firstTicketId] = ticketsIds;
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions);
|
||||
|
|
Loading…
Reference in New Issue