Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-04-23 13:30:43 +02:00
commit a6fa9f98fb
2 changed files with 14 additions and 1 deletions

View File

@ -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"
} }

View File

@ -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');
}
});
};