This commit is contained in:
parent
b3539e6c6e
commit
faf4bb34c6
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
vn-two
|
||||
vn-id="province"
|
||||
label="Province"
|
||||
ng-model="$ctrl.client.provinceFk"
|
||||
|
@ -138,6 +138,17 @@
|
|||
label="Country"
|
||||
rule>
|
||||
</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-check
|
||||
|
@ -155,9 +166,8 @@
|
|||
ng-model="$ctrl.client.hasToInvoice">
|
||||
</vn-check>
|
||||
<vn-check
|
||||
label="Vies"
|
||||
info="When activating it, do not enter the country code in the ID field."
|
||||
ng-model="$ctrl.client.isVies">
|
||||
label="Invoice by address"
|
||||
ng-model="$ctrl.client.hasToInvoiceByAddress">
|
||||
</vn-check>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
@ -166,8 +176,9 @@
|
|||
ng-model="$ctrl.client.isToBeMailed">
|
||||
</vn-check>
|
||||
<vn-check
|
||||
label="Invoice by address"
|
||||
ng-model="$ctrl.client.hasToInvoiceByAddress">
|
||||
label="Verified data"
|
||||
ng-model="$ctrl.client.isTaxDataChecked"
|
||||
vn-acl="salesAssistant">
|
||||
</vn-check>
|
||||
</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."
|
||||
on-change="$ctrl.onChangeEqualizated(value)">
|
||||
</vn-check>
|
||||
<vn-check
|
||||
label="Verified data"
|
||||
ng-model="$ctrl.client.isTaxDataChecked"
|
||||
vn-acl="salesAssistant">
|
||||
</vn-check>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-check
|
||||
label="Electronic invoice"
|
||||
ng-model="$ctrl.client.hasElectronicInvoice"
|
||||
|
|
|
@ -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?
|
||||
viesCode: Vies
|
||||
|
|
|
@ -14,3 +14,5 @@ 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
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue