This commit is contained in:
parent
810021e23a
commit
173ed251c3
|
@ -68,9 +68,9 @@ module.exports = Self => {
|
||||||
};
|
};
|
||||||
const country = await Self.app.models.Country.findOne(filter);
|
const country = await Self.app.models.Country.findOne(filter);
|
||||||
const code = country ? country.code.toLowerCase() : null;
|
const code = country ? country.code.toLowerCase() : null;
|
||||||
const countryCode = this.nif.toLowerCase().substring(0, 2);
|
const countryCode = this.nif?.toLowerCase().substring(0, 2);
|
||||||
|
|
||||||
if (!this.nif || !validateTin(this.nif, code) || (this.isVies && countryCode == code))
|
if (!validateTin(this.nif, code) || (this.isVies && countryCode == code))
|
||||||
err();
|
err();
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
async function hasSupplierSameName(err, done) {
|
async function hasSupplierSameName(err, done) {
|
||||||
if (!this.name || !this.countryFk) done();
|
if (!this.name || !this.countryFk) return done();
|
||||||
const supplier = await Self.app.models.Supplier.findOne(
|
const supplier = await Self.app.models.Supplier.findOne(
|
||||||
{
|
{
|
||||||
where: {
|
where: {
|
||||||
|
|
Loading…
Reference in New Issue