This commit is contained in:
parent
5501ff8f4f
commit
75c9d1122c
|
@ -81,5 +81,6 @@
|
|||
"This client can't be invoiced": "Este cliente 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 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