{ "name": "Client", "base": "VnModel", "mixins": { "Loggable": true }, "options": { "mysql": { "table": "client" } }, "properties": { "id": { "type": "number", "id": true, "description": "Identifier" }, "name": { "type": "string", "required": true }, "fi": { "type": "string", "description": "Fiscal indentifier" }, "socialName": { "type": "string", "required": true }, "contact": { "type": "string" }, "street": { "type": "string", "required": true }, "city": { "type": "string", "required": true }, "postcode": { "type": "string" }, "email": { "type": "string" }, "phone": { "type": "string" }, "mobile": { "type": "string" }, "isActive": { "type": "boolean" }, "credit": { "type": "number" }, "creditInsurance": { "type": "number" }, "iban": { "type": "string" }, "dueDay": { "type": "number" }, "isEqualizated": { "type": "boolean", "description": "The client has equalization tax" }, "isFreezed": { "type": "boolean", "description": "The client frozen" }, "hasToInvoiceByAddress": { "type": "boolean", "description": "The client has to be invoiced by address" }, "hasToInvoice": { "type": "boolean", "description": "Global invoicing enabled for the client" }, "isToBeMailed": { "type": "boolean", "description": "Send invoices by email" }, "hasSepaVnl": { "type": "boolean" }, "hasLcr": { "type": "boolean" }, "hasCoreVnl": { "type": "boolean" }, "hasCoreVnh": { "type": "boolean" }, "hasIncoterms": { "type": "boolean" }, "isTaxDataChecked":{ "type": "boolean" }, "quality": { "type": "number" }, "isVies": { "type": "boolean" }, "isRelevant": { "type": "boolean" }, "accountingAccount": { "type": "string" }, "created": { "type": "date" }, "sageTaxTypeFk": { "type": "number", "mysql": { "columnName": "taxTypeSageFk" } }, "sageTransactionTypeFk": { "type": "number", "mysql": { "columnName": "transactionTypeSageFk" } }, "businessTypeFk": { "type": "string", "mysql": { "columnName": "businessTypeFk" } }, "salesPersonFk": { "type": "number" }, "hasElectronicInvoice": { "type": "boolean" }, "rating": { "type": "number" }, "recommendedCredit": { "type": "number" } }, "relations": { "account": { "type": "belongsTo", "model": "VnUser", "foreignKey": "id" }, "user": { "type": "belongsTo", "model": "VnUser", "foreignKey": "id" }, "payMethod": { "type": "belongsTo", "model": "PayMethod", "foreignKey": "payMethodFk" }, "salesPersonUser": { "type": "belongsTo", "model": "VnUser", "foreignKey": "salesPersonFk" }, "province": { "type": "belongsTo", "model": "Province", "foreignKey": "provinceFk" }, "country": { "type": "belongsTo", "model": "Country", "foreignKey": "countryFk" }, "isSocialNameUnique": { "type": "belongsTo", "model": "Country", "foreignKey": "countryFk" }, "contactChannel": { "type": "belongsTo", "model": "ContactChannel", "foreignKey": "contactChannelFk" }, "type": { "type": "belongsTo", "model": "ClientType", "foreignKey": "typeFk" }, "businessType": { "type": "belongsTo", "model": "BusinessType", "foreignKey": "businessTypeFk" }, "addresses": { "type": "hasMany", "model": "Address", "foreignKey": "clientFk" }, "greuge": { "type": "hasMany", "model": "Greuge", "foreignKey": "clientFk" }, "classifications": { "type": "hasMany", "model": "CreditClassification", "foreignKey": "client" }, "defaultAddress": { "type": "belongsTo", "model": "Address", "foreignKey": "defaultAddressFk" }, "contacts": { "type": "hasMany", "model": "ClientContact", "foreignKey": "clientFk" }, "bank": { "type": "belongsTo", "model": "BankEntity", "foreignKey": "bankEntityFk" }, "defaulters": { "type": "hasMany", "model": "Defaulter", "foreignKey": "clientFk" }, "clientRisks": { "type": "hasMany", "model": "ClientRisk", "foreignKey": "clientFk" }, "claimsRatio": { "type": "hasOne", "model": "ClaimRatio", "foreignKey": "clientFk" }, "transferor": { "type": "belongsTo", "model": "Client", "foreignKey": "transferorFk" }, "supplier": { "type": "belongsTo", "model": "Supplier", "foreignKey": "fi", "primaryKey": "nif" } }, "scopes": { "isActive": { "where": { "isActive": { "neq": false } } } } }