fix: refs #8388 update booking status in toUnbook method
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2025-02-14 14:23:43 +01:00
parent c79867188a
commit f9d1a8c0c2
1 changed files with 3 additions and 3 deletions

View File

@ -48,12 +48,10 @@ module.exports = Self => {
}, myOptions);
let asien = bookEntry?.ASIEN;
const invoiceIn = await Self.findById(invoiceInId, myOptions);
if (asien) {
accountingEntries = await models.Xdiario.count({ASIEN: asien}, myOptions);
await models.Xdiario.destroyAll({ASIEN: asien}, myOptions);
const invoiceIn = await Self.findById(invoiceInId, myOptions);
await invoiceIn.updateAttribute('isBooked', false, myOptions);
} else {
const linkedBookEntry = await models.Xdiario.findOne({
fields: ['ASIEN'],
@ -66,6 +64,8 @@ module.exports = Self => {
asien = linkedBookEntry?.ASIEN;
isLinked = true;
}
await invoiceIn.updateAttribute('isBooked', false, myOptions);
if (tx) await tx.commit();
return {