7525-devToTest #2542

Merged
alexm merged 231 commits from 7525-devToTest into test 2024-06-04 07:59:34 +00:00
2 changed files with 7 additions and 7 deletions
Showing only changes of commit c136f2783a - Show all commits

View File

@ -18,5 +18,4 @@ VALUES
('InvoiceIn', 'corrective', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
('InvoiceIn', 'exchangeRateUpdate', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
('InvoiceIn', 'invoiceInEmail', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
('InvoiceIn', 'toBook', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
('InvoiceIn', 'toUnbook', 'WRITE', 'ALLOW', 'ROLE', 'buyer');
('InvoiceIn', 'toBook', 'WRITE', 'ALLOW', 'ROLE', 'buyer');

View File

@ -47,10 +47,11 @@ module.exports = Self => {
}
}, myOptions);
if (bookEntry?.ASIEN) {
accountingEntries = await models.Xdiario.count({ASIEN: bookEntry.ASIEN}, myOptions);
let asien = bookEntry?.ASIEN;
if (asien) {
accountingEntries = await models.Xdiario.count({ASIEN: asien}, myOptions);
await models.Xdiario.destroyAll({ASIEN: bookEntry.ASIEN}, myOptions);
await models.Xdiario.destroyAll({ASIEN: asien}, myOptions);
await Self.updateAll({id: invoiceInId}, {isBooked: false}, myOptions);
} else {
const linkedBookEntry = await models.Xdiario.findOne({
@ -61,14 +62,14 @@ module.exports = Self => {
}
}, myOptions);
bookEntry = linkedBookEntry?.ASIEN;
asien = linkedBookEntry?.ASIEN;
isLinked = true;
}
if (tx) await tx.commit();
return {
isLinked,
bookEntry: bookEntry?.ASIEN,
bookEntry: asien,
accountingEntries
};
} catch (e) {