refs #4823 Bug fix

This commit is contained in:
Guillermo Bonet 2023-06-13 07:20:21 +02:00
parent 9b2f7d12ab
commit d2e6cab7d3
1 changed files with 3 additions and 3 deletions

View File

@ -452,14 +452,14 @@ export async function insertSupplyLine(supplyLine) {
where: { warehouseId: supplyLine.warehouseId }
});
if (!warehouse) {
let warehouse = (await vnRequest('GET', `${env.API_URL}/warehouses/${supplyLine.warehouseId}`, null, null, spinner)).data;
let warehouse = (await vnRequest('GET', `${env.API_URL}/warehouses/${supplyLine.warehouseId}`, null, null, null)).data;
// Check if the organization exists, and if it doesn't, create it
let organization = await models.organization.findOne({
where: { organizationId: warehouse.organizationId }
}, { transaction: tx });
if (!organization) {
let organization = (await vnRequest('GET', `${env.API_URL}/organizations/${warehouse.organizationId}`, null, null, spinner)).data;
let organization = (await vnRequest('GET', `${env.API_URL}/organizations/${warehouse.organizationId}`, null, null, null)).data;
await insertOrganization(organization);
}
@ -471,7 +471,7 @@ export async function insertSupplyLine(supplyLine) {
where: { tradeItemId: supplyLine.tradeItemId }
}, { transaction: tx });
if (!tradeItem) {
let tradeItem = (await vnRequest('GET', `${env.API_URL}/trade-items/${supplyLine.tradeItemId}`, null, null, spinner)).data;
let tradeItem = (await vnRequest('GET', `${env.API_URL}/trade-items/${supplyLine.tradeItemId}`, null, null, null)).data;
await insertTradeItem(tradeItem);
}