refs #4617 use temporary instead of vn #1451

Merged
alexm merged 6 commits from 4617-use_tmp_in_ticketToInvoice into dev 2023-05-04 05:07:26 +00:00
12 changed files with 47 additions and 23 deletions
Showing only changes of commit 306d73eb69 - Show all commits

View File

@ -0,0 +1,5 @@
UPDATE vn.supplier s
JOIN vn.country c ON c.id = s.countryFk
SET s.nif = MID(REPLACE(s.nif, ' ', ''), 3, LENGTH(REPLACE(s.nif, ' ', '')) - 1)
WHERE s.isVies = TRUE
AND c.code = LEFT(REPLACE(s.nif, ' ', ''), 2);

View File

@ -0,0 +1,5 @@
UPDATE IGNORE vn.client c
JOIN vn.country co ON co.id = c.countryFk
SET c.fi = MID(REPLACE(c.fi, ' ', ''), 3, LENGTH(REPLACE(c.fi, ' ', '')) - 1)
WHERE c.isVies = TRUE
AND co.code = LEFT(REPLACE(c.fi, ' ', ''), 2);

View File

@ -279,15 +279,16 @@
"Comment added to client": "Observación añadida al cliente {{clientFk}}",
"Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen",
"company": "Compañía",
"country": "País",
"clientId": "Id cliente",
"clientSocialName": "Cliente",
"amount": "Importe",
"taxableBase": "Base",
"ticketFk": "Id ticket",
"isActive": "Activo",
"hasToInvoice": "Facturar",
"isTaxDataChecked": "Datos comprobados",
"comercialId": "Id comercial",
"comercialName": "Comercial"
"country": "País",
"clientId": "Id cliente",
"clientSocialName": "Cliente",
"amount": "Importe",
"taxableBase": "Base",
"ticketFk": "Id ticket",
"isActive": "Activo",
"hasToInvoice": "Facturar",
"isTaxDataChecked": "Datos comprobados",
"comercialId": "Id comercial",
"comercialName": "Comercial",
"Invalid NIF for VIES": "Invalid NIF for VIES"
}

View File

@ -89,8 +89,9 @@ module.exports = Self => {
};
const country = await Self.app.models.Country.findOne(filter);
const code = country ? country.code.toLowerCase() : null;
const countryCode = this.fi.toLowerCase().substring(0, 2);
if (!this.fi || !validateTin(this.fi, code))
if (!this.fi || !validateTin(this.fi, code) || (this.isVies && countryCode == code))
err();
done();
}

View File

@ -72,7 +72,9 @@
<vn-horizontal>
<vn-check vn-one label="Has to invoice" ng-model="$ctrl.client.hasToInvoice">
</vn-check>
<vn-check vn-one label="Vies" ng-model="$ctrl.client.isVies">
<vn-check vn-one label="Vies"
info="When activating it, do not enter the country code in the ID field."
ng-model="$ctrl.client.isVies">
</vn-check>
</vn-horizontal>
<vn-horizontal>

View File

@ -12,3 +12,5 @@ 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

View File

@ -19,13 +19,14 @@ describe('Supplier newSupplier()', () => {
});
});
it('should create a new supplier containing only the name', async() => {
it('should create a new supplier containing only the name and the nif', async() => {
const tx = await models.Supplier.beginTransaction({});
try {
const options = {transaction: tx};
ctx.args = {
name: 'newSupplier'
name: 'newSupplier',
nif: '12345678Z'
};
const result = await models.Supplier.newSupplier(ctx, options);

View File

@ -67,8 +67,9 @@ module.exports = Self => {
};
const country = await Self.app.models.Country.findOne(filter);
const code = country ? country.code.toLowerCase() : null;
const countryCode = this.nif.toLowerCase().substring(0, 2);
if (!this.nif || !validateTin(this.nif, code))
if (!this.nif || !validateTin(this.nif, code) || (this.isVies && countryCode == code))
err();
done();
}

View File

@ -54,7 +54,8 @@
name="taxNumber"
ng-model="$ctrl.supplier.nif"
required="true"
rule>
rule
>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
@ -210,7 +211,9 @@
<vn-check
class="vn-ml-lg"
label="Vies"
ng-model="$ctrl.supplier.isVies">
info="When activating it, do not enter the country code in the ID field."
ng-model="$ctrl.supplier.isVies"
>
</vn-check>
</vn-two>
</vn-horizontal>

View File

@ -4,3 +4,5 @@ Sage withholding: Retención Sage
Supplier activity: Actividad proveedor
Healt register: Pasaporte sanitario
Trucker: Transportista
When activating it, do not enter the country code in the ID field.: Al activarlo, no informar el código del país en el campo nif
The first two values are letters.: Los dos primeros valores son letras

View File

@ -1 +1,2 @@
Accounts: Cuentas
Invalid NIF for VIES: NIF no valido por VIES

View File

@ -196,7 +196,7 @@ module.exports = Self => {
client = await models.Client.findById(
user.id,
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk']},
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk', 'fi']},
myOptions
);