From a50de4e509d11fae67b6d069bd9f7183330be973 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 15 Jun 2023 09:50:46 +0200 Subject: [PATCH] refs #5842 feat: comprueba que invoiceDate no sea null --- modules/invoiceOut/front/global-invoicing/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/invoiceOut/front/global-invoicing/index.js b/modules/invoiceOut/front/global-invoicing/index.js index f300d4496..965782e5b 100644 --- a/modules/invoiceOut/front/global-invoicing/index.js +++ b/modules/invoiceOut/front/global-invoicing/index.js @@ -42,13 +42,14 @@ class Controller extends Section { this.addresses = null; try { + console.log(this.invoiceDate, this.minInvoicingDate); if (this.clientsToInvoice == 'one' && !this.clientId) throw new UserError('Choose a valid client'); if (!this.invoiceDate || !this.maxShipped) throw new UserError('Invoice date and the max date should be filled'); if (this.invoiceDate < this.maxShipped) throw new UserError('Invoice date can\'t be less than max date'); - if (this.invoiceDate.getTime() < this.minInvoicingDate.getTime()) + if (this.minInvoicingDate && this.invoiceDate.getTime() < this.minInvoicingDate.getTime()) throw new UserError('Exists an invoice with a previous date'); if (!this.companyFk) throw new UserError('Choose a valid company');