diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html
index de7a86d3b..cad226416 100644
--- a/modules/client/front/descriptor/index.html
+++ b/modules/client/front/descriptor/index.html
@@ -105,7 +105,7 @@
diff --git a/modules/client/front/descriptor/locale/es.yml b/modules/client/front/descriptor/locale/es.yml
index e6aca9665..71723e654 100644
--- a/modules/client/front/descriptor/locale/es.yml
+++ b/modules/client/front/descriptor/locale/es.yml
@@ -3,5 +3,6 @@ View consumer report: Ver informe de consumo
From date: Fecha desde
To date: Fecha hasta
Go to user: Ir al usuario
+Go to supplier: Ir al proveedor
Client invoices list: Listado de facturas del cliente
Pay method: Forma de pago
\ No newline at end of file
diff --git a/modules/entry/back/methods/entry/editLatestBuys.js b/modules/entry/back/methods/entry/editLatestBuys.js
index cae4c1d10..90f1454b4 100644
--- a/modules/entry/back/methods/entry/editLatestBuys.js
+++ b/modules/entry/back/methods/entry/editLatestBuys.js
@@ -70,17 +70,14 @@ module.exports = Self => {
const models = Self.app.models;
const model = models[modelName];
try {
- let result;
-
const promises = [];
const value = {};
value[field] = newValue;
if (filter) {
ctx.args.filter = {where: filter, limit: null};
- lines = await models.Buy.latestBuysFilter(ctx, null, myOptions);// ctx?
+ lines = await models.Buy.latestBuysFilter(ctx, null, myOptions);
}
- // get lines
const targets = lines.map(line => {
return line[identifier];
@@ -88,7 +85,7 @@ module.exports = Self => {
for (let target of targets)
promises.push(model.upsertWithWhere({id: target}, value, myOptions));
- result = await Promise.all(promises);
+ const result = await Promise.all(promises);
if (tx) await tx.commit();
diff --git a/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js b/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js
index b17b0ab21..2413c18f6 100644
--- a/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js
+++ b/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js
@@ -6,7 +6,7 @@ describe('Buy editLatestsBuys()', () => {
const options = {transaction: tx};
try {
- let ctx = {
+ const ctx = {
args: {
search: 'Ranged weapon longbow 2m'
}
@@ -18,7 +18,35 @@ describe('Buy editLatestsBuys()', () => {
const newValue = 99;
const lines = [{itemFk: original.itemFk, id: original.id}];
- await models.Buy.editLatestBuys(field, newValue, lines, options);
+ await models.Buy.editLatestBuys(ctx, field, newValue, lines, null, options);
+
+ const [result] = await models.Buy.latestBuysFilter(ctx, null, options);
+
+ expect(result[field]).toEqual(newValue);
+
+ await tx.rollback();
+ } catch (e) {
+ await tx.rollback();
+ throw e;
+ }
+ });
+
+ it('should change the value of a given column for filter', async() => {
+ const tx = await models.Buy.beginTransaction({});
+ const options = {transaction: tx};
+
+ try {
+ const filter = {typeFk: 1};
+ const ctx = {
+ args: {
+ filter: filter
+ }
+ };
+
+ const field = 'size';
+ const newValue = 88;
+
+ await models.Buy.editLatestBuys(ctx, field, newValue, null, filter, options);
const [result] = await models.Buy.latestBuysFilter(ctx, null, options);