Hello, I'm new to node-red and am using it with Odoo ERP. I want to display my data in an editable table (widget etable).
I'm fetching the data using first the change node with this code :
[
[
['partner_id', '=',msg.payload ],
['state', '=', 'draft']
],
['name', 'state','date_order','amount_total','partner_id']
]
then the odoo-xmlrpc-search-read node on the model sale.order. Now to display the data in an etable I would need first to add a fonction to format the data and I think it's were I'm doing it wrong. I've tried doing so many different ways but nothing works. The fact that I'm completely new to this doesn't help either. Here is what my function node has now :
var id = msg.payload.id
var name = msg.payload.name
var date_order = msg.payload.date_order
var amount_total = msg.payload.amount_total
var client = msg.payload.partner_id
var state = msg.payload.state
msg.payload = [
{ "name": ["name"],
"date_order" : ["date_order"],
"amount_total" : ["amount_total"],
"client": ["client"],
"state":["state"] },
];
return msg;
Ultimately I would also want to add a fonction after the etable so that the changes made in the lines of the etable could be uptated to the Odoo ERP.