I have a very simple scheduled action I’d like to implement
webhook_url = 'https://xxxxx'
recs = model.search([("x_studio_processed", "=", False)])
for rec in recs:
data = recs.x_studio_json_text # json_text is just a text field with json in it.
requests.post(webhook_url, data=data)
However I’m getting the following error, which didn’t happen in the automated action version of this script.
RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/tools/safe_eval.py", line 391, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "ir.actions.server(1049,)", line 21, in <module>
NameError: name 'requests' is not defined
Is this a feature? Is there a workaround? I can think of one, but I’m new to Odoo and have no access to the code (I did mention this was odoo online), and even this workaround is not guaranteed:
Basically, use the scheduled action to trigger an automated action (updating a field should do), and use the automated action script’s request object.
Any thoughts or ideas? I’m looking for simpler, odoo-esque ways to handle this.