8355-testToMaster #3336
|
@ -15,11 +15,11 @@ describe('invoiceIn corrective()', () => {
|
|||
await tx.rollback();
|
||||
});
|
||||
|
||||
it('La función corrective debería devolver un id cuando se ejecuta correctamente', async() => {
|
||||
it('should return an id when executed correctly', async() => {
|
||||
const originalId = 1;
|
||||
const invoiceReason = 3;
|
||||
const invoiceType = 2;
|
||||
const invoiceClass = 1;
|
||||
const invoiceClass = 8;
|
||||
const cloneId = await models.InvoiceIn.corrective(ctx,
|
||||
originalId, invoiceReason, invoiceType, invoiceClass, options);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ const UserError = require('vn-loopback/util/user-error');
|
|||
|
||||
module.exports = Self => {
|
||||
Self.observe('before save', async function(ctx) {
|
||||
if (ctx.newInstance) return;
|
||||
if (ctx.isNewInstance) return;
|
||||
|
||||
const models = Self.app.models;
|
||||
const invoiceIn = await models.InvoiceIn.findById(ctx.currentInstance.invoiceInFk);
|
||||
|
|
|
@ -21,7 +21,7 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.observe('before save', async function(ctx) {
|
||||
if (ctx.newInstance) return;
|
||||
if (ctx.isNewInstance) return;
|
||||
|
||||
const changes = ctx.data || ctx.instance;
|
||||
const orgData = ctx.currentInstance;
|
||||
|
|
Loading…
Reference in New Issue