ref #6213 fixformat
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Pablo Natek 2023-09-13 19:22:21 +02:00
parent f82af979ed
commit 7ab8cb37cd
1 changed files with 5 additions and 8 deletions

View File

@ -119,15 +119,12 @@ module.exports = Self => {
Self.observe('after save', async function(ctx) {
if (ctx.instance && ctx.isNewInstance) {
const supplierId = ctx.instance.id;
const models = Self.app.models;
const {id} = ctx.instance;
const {Supplier} = Self.app.models;
const supplier = await models.Supplier.findById(supplierId, null, ctx.options);
await supplier.updateAttribute(
'account',
supplier.account + supplierId,
ctx.options
);
const supplier = await Supplier.findById(id, null, ctx.options);
if (supplier)
await supplier.updateAttribute('account', `${supplier.account}${id}`, ctx.options);
}
});