This commit is contained in:
parent
f82af979ed
commit
7ab8cb37cd
|
@ -119,15 +119,12 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.observe('after save', async function(ctx) {
|
Self.observe('after save', async function(ctx) {
|
||||||
if (ctx.instance && ctx.isNewInstance) {
|
if (ctx.instance && ctx.isNewInstance) {
|
||||||
const supplierId = ctx.instance.id;
|
const {id} = ctx.instance;
|
||||||
const models = Self.app.models;
|
const {Supplier} = Self.app.models;
|
||||||
|
|
||||||
const supplier = await models.Supplier.findById(supplierId, null, ctx.options);
|
const supplier = await Supplier.findById(id, null, ctx.options);
|
||||||
await supplier.updateAttribute(
|
if (supplier)
|
||||||
'account',
|
await supplier.updateAttribute('account', `${supplier.account}${id}`, ctx.options);
|
||||||
supplier.account + supplierId,
|
|
||||||
ctx.options
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue