6745-2404_testToMaster #1950
|
@ -34,12 +34,17 @@ module.exports = Self => {
|
|||
fields: ['code'],
|
||||
where: {id: this.countryFk}
|
||||
};
|
||||
|
||||
const country = await Self.app.models.Country.findOne(filter);
|
||||
const code = country ? country.code.toLowerCase() : null;
|
||||
const countryCode = this.fi?.toLowerCase().substring(0, 2);
|
||||
const client = (await Self.findById(this.id, {
|
||||
include: {relation: 'client'}}))?.client();
|
||||
if (client) {
|
||||
const countryCode = client.fi?.toLowerCase().substring(0, 2);
|
||||
|
||||
if (!this.fi || !validateTin(this.fi, code) || (this.isVies && countryCode == code))
|
||||
err();
|
||||
if (!client.fi || !validateTin(client.fi, code) || countryCode == code)
|
||||
err();
|
||||
}
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue