8355-testToMaster #3336

Merged
alexm merged 241 commits from 8355-testToMaster into master 2025-01-07 06:44:57 +00:00
1 changed files with 12 additions and 0 deletions
Showing only changes of commit 9ece52c5ce - Show all commits

View File

@ -72,6 +72,7 @@ module.exports = Self => {
) => { ) => {
let tx; let tx;
const myOptions = {userId: ctx.req.accessToken.userId}; const myOptions = {userId: ctx.req.accessToken.userId};
const models = Self.app.models;
if (typeof options == 'object') Object.assign(myOptions, options); if (typeof options == 'object') Object.assign(myOptions, options);
@ -95,6 +96,17 @@ module.exports = Self => {
withholdingSageFk withholdingSageFk
}, myOptions); }, myOptions);
if (currencyFk) {
const currency = await models.Currency.findById(currencyFk, null, myOptions);
if (currency.code === 'EUR') {
const invoiceInTaxes = await models.InvoiceInTax.find(
{where: {invoiceInFk: id}}, myOptions);
for (const invoiceInTax of invoiceInTaxes)
await invoiceInTax.updateAttribute('foreignValue', null, myOptions);
}
}
if (tx) await tx.commit(); if (tx) await tx.commit();
return invoiceIn; return invoiceIn;
} catch (e) { } catch (e) {