Hello together,
i tried to call a python method from javascript site to pass the data of a form view to javascript.
The rpc call is working fine.
However wenn i try to pass the data of the view to Javascript i get false instead of the data-entry.
Console output:
{'employees': [{'id': False, 'lastName': False}, {'id': False, 'lastName': False}, {'firstName': 'Peter', 'lastName': 'Jones'}]}
Test method:
@api.model
def test(self):
data = { "employees":[
{"id": self.startpoint_id.id, "lastName": self.startpoint_id.name},
{"id": self.endpoint_id.id, "lastName": self.endpoint_id.name},
{"firstName": "Peter", "lastName": "Jones"}
],
"fruit": "Apple",
"size": "Large",
"color": "Red"
}
json_data = json.dumps(data)
return json_data
RPC call:
rpc.query({model: 'selection.menu', method: 'test',
}).then(function(data){
console.log('works');
console.log(data);
});
What am I missing here!?
Any help would be much appreciated
Please be more accurate about what you mean with "pass the data of the view to Javascript"?, show the code that do that because otherwise it's not clear what are you trying to do