This commit is contained in:
parent
f82af979ed
commit
7ab8cb37cd
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue