I am currenlty working on a job using Lightining V2.10.15 where I am creating multiple Post requests to Odoo. I can successfully post to the Odoo instance but i would like to store the response from the each post reqeust. what is the best way to go about this?
here is the sample of the code which is used to send the post request to Odoo.
each(
β$.newProducts[*]β,
post(state => {
const { sku, quantity, location_id, product_id } = state.data;
const company_id = "1";
if (!product_id) {
console.log(`Skipping stock update for new SKU: ${sku} (missing product_id)`);
return state;
}
const url2 = `create?model=stock.quant&values=%7B%20%20%20%22product_id%22%3A%20${product_id}%2C%20%20%20%22location_id%22%3A%20${location_id}%2C%20%20%20%22quantity%22%3A%20${quantity}%2C%20%20%20%22company_id%22%3A%20${company_id}%20%7D`;
console.log(`Updating stock for new SKU: ${sku} - URL: ${url2}`);
return url2 ;
})
);