Merge branch 'dev' into 7937-claimAgile
This commit is contained in:
commit
26af667727
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue