Merge branch 'dev' into 7937-claimAgile

This commit is contained in:
Javi Gallego 2025-02-18 12:53:53 +01:00
commit 26af667727
5 changed files with 23 additions and 5 deletions

View File

@ -257,5 +257,6 @@
"Ticket has been delivered out of order": "The ticket {{ticket}} of route {{{fullUrl}}} has been delivered out of order.",
"clonedFromTicketWeekly": ", that is a cloned sale from ticket {{ ticketWeekly }}",
"negativeReplaced": "Replaced item [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} with [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} from ticket [{{ticketId}}]({{{ticketUrl}}})",
"The tag and priority can't be repeated": "The tag and priority can't be repeated"
"The tag and priority can't be repeated": "The tag and priority can't be repeated",
"duplicateWarehouse": "The introduced warehouse already exists"
}

View File

@ -398,5 +398,6 @@
"Ticket has been delivered out of order": "El ticket {{ticket}} {{{fullUrl}}} no ha sido entregado en su orden.",
"Price cannot be blank": "El precio no puede estar en blanco",
"clonedFromTicketWeekly": ", que es una linea clonada del ticket {{ticketWeekly}}",
"negativeReplaced": "Sustituido el articulo [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} por [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} del ticket [{{ticketId}}]({{{ticketUrl}}})"
"negativeReplaced": "Sustituido el articulo [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} por [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} del ticket [{{ticketId}}]({{{ticketUrl}}})",
"duplicateWarehouse": "El almacén seleccionado ya existe en la zona"
}

View File

@ -48,12 +48,10 @@ module.exports = Self => {
}, myOptions);
let asien = bookEntry?.ASIEN;
const invoiceIn = await Self.findById(invoiceInId, myOptions);
if (asien) {
accountingEntries = await models.Xdiario.count({ASIEN: asien}, myOptions);
await models.Xdiario.destroyAll({ASIEN: asien}, myOptions);
const invoiceIn = await Self.findById(invoiceInId, myOptions);
await invoiceIn.updateAttribute('isBooked', false, myOptions);
} else {
const linkedBookEntry = await models.Xdiario.findOne({
fields: ['ASIEN'],
@ -66,6 +64,8 @@ module.exports = Self => {
asien = linkedBookEntry?.ASIEN;
isLinked = true;
}
await invoiceIn.updateAttribute('isBooked', false, myOptions);
if (tx) await tx.commit();
return {

View File

@ -67,6 +67,11 @@ module.exports = Self => {
type: 'number',
description: 'The freighter supplier id'
},
{
arg: 'entrySupplierFk',
type: 'number',
description: 'The supplier of the entry(not freighter) id'
},
],
returns: {
type: ['Object'],
@ -94,6 +99,8 @@ module.exports = Self => {
return {'t.landed': {lte: value}};
case 'continent':
return {'cnt.code': value};
case 'entrySupplierFk':
return {'e.supplierFk': value};
case 'id':
case 'agencyModeFk':
case 'warehouseOutFk':

View File

@ -0,0 +1,9 @@
let UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY')
return new UserError(`duplicateWarehouse`);
return err;
});
};