From fcca5c5eab3234b162e3b080911444a00f8b12d5 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Wed, 18 Nov 2020 17:22:40 +0100 Subject: [PATCH 1/2] added a quick link to invoices --- modules/client/front/descriptor/index.html | 9 ++++++++- modules/client/front/descriptor/locale/es.yml | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html index 1eee5d8536..634436395e 100644 --- a/modules/client/front/descriptor/index.html +++ b/modules/client/front/descriptor/index.html @@ -79,13 +79,20 @@
+ + +
+
-
+
Date: Thu, 19 Nov 2020 10:51:28 +0100 Subject: [PATCH 2/2] hasToInvoice gets enabled with isActive --- modules/client/front/fiscal-data/index.js | 8 ++++++++ modules/client/front/fiscal-data/index.spec.js | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/modules/client/front/fiscal-data/index.js b/modules/client/front/fiscal-data/index.js index 65129d3f8e..397bb20e16 100644 --- a/modules/client/front/fiscal-data/index.js +++ b/modules/client/front/fiscal-data/index.js @@ -8,6 +8,14 @@ export default class Controller extends Section { const hasContactData = this.client.email || this.client.phone || this.client.mobile; const hasChangedTaxData = !orgData.isTaxDataChecked && this.client.isTaxDataChecked; + + const shouldInvoice = this.client.isActive && !this.client.hasToInvoice; + const clientActivation = this.client.isActive && (orgData.isActive != this.client.isActive); + if (shouldInvoice && clientActivation) { + this.client.hasToInvoice = true; + this.vnApp.showMessage(this.$t('Client invoices enabled')); + } + if (hasChangedTaxData && hasContactData) this.checkExistingClient(); else this.save(); diff --git a/modules/client/front/fiscal-data/index.spec.js b/modules/client/front/fiscal-data/index.spec.js index e028d01f3c..17e7309147 100644 --- a/modules/client/front/fiscal-data/index.spec.js +++ b/modules/client/front/fiscal-data/index.spec.js @@ -50,6 +50,16 @@ describe('Client', () => { expect(controller.save).not.toHaveBeenCalledWith(); expect(controller.checkExistingClient).toHaveBeenCalledWith(); }); + + it('should enable the hasToInvoice property any time the form activates the client with isActive', () => { + $scope.watcher.orgData.isActive = false; + controller.client.isActive = true; + controller.client.hasToInvoice = false; + + controller.onSubmit(); + + expect(controller.client.hasToInvoice).toBe(true); + }); }); describe('checkExistingClient()', () => { -- 2.40.1