Merge pull request 'cambio landed por created' (#620) from 2902-error-getSuggestedTickets into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #620
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2021-05-11 09:57:39 +00:00
commit ee596b07f1
3 changed files with 6 additions and 14 deletions

View File

@ -96,5 +96,6 @@
"Swift / BIC cannot be empty": "Swift / BIC cannot be empty",
"Role name must be written in camelCase": "Role name must be written in camelCase",
"Client assignment has changed": "I did change the salesperson ~*\"<{{previousWorkerName}}>\"*~ by *\"<{{currentWorkerName}}>\"* from the client [{{clientName}} ({{clientId}})]({{{url}}})",
"None": "None"
"None": "None",
"error densidad = 0": "error densidad = 0"
}

View File

@ -83,12 +83,11 @@ module.exports = function(Self) {
throw new UserError('Invalid account');
await Self.rawSql(
`CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`,
`CALL vn.ledger_doCompensation(CURDATE(), ?, ?, ?, ?, ?, ?)`,
[
Date(),
args.compensationAccount,
args.bankFk,
accountingType.receiptDescription + args.compensationAccount,
accountingType.receiptDescription + clientOriginal.accountingAccount,
args.amountPaid,
args.companyFk,
clientOriginal.accountingAccount

View File

@ -20,12 +20,6 @@ module.exports = Self => {
});
Self.getSuggestedTickets = async id => {
const ticketsInRoute = await Self.app.models.Ticket.find({
where: {routeFk: id},
fields: ['id']
});
const idsToExclude = ticketsInRoute.map(ticket => ticket.id);
const route = await Self.app.models.Route.findById(id);
const zoneAgencyModes = await Self.app.models.ZoneAgencyMode.find({
@ -37,19 +31,17 @@ module.exports = Self => {
const zoneIds = [];
for (let zoneAgencyMode of zoneAgencyModes)
zoneIds.push(zoneAgencyMode.zoneFk);
const minDate = new Date(route.created);
minDate.setHours(0, 0, 0, 0);
const maxDate = new Date(route.created);
maxDate.setHours(23, 59, 59, 59);
let tickets = await Self.app.models.Ticket.find({
where: {
agencyModeFk: route.agencyModeFk,
zoneFk: {inq: zoneIds},
id: {nin: idsToExclude},
created: {between: [minDate, maxDate]}
routeFk: null,
shipped: {between: [minDate, maxDate]}
},
include: [
{