From 5aa27e45bdc875a47eae455498d2c8e398be8b77 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 14 Jun 2023 14:02:15 +0200 Subject: [PATCH] refs #4823 Fixes --- utils.js | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/utils.js b/utils.js index 25565ca..bc6a8e8 100644 --- a/utils.js +++ b/utils.js @@ -495,7 +495,20 @@ export async function insertWarehouses(warehouses) { })); await models.warehouse.bulkCreate(warehousesWithDefaults, { - updateOnDuplicate: ['location_gln', 'location_address_addressLine', 'location_address_city', 'location_address_countryCode', 'location_address_postalCode', 'location_address_stateOrProvince', 'lastSync'], + updateOnDuplicate: [ + 'warehouseId', + 'name', + 'location_gln', + 'location_address_addressLine', + 'location_address_city', + 'location_address_countryCode', + 'location_address_postalCode', + 'location_address_stateOrProvince', + 'isDeleted', + 'sequenceNumber', + 'organizationId', + 'lastSync', + ], transaction: tx, }); @@ -521,7 +534,23 @@ export async function insertOrganizations(organizations) { })); await models.organization.bulkCreate(organizationsWithDefaults, { - updateOnDuplicate: ['isConnected', 'lastSync'], + updateOnDuplicate: [ + 'organizationId', + 'sequenceNumber', + 'companyGln', + 'name', + 'commercialName', + 'email', + 'phone', + 'website', + 'rfhRelationId', + 'paymentProviders', + 'endDate', + 'mailingAddress', + 'physicalAddress', + 'isConnected', + 'lastSync', + ], transaction: tx, }); @@ -584,7 +613,30 @@ export async function insertSupplyLines(supplyLines) { lastSync: moment().format('YYYY-MM-DD HH:mm:ss'), })); - await models.supplyLine.bulkCreate(supplyLinesData, { transaction: tx }); + await models.supplyLine.bulkCreate(supplyLinesData, { + updateOnDuplicate: [ + 'supplyLineId', + 'status', + 'numberOfPieces', + 'deliveryPeriodStartDateTime', + 'deliveryPeriodEndDateTime', + 'orderPeriodStartDateTime', + 'orderPeriodEndDateTime', + 'warehouseId', + 'sequenceNumber', + 'type', + 'isDeleted', + 'salesUnit', + 'agreementReferenceCode', + 'agreementReferenceDescription', + 'isLimited', + 'isCustomerSpecific', + 'tradeItemId', + 'organizationId', + 'lastSync', + ], + transaction: tx, + }); const packingConfigurations = []; const volumePrices = [];