fix(supplier_account): get countryFk in model.js
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2021-12-23 08:09:48 +01:00
parent 3b5b490a78
commit d1c7dea218
1 changed files with 6 additions and 4 deletions

View File

@ -7,12 +7,14 @@ module.exports = Self => {
}); });
async function ibanValidation(err, done) { async function ibanValidation(err, done) {
let filter = { const supplier = await Self.app.models.Supplier.findById(this.supplierFk);
const filter = {
fields: ['code'], fields: ['code'],
where: {id: this.countryFk} where: {id: supplier.countryFk}
}; };
let country = await Self.app.models.Country.findOne(filter);
let code = country ? country.code.toLowerCase() : null; const country = await Self.app.models.Country.findOne(filter);
const code = country ? country.code.toLowerCase() : null;
if (code != 'es') if (code != 'es')
return done(); return done();