+
+ Transfer invoice to...
+
Confirm
+
+
+
+
+
+
+
+ #{{id}} - {{::name}}
+
+
+
+
+ {{::description}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js
index 38c3c9434..7d2644158 100644
--- a/modules/invoiceOut/front/descriptor-menu/index.js
+++ b/modules/invoiceOut/front/descriptor-menu/index.js
@@ -125,6 +125,22 @@ class Controller extends Section {
this.$state.go('ticket.card.sale', {id: refundTicket.id});
});
}
+
+ transferInvoice() {
+ const params = {
+ id: this.invoiceOut.id,
+ ref: this.invoiceOut.ref,
+ newClientFk: this.invoiceOut.client.id,
+ cplusRectificationId: this.cplusRectificationType,
+ cplusInvoiceType477Id: this.cplusInvoiceType477,
+ invoiceCorrectionTypeId: this.invoiceCorrectionType
+ };
+ this.$http.post(`InvoiceOuts/transferInvoice`, params).then(res => {
+ const invoiceId = res.data;
+ this.vnApp.showSuccess(this.$t('Invoice trasfered!'));
+ this.$state.go('invoiceOut.card.summary', {id: invoiceId});
+ });
+ }
}
Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail'];
diff --git a/modules/invoiceOut/front/descriptor-menu/locale/en.yml b/modules/invoiceOut/front/descriptor-menu/locale/en.yml
index d299155d7..8fad5f25e 100644
--- a/modules/invoiceOut/front/descriptor-menu/locale/en.yml
+++ b/modules/invoiceOut/front/descriptor-menu/locale/en.yml
@@ -1 +1,3 @@
The following refund tickets have been created: "The following refund tickets have been created: {{ticketIds}}"
+Transfer invoice to...: Transfer invoice to...
+Cplus Type: Cplus Type
\ No newline at end of file
diff --git a/modules/invoiceOut/front/descriptor-menu/locale/es.yml b/modules/invoiceOut/front/descriptor-menu/locale/es.yml
index 393efd58c..0f74b5fec 100644
--- a/modules/invoiceOut/front/descriptor-menu/locale/es.yml
+++ b/modules/invoiceOut/front/descriptor-menu/locale/es.yml
@@ -21,3 +21,5 @@ The invoice PDF document has been regenerated: El documento PDF de la factura ha
The email can't be empty: El correo no puede estar vacío
The following refund tickets have been created: "Se han creado los siguientes tickets de abono: {{ticketIds}}"
Refund...: Abono...
+Transfer invoice to...: Transferir factura a...
+Cplus Type: Cplus Tipo
diff --git a/modules/invoiceOut/front/descriptor-menu/style.scss b/modules/invoiceOut/front/descriptor-menu/style.scss
index b68301961..9e4cf4297 100644
--- a/modules/invoiceOut/front/descriptor-menu/style.scss
+++ b/modules/invoiceOut/front/descriptor-menu/style.scss
@@ -21,4 +21,10 @@ vn-invoice-out-descriptor-menu {
font-size: 1.75rem;
}
}
-}
\ No newline at end of file
+
+}
+@media screen and (min-width: 1000px) {
+ .transferInvoice {
+ min-width: $width-md;
+ }
+}
diff --git a/modules/item/front/request/index.html b/modules/item/front/request/index.html
index 200ce3902..03c8db8ec 100644
--- a/modules/item/front/request/index.html
+++ b/modules/item/front/request/index.html
@@ -26,7 +26,7 @@
Ticket ID
Shipped
Description
- Requester
+ Requester
Requested
Price
Atender
@@ -86,8 +86,8 @@
-
{{request.itemDescription}}
@@ -114,13 +114,13 @@
-
-
-
@@ -149,24 +149,24 @@
ng-click="contextmenu.filterBySelection()">
Filter by selection
-
Exclude selection
-
Remove filter
-
Remove all filters
-
Copy value
-
\ No newline at end of file
+
diff --git a/modules/ticket/back/methods/sale/clone.js b/modules/ticket/back/methods/sale/clone.js
new file mode 100644
index 000000000..a5ccb6de4
--- /dev/null
+++ b/modules/ticket/back/methods/sale/clone.js
@@ -0,0 +1,122 @@
+module.exports = Self => {
+ Self.clone = async(ctx, salesIds, servicesIds, withWarehouse, group, negative, options) => {
+ const models = Self.app.models;
+ const myOptions = {};
+ let tx;
+ const newTickets = [];
+
+ if (typeof options == 'object')
+ Object.assign(myOptions, options);
+
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ }
+
+ try {
+ const salesFilter = {
+ where: {id: {inq: salesIds}},
+ include: {
+ relation: 'components',
+ scope: {
+ fields: ['saleFk', 'componentFk', 'value']
+ }
+ }
+ };
+ const sales = await models.Sale.find(salesFilter, myOptions);
+ let ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))];
+
+ const mappedTickets = new Map();
+
+ if (group) ticketsIds = [ticketsIds[0]];
+
+ for (let ticketId of ticketsIds) {
+ const newTicket = await createTicket(
+ ctx,
+ ticketId,
+ withWarehouse,
+ negative,
+ myOptions
+ );
+ newTickets.push(newTicket);
+ mappedTickets.set(ticketId, newTicket.id);
+ }
+
+ for (const sale of sales) {
+ const newTicketId = mappedTickets.get(sale.ticketFk);
+
+ const createdSale = await models.Sale.create({
+ ticketFk: newTicketId,
+ itemFk: sale.itemFk,
+ quantity: negative ? - sale.quantity : sale.quantity,
+ concept: sale.concept,
+ price: sale.price,
+ discount: sale.discount,
+ }, myOptions);
+
+ const components = sale.components();
+ for (const component of components)
+ component.saleFk = createdSale.id;
+
+ await models.SaleComponent.create(components, myOptions);
+ }
+
+ if (servicesIds && servicesIds.length) {
+ const servicesFilter = {
+ where: {id: {inq: servicesIds}}
+ };
+ const services = await models.TicketService.find(servicesFilter, myOptions);
+
+ for (const service of services) {
+ const newTicketId = mappedTickets.get(service.ticketFk);
+
+ await models.TicketService.create({
+ description: service.description,
+ quantity: negative ? - service.quantity : service.quantity,
+ price: service.price,
+ taxClassFk: service.taxClassFk,
+ ticketFk: newTicketId,
+ ticketServiceTypeFk: service.ticketServiceTypeFk,
+ }, myOptions);
+ }
+ }
+
+ if (tx) await tx.commit();
+
+ return newTickets;
+ } catch (e) {
+ if (tx) await tx.rollback();
+ throw e;
+ }
+
+ async function createTicket(
+ ctx,
+ ticketId,
+ withWarehouse,
+ negative,
+ myOptions
+ ) {
+ const models = Self.app.models;
+ const now = Date.vnNew();
+
+ const ticket = await models.Ticket.findById(ticketId, null, myOptions);
+ ctx.args.clientId = ticket.clientFk;
+ ctx.args.shipped = now;
+ ctx.args.landed = now;
+ ctx.args.warehouseId = withWarehouse ? ticket.warehouseFk : null;
+ ctx.args.companyId = ticket.companyFk;
+ ctx.args.addressId = ticket.addressFk;
+
+ const newTicket = await models.Ticket.new(ctx, myOptions);
+
+ if (negative) {
+ await models.TicketRefund.create({
+ originalTicketFk: ticketId,
+ refundTicketFk: newTicket.id
+ }, myOptions);
+ }
+
+ return newTicket;
+ }
+ };
+};
diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js
index 03302550e..17b70f12b 100644
--- a/modules/ticket/back/methods/sale/refund.js
+++ b/modules/ticket/back/methods/sale/refund.js
@@ -5,7 +5,8 @@ module.exports = Self => {
accepts: [
{
arg: 'salesIds',
- type: ['number']
+ type: ['number'],
+ required: true
},
{
arg: 'servicesIds',
@@ -40,122 +41,23 @@ module.exports = Self => {
myOptions.transaction = tx;
}
- let refundTicket = null;
try {
- const refundAgencyMode = await models.AgencyMode.findOne({
- include: {
- relation: 'zones',
- scope: {
- limit: 1,
- field: ['id', 'name']
- }
- },
- where: {code: 'refund'}
- }, myOptions);
-
- const refoundZoneId = refundAgencyMode.zones()[0].id;
-
- if (salesIds.length) {
- const salesFilter = {
- where: {id: {inq: salesIds}},
- include: {
- relation: 'components',
- scope: {
- fields: ['saleFk', 'componentFk', 'value']
- }
- }
- };
- const sales = await models.Sale.find(salesFilter, myOptions);
- const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))];
-
- const now = Date.vnNew();
- const [firstTicketId] = ticketsIds;
-
- // eslint-disable-next-line max-len
- refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions);
-
- for (const sale of sales) {
- const createdSale = await models.Sale.create({
- ticketFk: refundTicket.id,
- itemFk: sale.itemFk,
- quantity: - sale.quantity,
- concept: sale.concept,
- price: sale.price,
- discount: sale.discount,
- }, myOptions);
-
- const components = sale.components();
- for (const component of components)
- component.saleFk = createdSale.id;
-
- await models.SaleComponent.create(components, myOptions);
- }
- }
- if (!refundTicket) {
- const servicesFilter = {
- where: {id: {inq: servicesIds}}
- };
- const services = await models.TicketService.find(servicesFilter, myOptions);
- const firstTicketId = services[0].ticketFk;
-
- const now = Date.vnNew();
-
- // eslint-disable-next-line max-len
- refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions);
- }
-
- if (servicesIds && servicesIds.length > 0) {
- const servicesFilter = {
- where: {id: {inq: servicesIds}}
- };
- const services = await models.TicketService.find(servicesFilter, myOptions);
- for (const service of services) {
- await models.TicketService.create({
- description: service.description,
- quantity: - service.quantity,
- price: service.price,
- taxClassFk: service.taxClassFk,
- ticketFk: refundTicket.id,
- ticketServiceTypeFk: service.ticketServiceTypeFk,
- }, myOptions);
- }
- }
-
- const query = `CALL vn.ticket_recalc(?, NULL)`;
- await Self.rawSql(query, [refundTicket.id], myOptions);
+ const refundsTicket = await models.Sale.clone(
+ ctx,
+ salesIds,
+ servicesIds,
+ withWarehouse,
+ false,
+ true,
+ myOptions
+ );
if (tx) await tx.commit();
- return refundTicket;
+ return refundsTicket[0];
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
-
- async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions) {
- const models = Self.app.models;
-
- const filter = {include: {relation: 'address'}};
- const ticket = await models.Ticket.findById(ticketId, filter, myOptions);
-
- const refundTicket = await models.Ticket.create({
- clientFk: ticket.clientFk,
- shipped: now,
- addressFk: ticket.address().id,
- agencyModeFk: refundAgencyMode.id,
- nickname: ticket.address().nickname,
- warehouseFk: withWarehouse ? ticket.warehouseFk : null,
- companyFk: ticket.companyFk,
- landed: now,
- zoneFk: refoundZoneId
- }, myOptions);
-
- await models.TicketRefund.create({
- refundTicketFk: refundTicket.id,
- originalTicketFk: ticket.id,
- }, myOptions);
-
- return refundTicket;
- }
};
diff --git a/modules/ticket/back/methods/sale/specs/refund.spec.js b/modules/ticket/back/methods/sale/specs/refund.spec.js
index b81f7f84d..08eb1fabd 100644
--- a/modules/ticket/back/methods/sale/specs/refund.spec.js
+++ b/modules/ticket/back/methods/sale/specs/refund.spec.js
@@ -3,7 +3,7 @@ const LoopBackContext = require('loopback-context');
describe('Sale refund()', () => {
const userId = 5;
- const ctx = {req: {accessToken: userId}};
+ const ctx = {req: {accessToken: userId}, args: {}};
const activeCtx = {
accessToken: {userId},
};
@@ -40,6 +40,7 @@ describe('Sale refund()', () => {
try {
const options = {transaction: tx};
+ const ticketsBefore = await models.Ticket.find({}, options);
const ticket = await models.Sale.refund(ctx, salesIds, servicesIds, withWarehouse, options);
@@ -61,12 +62,13 @@ describe('Sale refund()', () => {
}
]
}, options);
-
+ const ticketsAfter = await models.Ticket.find({}, options);
const salesLength = refundedTicket.ticketSales().length;
const componentsLength = refundedTicket.ticketSales()[0].components().length;
expect(refundedTicket).toBeDefined();
- expect(salesLength).toEqual(2);
+ expect(salesLength).toEqual(1);
+ expect(ticketsBefore.length).toEqual(ticketsAfter.length - 2);
expect(componentsLength).toEqual(4);
await tx.rollback();
diff --git a/modules/ticket/back/methods/ticket/addSale.js b/modules/ticket/back/methods/ticket/addSale.js
index 3455ec2c4..826de6e12 100644
--- a/modules/ticket/back/methods/ticket/addSale.js
+++ b/modules/ticket/back/methods/ticket/addSale.js
@@ -1,5 +1,3 @@
-const UserError = require('vn-loopback/util/user-error');
-
module.exports = Self => {
Self.remoteMethodCtx('addSale', {
description: 'Inserts a new sale for the current ticket',
diff --git a/modules/ticket/back/methods/ticket/getTicketsAdvance.js b/modules/ticket/back/methods/ticket/getTicketsAdvance.js
index ec9314db2..ab40b9559 100644
--- a/modules/ticket/back/methods/ticket/getTicketsAdvance.js
+++ b/modules/ticket/back/methods/ticket/getTicketsAdvance.js
@@ -28,32 +28,27 @@ module.exports = Self => {
{
arg: 'ipt',
type: 'string',
- description: 'Origin Item Packaging Type',
- required: false
+ description: 'Origin Item Packaging Type'
},
{
arg: 'futureIpt',
type: 'string',
- description: 'Destination Item Packaging Type',
- required: false
+ description: 'Destination Item Packaging Type'
},
{
arg: 'id',
type: 'number',
- description: 'Origin id',
- required: false
+ description: 'Origin id'
},
{
arg: 'futureId',
type: 'number',
- description: 'Destination id',
- required: false
+ description: 'Destination id'
},
{
arg: 'isFullMovable',
type: 'boolean',
- description: 'True when lines and stock of origin are equal',
- required: false
+ description: 'True when lines and stock of origin are equal'
},
{
arg: 'filter',
diff --git a/modules/ticket/back/methods/ticket/invoiceTickets.js b/modules/ticket/back/methods/ticket/invoiceTickets.js
index ca1bf15fb..fa3ee93af 100644
--- a/modules/ticket/back/methods/ticket/invoiceTickets.js
+++ b/modules/ticket/back/methods/ticket/invoiceTickets.js
@@ -77,9 +77,10 @@ module.exports = function(Self) {
if (tx) await tx.rollback();
throw e;
}
-
- for (const invoiceId of invoicesIds)
- await models.InvoiceOut.makePdfAndNotify(ctx, invoiceId, null);
+ if (tx) {
+ for (const invoiceId of invoicesIds)
+ await models.InvoiceOut.makePdfAndNotify(ctx, invoiceId, null);
+ }
return invoicesIds;
};
diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js
index 0f5c323ed..288d38d77 100644
--- a/modules/ticket/back/methods/ticket/new.js
+++ b/modules/ticket/back/methods/ticket/new.js
@@ -96,7 +96,7 @@ module.exports = Self => {
if (address.client().type().code === 'normal' && (!agencyMode || agencyMode.code != 'refund')) {
const canCreateTicket = await models.Client.canCreateTicket(args.clientId, myOptions);
if (!canCreateTicket)
- throw new UserError(`You can't create a ticket for a inactive client`);
+ throw new UserError(`You can't create a ticket for an inactive client`);
}
if (!args.shipped && args.landed) {
diff --git a/modules/ticket/back/methods/ticket/refund.js b/modules/ticket/back/methods/ticket/refund.js
index c99b6aa83..758384ae2 100644
--- a/modules/ticket/back/methods/ticket/refund.js
+++ b/modules/ticket/back/methods/ticket/refund.js
@@ -39,7 +39,6 @@ module.exports = Self => {
try {
const filter = {where: {ticketFk: {inq: ticketsIds}}};
-
const sales = await models.Sale.find(filter, myOptions);
const salesIds = sales.map(sale => sale.id);
diff --git a/modules/ticket/back/methods/ticket/specs/new.spec.js b/modules/ticket/back/methods/ticket/specs/new.spec.js
index 0a2f93bc4..9aa073a7b 100644
--- a/modules/ticket/back/methods/ticket/specs/new.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/new.spec.js
@@ -30,7 +30,7 @@ describe('ticket new()', () => {
await tx.rollback();
}
- expect(error).toEqual(new UserError(`You can't create a ticket for a inactive client`));
+ expect(error).toEqual(new UserError(`You can't create a ticket for an inactive client`));
});
it('should throw an error if the address doesnt exist', async() => {
diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js
index a2e92d524..54306510c 100644
--- a/modules/ticket/back/methods/ticket/transferSales.js
+++ b/modules/ticket/back/methods/ticket/transferSales.js
@@ -66,7 +66,7 @@ module.exports = Self => {
const ticket = await models.Ticket.findById(id);
const canCreateTicket = await models.Client.canCreateTicket(ticket.clientFk);
if (!canCreateTicket)
- throw new UserError(`You can't create a ticket for a inactive client`);
+ throw new UserError(`You can't create a ticket for an inactive client`);
ticketId = await cloneTicket(originalTicket, myOptions);
}
diff --git a/modules/ticket/back/models/expeditionScan.json b/modules/ticket/back/models/expeditionScan.json
index 1db2c1238..7b95eff1e 100644
--- a/modules/ticket/back/models/expeditionScan.json
+++ b/modules/ticket/back/models/expeditionScan.json
@@ -8,17 +8,16 @@
"properties": {
"id": {
"type": "number",
- "description": "Identifier"
+ "description": "Identifier",
+ "id": true
},
"expeditionFk": {
"type": "number",
- "description": "Identifier",
- "id": true
+ "description": "Identifier"
},
"palletFk": {
"type": "number",
- "description": "Identifier",
- "id": true
+ "description": "Identifier"
},
"scanned": {
"type": "date",
diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js
index 1c86ddc0c..3589eac4b 100644
--- a/modules/ticket/back/models/sale.js
+++ b/modules/ticket/back/models/sale.js
@@ -12,6 +12,7 @@ module.exports = Self => {
require('../methods/sale/refund')(Self);
require('../methods/sale/canEdit')(Self);
require('../methods/sale/usesMana')(Self);
+ require('../methods/sale/clone')(Self);
Self.validatesPresenceOf('concept', {
message: `Concept cannot be blank`
@@ -33,6 +34,7 @@ module.exports = Self => {
const itemId = changes?.itemFk || instance?.itemFk;
const oldQuantity = instance?.quantity ?? null;
const quantityAdded = newQuantity - oldQuantity;
+ const isReduction = oldQuantity && newQuantity <= oldQuantity;
const ticket = await models.Ticket.findById(
ticketId,
@@ -80,16 +82,17 @@ module.exports = Self => {
ctx.options);
const [itemInfo] = await models.Sale.rawSql(`SELECT available FROM tmp.ticketCalculateItem`, null, ctx.options);
+ const available = itemInfo?.available;
- if (!itemInfo?.available || itemInfo.available < quantityAdded)
+ if ((!isReduction && !available) || available < quantityAdded)
throw new UserError(`This item is not available`);
if (await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*')) return;
- if (newQuantity < item.minQuantity && newQuantity != itemInfo?.available)
+ if (newQuantity < item.minQuantity && newQuantity != available)
throw new UserError('The amount cannot be less than the minimum');
- if (ctx.isNewInstance || newQuantity <= oldQuantity) return;
+ if (ctx.isNewInstance || isReduction) return;
const [saleGrouping] = await models.Sale.rawSql(`
SELECT t.price newPrice
diff --git a/modules/ticket/front/advance/index.html b/modules/ticket/front/advance/index.html
index e6f16c965..a6cf8face 100644
--- a/modules/ticket/front/advance/index.html
+++ b/modules/ticket/front/advance/index.html
@@ -81,6 +81,9 @@
Liters
|
+
+ Zone
+ |
Not Movable
|
@@ -155,6 +158,7 @@
{{::ticket.futureLiters | dashIfEmpty}} |
+ {{::ticket.futureZoneName | dashIfEmpty}} |
{{::ticket.notMovableLines | dashIfEmpty}} |
{{::ticket.futureLines | dashIfEmpty}} |
diff --git a/modules/ticket/front/advance/index.js b/modules/ticket/front/advance/index.js
index 6f8a92ebe..389bcdf14 100644
--- a/modules/ticket/front/advance/index.js
+++ b/modules/ticket/front/advance/index.js
@@ -15,28 +15,22 @@ export default class Controller extends Section {
{
field: 'state',
searchable: false
- },
- {
+ }, {
field: 'futureState',
searchable: false
- },
- {
+ }, {
field: 'totalWithVat',
searchable: false
- },
- {
+ }, {
field: 'futureTotalWithVat',
searchable: false
- },
- {
+ }, {
field: 'shipped',
searchable: false
- },
- {
+ }, {
field: 'futureShipped',
searchable: false
- },
- {
+ }, {
field: 'ipt',
autocomplete: {
url: 'ItemPackingTypes',
@@ -44,8 +38,7 @@ export default class Controller extends Section {
showField: 'description',
valueField: 'code'
}
- },
- {
+ }, {
field: 'futureIpt',
autocomplete: {
url: 'ItemPackingTypes',
@@ -53,6 +46,11 @@ export default class Controller extends Section {
showField: 'description',
valueField: 'code'
}
+ }, {
+ field: 'futureZoneFk',
+ autocomplete: {
+ url: 'Zones',
+ }
},
]
};
@@ -158,27 +156,21 @@ export default class Controller extends Section {
exprBuilder(param, value) {
switch (param) {
case 'id':
- return {'id': value};
case 'futureId':
- return {'futureId': value};
case 'liters':
- return {'liters': value};
case 'futureLiters':
- return {'futureLiters': value};
case 'lines':
- return {'lines': value};
case 'futureLines':
- return {'futureLines': value};
+ case 'totalWithVat':
+ case 'futureTotalWithVat':
+ case 'futureZone':
+ case 'notMovableLines':
+ case 'futureZoneFk':
+ return {[param]: value};
case 'ipt':
return {'ipt': {like: `%${value}%`}};
case 'futureIpt':
return {'futureIpt': {like: `%${value}%`}};
- case 'totalWithVat':
- return {'totalWithVat': value};
- case 'futureTotalWithVat':
- return {'futureTotalWithVat': value};
- case 'notMovableLines':
- return {'notMovableLines': value};
}
}
}
diff --git a/package-lock.json b/package-lock.json
index c3f88bc2c..5bf7a2cb1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "salix-back",
- "version": "23.42.01",
+ "version": "23.46.01",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "salix-back",
- "version": "23.42.01",
+ "version": "23.46.01",
"license": "GPL-3.0",
"dependencies": {
"axios": "^1.2.2",
diff --git a/package.json b/package.json
index 3320705f5..b1539f9a0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "salix-back",
- "version": "23.42.01",
+ "version": "23.46.01",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",
diff --git a/print/templates/reports/invoice/invoice.js b/print/templates/reports/invoice/invoice.js
index 1c9965d3b..b26472b08 100755
--- a/print/templates/reports/invoice/invoice.js
+++ b/print/templates/reports/invoice/invoice.js
@@ -7,6 +7,7 @@ module.exports = {
mixins: [vnReport],
async serverPrefetch() {
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
+
this.checkMainEntity(this.invoice);
this.client = await this.findOneFromDef('client', [this.reference]);
this.taxes = await this.rawSqlFromDef(`taxes`, [this.reference]);
|