diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index fbe74286a..5cf357c13 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -17,13 +17,17 @@ module.exports = Self => { message: 'The social name cannot be empty' }); - Self.validatesPresenceOf('city', { - message: 'City cannot be empty' - }); + if (this.city) { + Self.validatesPresenceOf('city', { + message: 'City cannot be empty' + }); + } - Self.validatesPresenceOf('nif', { - message: 'The nif cannot be empty' - }); + if (this.nif) { + Self.validatesPresenceOf('nif', { + message: 'The nif cannot be empty' + }); + } Self.validatesUniquenessOf('nif', { message: 'TIN must be unique'