Merge pull request 'cambio landed por created' (#620) from 2902-error-getSuggestedTickets into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #620 Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
commit
ee596b07f1
|
@ -96,5 +96,6 @@
|
||||||
"Swift / BIC cannot be empty": "Swift / BIC cannot be empty",
|
"Swift / BIC cannot be empty": "Swift / BIC cannot be empty",
|
||||||
"Role name must be written in camelCase": "Role name must be written in camelCase",
|
"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}}})",
|
"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"
|
||||||
}
|
}
|
|
@ -83,12 +83,11 @@ module.exports = function(Self) {
|
||||||
throw new UserError('Invalid account');
|
throw new UserError('Invalid account');
|
||||||
|
|
||||||
await Self.rawSql(
|
await Self.rawSql(
|
||||||
`CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`,
|
`CALL vn.ledger_doCompensation(CURDATE(), ?, ?, ?, ?, ?, ?)`,
|
||||||
[
|
[
|
||||||
Date(),
|
|
||||||
args.compensationAccount,
|
args.compensationAccount,
|
||||||
args.bankFk,
|
args.bankFk,
|
||||||
accountingType.receiptDescription + args.compensationAccount,
|
accountingType.receiptDescription + clientOriginal.accountingAccount,
|
||||||
args.amountPaid,
|
args.amountPaid,
|
||||||
args.companyFk,
|
args.companyFk,
|
||||||
clientOriginal.accountingAccount
|
clientOriginal.accountingAccount
|
||||||
|
|
|
@ -20,12 +20,6 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getSuggestedTickets = async id => {
|
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 route = await Self.app.models.Route.findById(id);
|
||||||
|
|
||||||
const zoneAgencyModes = await Self.app.models.ZoneAgencyMode.find({
|
const zoneAgencyModes = await Self.app.models.ZoneAgencyMode.find({
|
||||||
|
@ -37,19 +31,17 @@ module.exports = Self => {
|
||||||
const zoneIds = [];
|
const zoneIds = [];
|
||||||
for (let zoneAgencyMode of zoneAgencyModes)
|
for (let zoneAgencyMode of zoneAgencyModes)
|
||||||
zoneIds.push(zoneAgencyMode.zoneFk);
|
zoneIds.push(zoneAgencyMode.zoneFk);
|
||||||
|
|
||||||
const minDate = new Date(route.created);
|
const minDate = new Date(route.created);
|
||||||
minDate.setHours(0, 0, 0, 0);
|
minDate.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
const maxDate = new Date(route.created);
|
const maxDate = new Date(route.created);
|
||||||
maxDate.setHours(23, 59, 59, 59);
|
maxDate.setHours(23, 59, 59, 59);
|
||||||
|
|
||||||
let tickets = await Self.app.models.Ticket.find({
|
let tickets = await Self.app.models.Ticket.find({
|
||||||
where: {
|
where: {
|
||||||
agencyModeFk: route.agencyModeFk,
|
agencyModeFk: route.agencyModeFk,
|
||||||
zoneFk: {inq: zoneIds},
|
zoneFk: {inq: zoneIds},
|
||||||
id: {nin: idsToExclude},
|
routeFk: null,
|
||||||
created: {between: [minDate, maxDate]}
|
shipped: {between: [minDate, maxDate]}
|
||||||
},
|
},
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue