Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5077-horaEnvio-ticketBasicData
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2023-02-02 08:39:28 +01:00
commit 52a3f77bc5
22 changed files with 172 additions and 141 deletions

View File

@ -12,10 +12,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- (Trabajadores -> Nuevo trabajador) Nueva sección - (Trabajadores -> Nuevo trabajador) Nueva sección
### Changed ### Changed
- - (Entradas -> Compras) Cambiados los campos "Precio Grouping/Packing" por "PVP" y "Precio" por "Coste"
- (Artículos -> Últimas entradas) Cambiados los campos "P.P.U." y "P.P.P." por "PVP"
- (Rutas -> Sumario/Tickets) Actualizados campos de los tickets
### Fixed ### Fixed
- (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas. - (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas.
- (Cliente -> Datos Fiscales) No se permite seleccionar 'Notificar vía e-mail' a los clientes sin e-mail
- (Tickets -> Datos básicos) Permite guardar la hora de envío - (Tickets -> Datos básicos) Permite guardar la hora de envío
- (Tickets -> Añadir pago) Eliminado "null" en las referencias - (Tickets -> Añadir pago) Eliminado "null" en las referencias

View File

@ -0,0 +1,6 @@
UPDATE `vn`.`client`
SET isToBeMailed = FALSE
WHERE
mailAddress is NULL
AND email is NULL
AND isToBeMailed = TRUE;

View File

@ -944,9 +944,9 @@ export default {
routeSummary: { routeSummary: {
header: 'vn-route-summary > vn-card > h5', header: 'vn-route-summary > vn-card > h5',
cost: 'vn-route-summary vn-label-value[label="Cost"]', cost: 'vn-route-summary vn-label-value[label="Cost"]',
firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(2) > span', firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(10) > span',
firstTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor', firstTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor',
firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(3) > span', firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(5) > span',
firstClientDescriptor: '.vn-popover.shown vn-client-descriptor', firstClientDescriptor: '.vn-popover.shown vn-client-descriptor',
goToRouteSummaryButton: 'vn-route-summary > vn-card > h5 > a', goToRouteSummaryButton: 'vn-route-summary > vn-card > h5 > a',

View File

@ -42,6 +42,7 @@ vn-log {
& > td.after, & > td.after,
& > th.after { & > th.after {
width: 40%; width: 40%;
white-space: pre-line;
} }
} }
} }

View File

@ -142,10 +142,13 @@
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user", "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user",
"Email verify": "Email verify", "Email verify": "Email verify",
"Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
"Sale(s) blocked, please contact production": "Sale(s) blocked, please contact production",
"App locked": "App locked by user {{userId}}", "App locked": "App locked by user {{userId}}",
"The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified", "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified",
"Receipt's bank was not found": "Receipt's bank was not found", "Receipt's bank was not found": "Receipt's bank was not found",
"This receipt was not compensated": "This receipt was not compensated", "This receipt was not compensated": "This receipt was not compensated",
"Client's email was not found": "Client's email was not found" "Client's email was not found": "Client's email was not found",
"It is not possible to modify tracked sales": "It is not possible to modify tracked sales",
"It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo",
"It is not possible to modify cloned sales": "It is not possible to modify cloned sales",
"Valid priorities: 1,2,3": "Valid priorities: 1,2,3"
} }

View File

@ -84,7 +84,6 @@
"The current ticket can't be modified": "El ticket actual no puede ser modificado", "The current ticket can't be modified": "El ticket actual no puede ser modificado",
"The current claim can't be modified": "La reclamación actual no puede ser modificada", "The current claim can't be modified": "La reclamación actual no puede ser modificada",
"The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
"Sale(s) blocked, contact production": "Linea(s) bloqueada(s), contacte con produccion",
"Please select at least one sale": "Por favor selecciona al menos una linea", "Please select at least one sale": "Por favor selecciona al menos una linea",
"All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket",
"NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
@ -259,5 +258,9 @@
"Try again": "Vuelve a intentarlo", "Try again": "Vuelve a intentarlo",
"Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9",
"Failed to upload file": "Error al subir archivo", "Failed to upload file": "Error al subir archivo",
"The DOCUWARE PDF document does not exists": "The DOCUWARE PDF document does not exists" "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe",
"It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
"It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
"It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas",
"There is no assigned email for this client": "No hay correo asignado para este cliente"
} }

View File

@ -141,6 +141,16 @@ module.exports = Self => {
done(); done();
} }
Self.validateAsync('isToBeMailed', isToBeMailed, {
message: 'There is no assigned email for this client'
});
function isToBeMailed(err, done) {
if (this.isToBeMailed == true && !this.email)
err();
done();
}
Self.validateAsync('defaultAddressFk', isActive, Self.validateAsync('defaultAddressFk', isActive,
{message: 'Unable to default a disabled consignee'} {message: 'Unable to default a disabled consignee'}
); );

View File

@ -1,5 +1,5 @@
Edit buy(s): Editar compra(s) Edit buy(s): Editar compra(s)
Buying value: Precio Buying value: Coste
Freight value: Porte Freight value: Porte
Commission value: Comisión Commission value: Comisión
Package value: Embalaje Package value: Embalaje

View File

@ -114,8 +114,7 @@
<th translate center field="grouping">Grouping</th> <th translate center field="grouping">Grouping</th>
<th translate center field="buyingValue">Buying value</th> <th translate center field="buyingValue">Buying value</th>
<th translate center field="price3">Import</th> <th translate center field="price3">Import</th>
<th translate center expand field="price2">Grouping price</th> <th translate center expand field="price">PVP</th>
<th translate center expand field="price3">Packing price</th>
</tr> </tr>
</thead> </thead>
<tbody ng-repeat="line in buys"> <tbody ng-repeat="line in buys">
@ -136,8 +135,7 @@
</vn-td> </vn-td>
<td center title="{{::line.buyingValue | currency: 'EUR':2}}">{{::line.buyingValue | currency: 'EUR':2}}</td> <td center title="{{::line.buyingValue | currency: 'EUR':2}}">{{::line.buyingValue | currency: 'EUR':2}}</td>
<td center title="{{::line.quantity * line.buyingValue | currency: 'EUR':2}}">{{::line.quantity * line.buyingValue | currency: 'EUR':2}}</td> <td center title="{{::line.quantity * line.buyingValue | currency: 'EUR':2}}">{{::line.quantity * line.buyingValue | currency: 'EUR':2}}</td>
<td center title="{{::line.price2 | currency: 'EUR':2}}">{{::line.price2 | currency: 'EUR':2}}</td> <td center title="Grouping / Packing">{{::line.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::line.price3 | currency: 'EUR':2 | dashIfEmpty}}</td>
<td center title="{{::line.price3 | currency: 'EUR':2}}">{{::line.price3 | currency: 'EUR':2}}</td>
</tr> </tr>
<tr class="dark-row"> <tr class="dark-row">
<td shrink> <td shrink>

View File

@ -35,8 +35,7 @@
<vn-th field="warehouseFk">Warehouse</vn-th> <vn-th field="warehouseFk">Warehouse</vn-th>
<vn-th field="landed">Landed</vn-th> <vn-th field="landed">Landed</vn-th>
<vn-th number>Entry</vn-th> <vn-th number>Entry</vn-th>
<vn-th number vn-tooltip="Price Per Unit">P.P.U</vn-th> <vn-th vn-tooltip="Grouping / Packing">PVP</vn-th>
<vn-th number vn-tooltip="Price Per Package">P.P.P</vn-th>
<vn-th number class="expendable">Label</vn-th> <vn-th number class="expendable">Label</vn-th>
<vn-th number>Packing</vn-th> <vn-th number>Packing</vn-th>
<vn-th number>Grouping</vn-th> <vn-th number>Grouping</vn-th>
@ -65,8 +64,9 @@
{{::entry.entryFk | dashIfEmpty}} {{::entry.entryFk | dashIfEmpty}}
</span> </span>
</vn-td> </vn-td>
<vn-td number>{{::entry.price2 | dashIfEmpty}}</vn-td> <vn-td title="{{::entry.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::entry.price3 | currency: 'EUR':2 | dashIfEmpty}}">
<vn-td number>{{::entry.price3 | dashIfEmpty}}</vn-td> {{::entry.price2 | currency: 'EUR':2 | dashIfEmpty}} / {{::entry.price3 | currency: 'EUR':2 | dashIfEmpty}}
</vn-td>
<vn-td number class="expendable">{{entry.stickers | dashIfEmpty}}</vn-td> <vn-td number class="expendable">{{entry.stickers | dashIfEmpty}}</vn-td>
<vn-td number> <vn-td number>
<vn-chip translate-attr="{title: 'Packing'}" ng-class="{'message': entry.groupingMode == 2}"> <vn-chip translate-attr="{title: 'Packing'}" ng-class="{'message': entry.groupingMode == 2}">
@ -84,11 +84,11 @@
class="expendable"> class="expendable">
<span <span
vn-tooltip=" vn-tooltip="
{{::$ctrl.$t('Cost')}}: {{::entry.buyingValue| dashIfEmpty}}<br> {{::$ctrl.$t('Cost')}}: {{::entry.buyingValue | currency: 'EUR':2 | dashIfEmpty}}<br>
{{::$ctrl.$t('Package')}}: {{::entry.packageValue| dashIfEmpty}}<br> {{::$ctrl.$t('Package')}}: {{::entry.packageValue | currency: 'EUR':2 | dashIfEmpty}}<br>
{{::$ctrl.$t('Freight')}}: {{::entry.freightValue| dashIfEmpty}}<br> {{::$ctrl.$t('Freight')}}: {{::entry.freightValue | currency: 'EUR':2 | dashIfEmpty}}<br>
{{::$ctrl.$t('Comission')}}: {{::entry.comissionValue| dashIfEmpty}}"> {{::$ctrl.$t('Comission')}}: {{::entry.comissionValue | currency: 'EUR':2 | dashIfEmpty}}">
{{::entry.cost | dashIfEmpty}} {{::entry.cost | currency: 'EUR':2 | dashIfEmpty}}
</span> </span>
</vn-td> </vn-td>
<vn-td number>{{::entry.weight | dashIfEmpty}}</vn-td> <vn-td number>{{::entry.weight | dashIfEmpty}}</vn-td>

View File

@ -50,9 +50,12 @@ module.exports = Self => {
am.name AS agencyModeName, am.name AS agencyModeName,
u.nickname AS userNickname, u.nickname AS userNickname,
vn.ticketTotalVolume(t.id) AS volume, vn.ticketTotalVolume(t.id) AS volume,
tob.description tob.description,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt
FROM vn.route r FROM vn.route r
JOIN ticket t ON t.routeFk = r.id JOIN ticket t ON t.routeFk = r.id
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
LEFT JOIN ticketState ts ON ts.ticketFk = t.id LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
@ -70,7 +73,9 @@ module.exports = Self => {
const where = filter.where; const where = filter.where;
where['r.id'] = filter.id; where['r.id'] = filter.id;
stmt.merge(conn.makeSuffix(filter)); stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeGroupBy('t.id'));
stmt.merge(conn.makeOrderBy(filter.order));
const tickets = await conn.executeStmt(stmt, myOptions); const tickets = await conn.executeStmt(stmt, myOptions);

View File

@ -77,19 +77,35 @@
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th shrink>Order</vn-th> <vn-th shrink>Order</vn-th>
<vn-th number>Ticket id</vn-th> <vn-th>Street</vn-th>
<vn-th>Alias</vn-th> <vn-th>City</vn-th>
<vn-th shrink>PC</vn-th>
<vn-th>Client</vn-th>
<vn-th>Warehouse</vn-th>
<vn-th number shrink>Packages</vn-th> <vn-th number shrink>Packages</vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
<vn-th>Warehouse</vn-th> <vn-th shrink>Packaging</vn-th>
<vn-th shrink>PC</vn-th> <vn-th number>Ticket</vn-th>
<vn-th>Street</vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
</vn-tr> </vn-tr>
</vn-thead> </vn-thead>
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="ticket in $ctrl.summary.tickets"> <vn-tr ng-repeat="ticket in $ctrl.summary.tickets">
<vn-td shrink>{{ticket.priority | dashIfEmpty}}</vn-td> <vn-td shrink>{{ticket.priority | dashIfEmpty}}</vn-td>
<vn-td expand title="{{ticket.address.street}}">{{ticket.street}}</vn-td>
<vn-td expand>{{ticket.city}}</vn-td>
<vn-td shrink>{{ticket.postalCode}}</vn-td>
<vn-td>
<span
ng-click="clientDescriptor.show($event, ticket.clientFk)"
class="link">
{{ticket.nickname}}
</span>
</vn-td>
<vn-td>{{ticket.warehouseName}}</vn-td>
<vn-td number shrink>{{ticket.packages}}</vn-td>
<vn-td shrink>{{ticket.volume}}</vn-td>
<vn-td shrink>{{ticket.ipt}}</vn-td>
<vn-td number> <vn-td number>
<span <span
ng-click="ticketDescriptor.show($event, ticket.id)" ng-click="ticketDescriptor.show($event, ticket.id)"
@ -98,24 +114,12 @@
</span> </span>
</vn-td> </vn-td>
<vn-td> <vn-td>
<span <vn-icon-button
ng-click="clientDescriptor.show($event, ticket.clientFk)" ng-if="::ticket.description"
class="link"> vn-tooltip="{{::ticket.description}}"
{{ticket.nickname}} icon="icon-notes"
</span> tabindex="-1">
</vn-td> </vn-icon-button>
<vn-td number shrink>{{ticket.packages}}</vn-td>
<vn-td shrink>{{ticket.volume}}</vn-td>
<vn-td>{{ticket.warehouseName}}</vn-td>
<vn-td shrink>{{ticket.postalCode}}</vn-td>
<vn-td expand title="{{ticket.address.street}}">{{ticket.street}}</vn-td>
<vn-td shrink>
<vn-icon
ng-if="ticket.notes.length"
vn-tooltip="{{ticket.notes[0].description}}"
icon="insert_drive_file"
class="bright">
</vn-icon>
</vn-td> </vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>

View File

@ -59,8 +59,10 @@
<vn-th field="city">City</vn-th> <vn-th field="city">City</vn-th>
<vn-th field="postalCode" translate-attr="{title: 'Postcode'}" shrink>PC</vn-th> <vn-th field="postalCode" translate-attr="{title: 'Postcode'}" shrink>PC</vn-th>
<vn-th field="clientFk" expand>Client</vn-th> <vn-th field="clientFk" expand>Client</vn-th>
<vn-th field="warehouse" expand>Warehouse</vn-th>
<vn-th field="packages" shrink>Packages</vn-th> <vn-th field="packages" shrink>Packages</vn-th>
<vn-th field="volume" shrink></vn-th> <vn-th field="volume" shrink></vn-th>
<vn-th field="packaging" shrink>Packaging</vn-th>
<vn-th field="id" number>Ticket</vn-th> <vn-th field="id" number>Ticket</vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
@ -100,8 +102,10 @@
{{::ticket.nickname}} {{::ticket.nickname}}
</span> </span>
</vn-td> </vn-td>
<vn-td>{{ticket.warehouseName}}</vn-td>
<vn-td shrink>{{::ticket.packages}}</vn-td> <vn-td shrink>{{::ticket.packages}}</vn-td>
<vn-td shrink>{{::ticket.volume | number:2}}</vn-td> <vn-td shrink>{{::ticket.volume | number:2}}</vn-td>
<vn-td shrink>{{::ticket.ipt}}</vn-td>
<vn-td number> <vn-td number>
<span <span
ng-click="ticketDescriptor.show($event, ticket.id)" ng-click="ticketDescriptor.show($event, ticket.id)"

View File

@ -56,6 +56,13 @@ module.exports = Self => {
const shouldEditCloned = canEditCloned || !hasSaleCloned; const shouldEditCloned = canEditCloned || !hasSaleCloned;
const shouldEditFloramondo = canEditFloramondo || !hasSaleFloramondo; const shouldEditFloramondo = canEditFloramondo || !hasSaleFloramondo;
return shouldEditTracked && shouldEditCloned && shouldEditFloramondo; if (!shouldEditTracked)
throw new UserError('It is not possible to modify tracked sales');
if (!shouldEditCloned)
throw new UserError('It is not possible to modify cloned sales');
if (!shouldEditFloramondo)
throw new UserError('It is not possible to modify sales that their articles are from Floramondo');
return true;
}; };
}; };

View File

@ -43,9 +43,7 @@ module.exports = Self => {
try { try {
const saleIds = sales.map(sale => sale.id); const saleIds = sales.map(sale => sale.id);
const canEditSales = await models.Sale.canEdit(ctx, saleIds, myOptions); await models.Sale.canEdit(ctx, saleIds, myOptions);
if (!canEditSales)
throw new UserError(`Sale(s) blocked, please contact production`);
const ticket = await models.Ticket.findById(ticketId, { const ticket = await models.Ticket.findById(ticketId, {
include: { include: {

View File

@ -37,9 +37,7 @@ module.exports = Self => {
try { try {
const salesIds = sales.map(sale => sale.id); const salesIds = sales.map(sale => sale.id);
const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions); await models.Sale.canEdit(ctx, salesIds, myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
const query = ` const query = `
DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales; DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales;

View File

@ -51,9 +51,7 @@ module.exports = Self => {
try { try {
const salesIds = sales.map(sale => sale.id); const salesIds = sales.map(sale => sale.id);
const canEditSale = await models.Sale.canEdit(ctx, salesIds, myOptions); await models.Sale.canEdit(ctx, salesIds, myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
let changesMade = ''; let changesMade = '';
const promises = []; const promises = [];

View File

@ -50,7 +50,7 @@ describe('sale canEdit()', () => {
it('should return false if any of the sales has a saleTracking record', async() => { it('should return false if any of the sales has a saleTracking record', async() => {
const tx = await models.Sale.beginTransaction({}); const tx = await models.Sale.beginTransaction({});
let error;
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
@ -59,15 +59,15 @@ describe('sale canEdit()', () => {
const sales = [31]; const sales = [31];
const result = await models.Sale.canEdit(ctx, sales, options); await models.Sale.canEdit(ctx, sales, options);
expect(result).toEqual(false);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();
throw e; error = e;
} }
expect(error).toEqual(
new Error('It is not possible to modify tracked sales'));
}); });
}); });
@ -75,22 +75,22 @@ describe('sale canEdit()', () => {
const saleCloned = [29]; const saleCloned = [29];
it('should return false if any of the sales is cloned', async() => { it('should return false if any of the sales is cloned', async() => {
const tx = await models.Sale.beginTransaction({}); const tx = await models.Sale.beginTransaction({});
let error;
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
const buyerId = 35; const buyerId = 35;
const ctx = {req: {accessToken: {userId: buyerId}}}; const ctx = {req: {accessToken: {userId: buyerId}}};
const result = await models.Sale.canEdit(ctx, saleCloned, options); await models.Sale.canEdit(ctx, saleCloned, options);
expect(result).toEqual(false);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();
throw e; error = e;
} }
expect(error).toEqual(
new Error('It is not possible to modify cloned sales'));
}); });
it('should return true if any of the sales is cloned and has the correct role', async() => { it('should return true if any of the sales is cloned and has the correct role', async() => {
@ -130,7 +130,7 @@ describe('sale canEdit()', () => {
it('should return false if any of the sales isFloramondo', async() => { it('should return false if any of the sales isFloramondo', async() => {
const tx = await models.Sale.beginTransaction({}); const tx = await models.Sale.beginTransaction({});
const sales = [26]; const sales = [26];
let error;
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
@ -140,15 +140,15 @@ describe('sale canEdit()', () => {
const saleToEdit = await models.Sale.findById(sales[0], null, options); const saleToEdit = await models.Sale.findById(sales[0], null, options);
await saleToEdit.updateAttribute('itemFk', 9, options); await saleToEdit.updateAttribute('itemFk', 9, options);
const result = await models.Sale.canEdit(ctx, sales, options); await models.Sale.canEdit(ctx, sales, options);
expect(result).toEqual(false);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();
throw e; error = e;
} }
expect(error).toEqual(
new Error('It is not possible to modify sales that their articles are from Floramondo'));
}); });
it('should return true if any of the sales is of isFloramondo and has the correct role', async() => { it('should return true if any of the sales is of isFloramondo and has the correct role', async() => {

View File

@ -40,10 +40,7 @@ module.exports = Self => {
try { try {
const currentLine = await models.Sale.findById(id, null, myOptions); const currentLine = await models.Sale.findById(id, null, myOptions);
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions); await models.Sale.canEdit(ctx, [id], myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
const line = await currentLine.updateAttributes({concept: newConcept}, myOptions); const line = await currentLine.updateAttributes({concept: newConcept}, myOptions);

View File

@ -66,9 +66,7 @@ module.exports = Self => {
const sale = await models.Sale.findById(id, filter, myOptions); const sale = await models.Sale.findById(id, filter, myOptions);
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions); await models.Sale.canEdit(ctx, [id], myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
const oldPrice = sale.price; const oldPrice = sale.price;
const userId = ctx.req.accessToken.userId; const userId = ctx.req.accessToken.userId;

View File

@ -41,9 +41,7 @@ module.exports = Self => {
} }
try { try {
const canEditSale = await models.Sale.canEdit(ctx, [id], myOptions); await models.Sale.canEdit(ctx, [id], myOptions);
if (!canEditSale)
throw new UserError(`Sale(s) blocked, please contact production`);
const filter = { const filter = {
include: { include: {

View File

@ -4,7 +4,7 @@
<div class="content"> <div class="content">
<h1 class="title centered uppercase">{{$t('title')}}</h1> <h1 class="title centered uppercase">{{$t('title')}}</h1>
<p class="centered"> <p class="centered">
Recibo de <strong class="uppercase">{{client.socialName}}</strong>, Recibo #{{receipt.id}} de <strong class="uppercase">{{client.socialName}}</strong>,
la cantidad de <strong>{{receipt.amountPaid}} €</strong> la cantidad de <strong>{{receipt.amountPaid}} €</strong>
en concepto de 'entrega a cuenta'. en concepto de 'entrega a cuenta'.
</p> </p>