feat: refs #7731 tests
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Robert Ferrús 2024-12-17 11:02:09 +01:00
parent b3539e6c6e
commit faf4bb34c6
6 changed files with 75 additions and 43 deletions

View File

@ -582,16 +582,16 @@ INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
('flowerPlants', 'Wholesale of flowers and plants'), ('flowerPlants', 'Wholesale of flowers and plants'),
('vegetablesFruits', 'Fruit and vegetable trade'); ('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 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'), (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'), (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), (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'), (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'), (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'), (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'), (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'); (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`) INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
VALUES VALUES
@ -3951,9 +3951,9 @@ INSERT INTO vn.medicalReview
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark) (id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL); VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated) INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
VALUES(35, 1.00, 1.00, '2001-01-01'); VALUES(35, 1.00, 1.00, '2001-01-01');
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk) INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
VALUES (1,0.6,6); VALUES (1,0.6,6);
INSERT INTO vn.payrollComponent INSERT INTO vn.payrollComponent

View File

@ -89,4 +89,27 @@ describe('Client updateFiscalData', () => {
throw e; 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;
}
});
}); });

View File

@ -116,7 +116,7 @@
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete <vn-autocomplete
vn-one vn-two
vn-id="province" vn-id="province"
label="Province" label="Province"
ng-model="$ctrl.client.provinceFk" ng-model="$ctrl.client.provinceFk"
@ -138,6 +138,17 @@
label="Country" label="Country"
rule> rule>
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete
vn-one
vn-id="viesCode"
ng-model="$ctrl.client.viesCode"
data="countries"
show-field="code"
value-field="code"
label="viesCode"
info="To use vies that is not listed use Lilium"
rule>
</vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-check <vn-check
@ -155,9 +166,8 @@
ng-model="$ctrl.client.hasToInvoice"> ng-model="$ctrl.client.hasToInvoice">
</vn-check> </vn-check>
<vn-check <vn-check
label="Vies" label="Invoice by address"
info="When activating it, do not enter the country code in the ID field." ng-model="$ctrl.client.hasToInvoiceByAddress">
ng-model="$ctrl.client.isVies">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
@ -166,8 +176,9 @@
ng-model="$ctrl.client.isToBeMailed"> ng-model="$ctrl.client.isToBeMailed">
</vn-check> </vn-check>
<vn-check <vn-check
label="Invoice by address" label="Verified data"
ng-model="$ctrl.client.hasToInvoiceByAddress"> ng-model="$ctrl.client.isTaxDataChecked"
vn-acl="salesAssistant">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
@ -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." 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)"> on-change="$ctrl.onChangeEqualizated(value)">
</vn-check> </vn-check>
<vn-check
label="Verified data"
ng-model="$ctrl.client.isTaxDataChecked"
vn-acl="salesAssistant">
</vn-check>
</vn-horizontal>
<vn-horizontal>
<vn-check <vn-check
label="Electronic invoice" label="Electronic invoice"
ng-model="$ctrl.client.hasElectronicInvoice" ng-model="$ctrl.client.hasElectronicInvoice"

View File

@ -1 +1,2 @@
Found a client with this phone or email: The client with id <a href="#!/client/{{clientId}}/summary" target="_blank">{{clientId}}</a> already has this phone or email. <br/> ¿Do you want to continue? Found a client with this phone or email: The client with id <a href="#!/client/{{clientId}}/summary" target="_blank">{{clientId}}</a> already has this phone or email. <br/> ¿Do you want to continue?
viesCode: Vies

View File

@ -1,16 +1,18 @@
Yes, notify: Sí, notificar Yes, notify: Sí, notificar
You changed the equalization tax: Has cambiado el recargo de equivalencia 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? Do you want to spread the change?: ¿Deseas propagar el cambio a sus consignatarios?
Frozen: Congelado 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. 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 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 data: Se ha encontrado un cliente con estos datos
Found a client with this phone or email: El cliente con id <a href="#!/client/{{clientId}}/summary" target="_blank">{{clientId}}</a> ya tiene este teléfono o email. <br/> ¿Quieres continuar? Found a client with this phone or email: El cliente con id <a href="#!/client/{{clientId}}/summary" target="_blank">{{clientId}}</a> ya tiene este teléfono o email. <br/> ¿Quieres continuar?
Sage tax type: Tipo de impuesto Sage Sage tax type: Tipo de impuesto Sage
Sage transaction type: Tipo de transacción Sage Sage transaction type: Tipo de transacción Sage
Previous client: Cliente anterior 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 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 Incoterms authorization: Autorización incoterms
Electronic invoice: Factura electrónica 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 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 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

View File

@ -19,6 +19,7 @@ describe('Supplier updateFiscalData()', () => {
const countryFk = 1; const countryFk = 1;
const supplierActivityFk = 'animals'; const supplierActivityFk = 'animals';
const healthRegister = '400664487H'; const healthRegister = '400664487H';
const viesCode = 'ES';
let ctx; let ctx;
let options; let options;
@ -120,7 +121,7 @@ describe('Supplier updateFiscalData()', () => {
supplierActivityFk, supplierActivityFk,
healthRegister, healthRegister,
undefined, undefined,
undefined, viesCode,
options); options);
expect(supplier.name).toEqual(name); expect(supplier.name).toEqual(name);
@ -137,5 +138,6 @@ describe('Supplier updateFiscalData()', () => {
expect(supplier.countryFk).toEqual(countryFk); expect(supplier.countryFk).toEqual(countryFk);
expect(supplier.supplierActivityFk).toEqual(supplierActivityFk); expect(supplier.supplierActivityFk).toEqual(supplierActivityFk);
expect(supplier.healthRegister).toEqual(healthRegister); expect(supplier.healthRegister).toEqual(healthRegister);
expect(supplier.viesCode).toEqual(viesCode);
}); });
}); });