Merge branch 'dev' into 7747-DeleteBuyUltimateAndBuyUltimateFromInterval
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Ivan Mas 2024-09-06 08:44:00 +00:00
commit 8e87b7e6ba
2 changed files with 5 additions and 2 deletions

View File

@ -371,5 +371,6 @@
"The sale not exists in the item shelving": "La venta no existe en la estantería del artículo",
"The entry not have stickers": "La entrada no tiene etiquetas",
"Too many records": "Demasiados registros",
"Original invoice not found": "Factura original no encontrada"
}
"Original invoice not found": "Factura original no encontrada",
"The entry has no lines or does not exist": "La entrada no tiene lineas o no existe"
}

View File

@ -1,5 +1,6 @@
const {toCSV} = require('vn-loopback/util/csv');
const {flatten} = require('vn-loopback/util/flatten');
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('getBuysCsv', {
@ -36,6 +37,7 @@ module.exports = Self => {
Self.getBuysCsv = async(ctx, id, options) => {
const data = await Self.getBuys(ctx, id, null, options);
if (!data.length) throw new UserError('The entry has no lines or does not exist');
const dataFlatted = flatten(data);
return [toCSV(dataFlatted), 'text/csv', `inline; filename="buys-${id}.csv"`];
};