refs #4823 Bug fixes

This commit is contained in:
Guillermo Bonet 2023-06-12 14:51:34 +02:00
parent e4461e255d
commit 9b2f7d12ab
2 changed files with 5 additions and 6 deletions

View File

@ -19,14 +19,14 @@ console.log(chalk.hex('#06c581')(
` `
)) ))
let sequelize, conSpinner let sequelize, spinner;
try { try {
conSpinner = ora('Creating database connection...').start(); spinner = ora('Creating database connection...').start();
sequelize = createConn(); sequelize = createConn();
await checkCon(); await checkCon();
conSpinner.succeed(); spinner.succeed();
} catch (err) { } catch (err) {
conSpinner.fail(); spinner.fail();
criticalError(err); criticalError(err);
} }
@ -165,7 +165,6 @@ try {
criticalError(err); criticalError(err);
} }
let spinner;
try { try {
const action = JSON.parse(env.FORCE_SYNC) ? { force: true } : { alter: true }; const action = JSON.parse(env.FORCE_SYNC) ? { force: true } : { alter: true };
const actionMsg = JSON.parse(env.FORCE_SYNC) ? 'Forcing' : 'Altering'; const actionMsg = JSON.parse(env.FORCE_SYNC) ? 'Forcing' : 'Altering';

View File

@ -449,7 +449,7 @@ export async function insertSupplyLine(supplyLine) {
try { try {
// Check if the warehouse exists, and if it doesn't, create it // Check if the warehouse exists, and if it doesn't, create it
let warehouse = await models.warehouse.findOne({ let warehouse = await models.warehouse.findOne({
where: { warehouseId: object.warehouseId } where: { warehouseId: supplyLine.warehouseId }
}); });
if (!warehouse) { 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, spinner)).data;