diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 23f8788ba..a38f432d6 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -582,16 +582,16 @@ INSERT INTO `vn`.`supplierActivity`(`code`, `name`) ('flowerPlants', 'Wholesale of flowers and plants'), ('vegetablesFruits', 'Fruit and vegetable trade'); -INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`) +INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`, `viesCode`) VALUES - (1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), - (2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), - (4, 'INVENTARIO', 'INVENTARIO', 4000000004, NULL, NULL, 0, util.VN_CURDATE(), 1, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL, NULL), - (69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), - (442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), - (567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), - (791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), - (1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); + (1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V','ES'), + (2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V',NULL), + (4, 'INVENTARIO', 'INVENTARIO', 4000000004, NULL, NULL, 0, util.VN_CURDATE(), 1, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL, NULL,NULL), + (69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V', NULL), + (442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V', NULL), + (567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V', NULL), + (791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V', NULL), + (1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V', NULL); INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`) VALUES @@ -3951,9 +3951,9 @@ INSERT INTO vn.medicalReview (id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark) VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL); -INSERT INTO vn.stockBought (workerFk, bought, reserve, dated) - VALUES(35, 1.00, 1.00, '2001-01-01'); -INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk) +INSERT INTO vn.stockBought (workerFk, bought, reserve, dated) + VALUES(35, 1.00, 1.00, '2001-01-01'); +INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk) VALUES (1,0.6,6); INSERT INTO vn.payrollComponent diff --git a/modules/client/back/methods/client/specs/updateFiscalData.spec.js b/modules/client/back/methods/client/specs/updateFiscalData.spec.js index a08f97faf..bacf5e68c 100644 --- a/modules/client/back/methods/client/specs/updateFiscalData.spec.js +++ b/modules/client/back/methods/client/specs/updateFiscalData.spec.js @@ -89,4 +89,27 @@ describe('Client updateFiscalData', () => { throw e; } }); + + it('should update the client fiscal data, set vies code that is not on the list', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + const ctx = {req: {accessToken: {userId: administrativeId}}}; + ctx.args = {viesCode: 'TT'}; + + const client = await models.Client.findById(clientId, null, options); + + expect(client.viesCode).not.toEqual(ctx.args.viesCode); + + const result = await models.Client.updateFiscalData(ctx, clientId, options); + + expect(result.viesCode).toEqual(ctx.args.viesCode); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index 979f45fcc..c674d96e2 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -116,7 +116,7 @@ + + + label="Invoice by address" + ng-model="$ctrl.client.hasToInvoiceByAddress"> @@ -166,8 +176,9 @@ ng-model="$ctrl.client.isToBeMailed"> + label="Verified data" + ng-model="$ctrl.client.isTaxDataChecked" + vn-acl="salesAssistant"> @@ -177,13 +188,6 @@ info="In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not." on-change="$ctrl.onChangeEqualizated(value)"> - - - - {{clientId}} already has this phone or email.
¿Do you want to continue? \ No newline at end of file +Found a client with this phone or email: The client with id {{clientId}} already has this phone or email.
¿Do you want to continue? +viesCode: Vies diff --git a/modules/client/front/fiscal-data/locale/es.yml b/modules/client/front/fiscal-data/locale/es.yml index 61a91828f..f8f596195 100644 --- a/modules/client/front/fiscal-data/locale/es.yml +++ b/modules/client/front/fiscal-data/locale/es.yml @@ -1,16 +1,18 @@ -Yes, notify: Sí, notificar -You changed the equalization tax: Has cambiado el recargo de equivalencia -Do you want to spread the change?: ¿Deseas propagar el cambio a sus consignatarios? -Frozen: Congelado -In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not.: Para facturar no se consulta este campo, sino el RE de consignatario. Al modificar este campo si no esta marcada la casilla Facturar por consignatario, se propagará automáticamente el cambio a todos los consignatarios, en caso contrario preguntará al usuario si quiere o no propagar. -Only letters, numbers and spaces can be used: Sólo se pueden usar letras, numeros y espacios -Found a client with this data: Se ha encontrado un cliente con estos datos -Found a client with this phone or email: El cliente con id {{clientId}} ya tiene este teléfono o email.
¿Quieres continuar? -Sage tax type: Tipo de impuesto Sage -Sage transaction type: Tipo de transacción Sage -Previous client: Cliente anterior -In case of a company succession, specify the grantor company: En el caso de que haya habido una sucesión de empresa, indicar la empresa cedente -Incoterms authorization: Autorización incoterms -Electronic invoice: Factura electrónica -When activating it, do not enter the country code in the IF.: Al activarlo, no informar el código del país en el campo IF -The first two values are letters: Los dos primeros valores son letras \ No newline at end of file +Yes, notify: Sí, notificar +You changed the equalization tax: Has cambiado el recargo de equivalencia +Do you want to spread the change?: ¿Deseas propagar el cambio a sus consignatarios? +Frozen: Congelado +In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not.: Para facturar no se consulta este campo, sino el RE de consignatario. Al modificar este campo si no esta marcada la casilla Facturar por consignatario, se propagará automáticamente el cambio a todos los consignatarios, en caso contrario preguntará al usuario si quiere o no propagar. +Only letters, numbers and spaces can be used: Sólo se pueden usar letras, numeros y espacios +Found a client with this data: Se ha encontrado un cliente con estos datos +Found a client with this phone or email: El cliente con id {{clientId}} ya tiene este teléfono o email.
¿Quieres continuar? +Sage tax type: Tipo de impuesto Sage +Sage transaction type: Tipo de transacción Sage +Previous client: Cliente anterior +In case of a company succession, specify the grantor company: En el caso de que haya habido una sucesión de empresa, indicar la empresa cedente +Incoterms authorization: Autorización incoterms +Electronic invoice: Factura electrónica +When activating it, do not enter the country code in the IF.: Al activarlo, no informar el código del país en el campo IF +The first two values are letters: Los dos primeros valores son letras +viesCode: Vies +To use vies that is not listed use Lilium: Para usar un vies que no estan en la lista use Lilium diff --git a/modules/supplier/back/methods/supplier/specs/updateFiscalData.spec.js b/modules/supplier/back/methods/supplier/specs/updateFiscalData.spec.js index f1efbbbba..434a3b991 100644 --- a/modules/supplier/back/methods/supplier/specs/updateFiscalData.spec.js +++ b/modules/supplier/back/methods/supplier/specs/updateFiscalData.spec.js @@ -19,6 +19,7 @@ describe('Supplier updateFiscalData()', () => { const countryFk = 1; const supplierActivityFk = 'animals'; const healthRegister = '400664487H'; + const viesCode = 'ES'; let ctx; let options; @@ -120,7 +121,7 @@ describe('Supplier updateFiscalData()', () => { supplierActivityFk, healthRegister, undefined, - undefined, + viesCode, options); expect(supplier.name).toEqual(name); @@ -137,5 +138,6 @@ describe('Supplier updateFiscalData()', () => { expect(supplier.countryFk).toEqual(countryFk); expect(supplier.supplierActivityFk).toEqual(supplierActivityFk); expect(supplier.healthRegister).toEqual(healthRegister); + expect(supplier.viesCode).toEqual(viesCode); }); });