Node-red x Odoo xmlrpc : using etable to display data

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.

1 Like

Hello cpedroni,

right now I am also working on connecting Node-red to Odoo. I want to get a list of all my sale orders, so your problem discribed seems to be very similiar.

Have you already found a solution? If so, please let me know!

All the best

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.