Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
fc3f547a17
|
@ -147,7 +147,8 @@ describe('Client Edit fiscalData path', () => {
|
|||
.waitToClick(selectors.clientFiscalData.activeCheckboxLabel)
|
||||
.waitToClick(selectors.clientFiscalData.frozenCheckboxLabel)
|
||||
.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
|
||||
.waitToClick(selectors.clientFiscalData.viesCheckboxInput)
|
||||
// .waitToClick(selectors.clientFiscalData.viesCheckboxInput)
|
||||
// Petición #822 creada.
|
||||
.waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel)
|
||||
.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
|
||||
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel)
|
||||
|
@ -278,15 +279,15 @@ describe('Client Edit fiscalData path', () => {
|
|||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
// Petición #822 creada.
|
||||
// it('should confirm Vies checkbox is checked', async () => {
|
||||
// const result = await nightmare
|
||||
// .evaluate(selector => {
|
||||
// return document.querySelector(selector).checked;
|
||||
// }, selectors.clientFiscalData.viesCheckboxInput);
|
||||
|
||||
it('should confirm Vies checkbox is checked', async () => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientFiscalData.viesCheckboxInput);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
// expect(result).toBeTruthy();
|
||||
// });
|
||||
|
||||
it('should confirm Invoice by mail checkbox is unchecked', async () => {
|
||||
const result = await nightmare
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,5 +17,6 @@
|
|||
"Enter an integer different to zero": "Enter an integer different to zero",
|
||||
"Package cannot be blank": "Package cannot be blank",
|
||||
"The new quantity should be smaller than the old one": "The new quantity should be smaller than the old one",
|
||||
"The sales of this ticket can't be modified": "The sales of this ticket can't be modified"
|
||||
"The sales of this ticket can't be modified": "The sales of this ticket can't be modified",
|
||||
"Cannot check VIES and Equalization Tax": "Cannot check VIES and Equalization Tax"
|
||||
}
|
|
@ -57,5 +57,8 @@
|
|||
"The sales of this ticket can't be modified": "Los movimientos de este tiquet no pueden ser modificadas",
|
||||
"You can't create an order for a inactive client": "You can't create an order for a inactive client",
|
||||
"You can't create an order for a client that doesn't has tax data verified": "You can't create an order for a client that doesn't has tax data verified",
|
||||
"You must delete the claim id %d first": "Antes debes borrar la reclamacion %d"
|
||||
"You must delete the claim id %d first": "Antes debes borrar la reclamacion %d",
|
||||
"You don't have enough privileges": "You don't have enough privileges",
|
||||
"Cannot check VIES and Equalization Tax": "No puedes marcar VIES y RE al mismo",
|
||||
"Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF"
|
||||
}
|
|
@ -91,6 +91,27 @@ module.exports = Self => {
|
|||
err();
|
||||
}
|
||||
|
||||
Self.validate('isVies', hasEquTax, {
|
||||
message: 'Cannot check VIES and Equalization Tax'
|
||||
});
|
||||
|
||||
function hasEquTax(err) {
|
||||
if (this.isVies && this.isEqualizated)
|
||||
err();
|
||||
}
|
||||
|
||||
Self.validate('isEqualizated', cannotHaveET, {
|
||||
message: 'Cannot check Equalization Tax in this NIF/CIF'
|
||||
});
|
||||
|
||||
function cannotHaveET(err) {
|
||||
let tin = this.fi.toUpperCase();
|
||||
let cannotHaveET = /^[A-B]/.test(tin);
|
||||
|
||||
if (cannotHaveET && this.isEqualizated)
|
||||
err();
|
||||
}
|
||||
|
||||
Self.validateAsync('payMethodFk', hasIban, {
|
||||
message: 'That payment method requires an IBAN'
|
||||
});
|
||||
|
@ -135,14 +156,6 @@ module.exports = Self => {
|
|||
|
||||
if (isMultiple(ctx)) return;
|
||||
|
||||
if (changes.isEqualizated || changes.fi !== undefined) {
|
||||
let fiLetter = finalState.fi && finalState.fi.toUpperCase().charAt(0);
|
||||
let canMarkEqualizationTax = fiLetter != 'A' && fiLetter != 'B';
|
||||
|
||||
if (finalState.isEqualizated && !canMarkEqualizationTax)
|
||||
throw new UserError('Unable to mark the equivalence surcharge');
|
||||
}
|
||||
|
||||
if (changes.credit !== undefined) {
|
||||
await validateCreditChange(ctx, finalState);
|
||||
let filter = {fields: ['id'], where: {userFk: ctx.options.accessToken.userId}};
|
||||
|
|
Loading…
Reference in New Issue