From 1b9ca1339108a5725f2aac9cb63c6efdb13dc5b3 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 5 Aug 2021 13:42:19 +0200 Subject: [PATCH] Ammends --- db/changes/10340-summer/00-buy_importReference.sql | 10 +++++----- modules/entry/back/methods/entry/importBuys.js | 2 +- modules/entry/back/methods/entry/importBuysPreview.js | 2 +- modules/entry/back/model-config.json | 2 +- modules/entry/back/models/buy-import-reference.json | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/db/changes/10340-summer/00-buy_importReference.sql b/db/changes/10340-summer/00-buy_importReference.sql index 4046b498b..f6bdc059c 100644 --- a/db/changes/10340-summer/00-buy_importReference.sql +++ b/db/changes/10340-summer/00-buy_importReference.sql @@ -1,14 +1,14 @@ -create table `vn`.`buyImportReference` +create table `vn`.`itemMatchProperties` ( itemFk int not null, name varchar(80) not null, - company varchar(80) not null, + producer varchar(80) not null, size int not null, - constraint buyImportReference_pk - primary key (itemFk, name, company, size), + constraint itemMatchProperties_pk + primary key (itemFk, name, producer, size), constraint itemFk___fk foreign key (itemFk) references item (id) on update cascade on delete cascade ) -comment 'Referencias de compras importadas'; +comment 'Propiedades para encontrar articulos equivalentes en verdnatura'; diff --git a/modules/entry/back/methods/entry/importBuys.js b/modules/entry/back/methods/entry/importBuys.js index d8db328a3..5425bdd5d 100644 --- a/modules/entry/back/methods/entry/importBuys.js +++ b/modules/entry/back/methods/entry/importBuys.js @@ -72,7 +72,7 @@ module.exports = Self => { packageFk: buy.packageFk }); - await models.BuyImportReference.upsert({ + await models.ItemMatchProperties.upsert({ itemFk: buy.itemFk, name: buy.description, company: buy.companyName, diff --git a/modules/entry/back/methods/entry/importBuysPreview.js b/modules/entry/back/methods/entry/importBuysPreview.js index 6b03579c7..b3ef92ee5 100644 --- a/modules/entry/back/methods/entry/importBuysPreview.js +++ b/modules/entry/back/methods/entry/importBuysPreview.js @@ -41,7 +41,7 @@ module.exports = Self => { if (packaging) buy.packageFk = packaging.id; - const reference = await models.BuyImportReference.findOne({ + const reference = await models.ItemMatchProperties.findOne({ fields: ['itemFk'], where: { name: buy.description, diff --git a/modules/entry/back/model-config.json b/modules/entry/back/model-config.json index b4c50c3aa..ad5a9063e 100644 --- a/modules/entry/back/model-config.json +++ b/modules/entry/back/model-config.json @@ -5,7 +5,7 @@ "Buy": { "dataSource": "vn" }, - "BuyImportReference": { + "ItemMatchProperties": { "dataSource": "vn" }, "EntryLog": { diff --git a/modules/entry/back/models/buy-import-reference.json b/modules/entry/back/models/buy-import-reference.json index ffe524858..bb9c559a2 100644 --- a/modules/entry/back/models/buy-import-reference.json +++ b/modules/entry/back/models/buy-import-reference.json @@ -1,9 +1,9 @@ { - "name": "BuyImportReference", + "name": "ItemMatchProperties", "base": "VnModel", "options": { "mysql": { - "table": "buyImportReference" + "table": "itemMatchProperties" } }, "properties": {