Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I convert an Odoo browse object to JSON

I'm trying to integrate reactjs with Odoo, and successfully created components. Now my problem is that I cant get the JSON via odoo. The odoo programmer has to write special api request to make this happen. This is taking more time and code repetitions are plenty.

I tried may suggestions and none worked.

Is there a better way to convert the browse objects, that odoo generate, to JSON ?

Note: Entirely new to python and odoo, please forgive my mistakes, if any mentioned above.

like image 406
itssajan Avatar asked Oct 22 '25 22:10

itssajan


1 Answers

maybe this will help you:

Step 1: Create js that runs reqiest to /example_link

Step 2: Create controller who listens that link @http.route('/example_link', type="json")

Step 3: return from that function json return json.dumps(res) where res is python dictionary and also dont forget to import json.

Thats all, it's not very hard, hope I helped you, good luck.

like image 182
Dachi Darchiashvili Avatar answered Oct 24 '25 13:10

Dachi Darchiashvili



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!