#6942 toUnbook #2135
|
@ -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');
|
||||
|
|
|
@ -47,10 +47,11 @@ module.exports = Self => {
|
|||
}
|
||||
}, myOptions);
|
||||
|
||||
jorgep marked this conversation as resolved
|
||||
if (bookEntry?.ASIEN) {
|
||||
accountingEntries = await models.Xdiario.count({ASIEN: bookEntry.ASIEN}, myOptions);
|
||||
let asien = bookEntry?.ASIEN;
|
||||
jgallego marked this conversation as resolved
Outdated
alexm
commented
@jgallego veus be la logica? @jgallego veus be la logica?
jgallego
commented
esta ok esta ok
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue
El numero de ocurrencias de bookEntry.ASIEN es medio-alto.
Propongo crear una variable representativa de este valor y reemplazar donde toque.
Otro enfoque puede ser que en el if, reemplazar bookEntry.ASIEN porque ya es true
Me parece bien.