Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
commit
a6fa9f98fb
|
@ -81,5 +81,6 @@
|
||||||
"This client can't be invoiced": "Este cliente no puede ser facturado",
|
"This client can't be invoiced": "Este cliente no puede ser facturado",
|
||||||
"This ticket can't be invoiced": "Este ticket no puede ser facturado",
|
"This ticket can't be invoiced": "Este ticket no puede ser facturado",
|
||||||
"That item is not available on that day": "El item no esta disponible para esa fecha",
|
"That item is not available on that day": "El item no esta disponible para esa fecha",
|
||||||
"That item doesn't exists": "That item doesn't exists"
|
"That item doesn't exists": "That item doesn't exists",
|
||||||
|
"You cannot add services to an invoiced ticket": "No puedes añadir servicios a un ticket facturado"
|
||||||
}
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.observe('before save', async ctx => {
|
||||||
|
if (ctx.isNewInstance) {
|
||||||
|
let ticketId = ctx.instance.ticketFk;
|
||||||
|
let ticket = await Self.app.models.Ticket.findById(ticketId);
|
||||||
|
if (ticket.refFk)
|
||||||
|
throw new UserError('You cannot add services to an invoiced ticket');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
Loading…
Reference in New Issue