bug fixed in edit addresses

This commit is contained in:
Daniel Herrero 2017-11-15 12:11:35 +01:00
parent bb4c43c2bd
commit d4a0cf205d
3 changed files with 10 additions and 3 deletions

View File

@ -36,7 +36,7 @@
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete vn-one <vn-autocomplete vn-one
initial-data="$ctrl.address.defaultAgencyFk" initial-data="$ctrl.address.defaultAgency"
field="$ctrl.address.defaultAgencyFk" field="$ctrl.address.defaultAgencyFk"
url="/client/api/AgencyModes" url="/client/api/AgencyModes"
show-field="name" show-field="name"

View File

@ -25,12 +25,19 @@ module.exports = function(Self) {
Self.beforeRemote('findById', function(ctx, modelInstance, next) { Self.beforeRemote('findById', function(ctx, modelInstance, next) {
ctx.args.filter = { ctx.args.filter = {
include: { include: [{
relation: "province", relation: "province",
scope: { scope: {
fields: ["id", "name"] fields: ["id", "name"]
} }
},
{
relation: "defaultAgency",
scope: {
fields: ["id", "name"]
}
} }
]
}; };
next(); next();
}); });

View File

@ -58,7 +58,7 @@
}, },
"defaultAgency": { "defaultAgency": {
"type": "belongsTo", "type": "belongsTo",
"model": "Agency", "model": "AgencyMode",
"foreignKey": "defaultAgencyFk" "foreignKey": "defaultAgencyFk"
} }
} }