7565-testToMaster #2567
|
@ -18,5 +18,4 @@ VALUES
|
||||||
('InvoiceIn', 'corrective', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
|
('InvoiceIn', 'corrective', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
|
||||||
('InvoiceIn', 'exchangeRateUpdate', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
|
('InvoiceIn', 'exchangeRateUpdate', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
|
||||||
('InvoiceIn', 'invoiceInEmail', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
|
('InvoiceIn', 'invoiceInEmail', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
|
||||||
('InvoiceIn', 'toBook', 'WRITE', 'ALLOW', 'ROLE', 'buyer'),
|
('InvoiceIn', 'toBook', 'WRITE', 'ALLOW', 'ROLE', 'buyer');
|
||||||
('InvoiceIn', 'toUnbook', 'WRITE', 'ALLOW', 'ROLE', 'buyer');
|
|
||||||
|
|
|
@ -47,10 +47,11 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (bookEntry?.ASIEN) {
|
let asien = bookEntry?.ASIEN;
|
||||||
accountingEntries = await models.Xdiario.count({ASIEN: bookEntry.ASIEN}, myOptions);
|
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);
|
await Self.updateAll({id: invoiceInId}, {isBooked: false}, myOptions);
|
||||||
} else {
|
} else {
|
||||||
const linkedBookEntry = await models.Xdiario.findOne({
|
const linkedBookEntry = await models.Xdiario.findOne({
|
||||||
|
@ -61,14 +62,14 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
bookEntry = linkedBookEntry?.ASIEN;
|
asien = linkedBookEntry?.ASIEN;
|
||||||
isLinked = true;
|
isLinked = true;
|
||||||
}
|
}
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isLinked,
|
isLinked,
|
||||||
bookEntry: bookEntry?.ASIEN,
|
bookEntry: asien,
|
||||||
accountingEntries
|
accountingEntries
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue