refs #6276 feat:newWarehouse

This commit is contained in:
Sergio De la torre 2024-03-20 13:50:29 +01:00
parent 99689917f5
commit b84351e060
1 changed files with 1 additions and 8 deletions

View File

@ -89,16 +89,9 @@ module.exports = Self => {
const {itemOriginalFk} = await models.Buy.findById(buyFk, {fields: ['itemOriginalFk']}, myOptions); const {itemOriginalFk} = await models.Buy.findById(buyFk, {fields: ['itemOriginalFk']}, myOptions);
if (itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions); if (itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions);
} catch (e) { } catch (e) {
throw new UserError('The sale cannot be tracked'); if (tx) await tx.commit();
} }
if (tx) await tx.commit();
} catch (e) { } catch (e) {
if (e.message == 'The sale cannot be tracked') {
if (tx) tx.commit();
throw e;
}
if (tx) await tx.rollback(); if (tx) await tx.rollback();
throw new UserError('The line could not be marked'); throw new UserError('The line could not be marked');
} }