Hi! Can I run a script of php from a module of odoo? I tried with subprocess.call, subprocess.Popen and os.system but it didn't work. I can't find information about it on the web.
Thanks!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi! Can I run a script of php from a module of odoo? I tried with subprocess.call, subprocess.Popen and os.system but it didn't work. I can't find information about it on the web.
Thanks!
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye OlRelated Posts | Cevaplar | Görünümler | Aktivite | |
---|---|---|---|---|
|
4
Ağu 24
|
15024 | ||
|
1
Nis 22
|
5347 | ||
|
1
Şub 24
|
936 | ||
|
2
Şub 24
|
1564 | ||
|
0
Ara 23
|
731 |
Please post the code you have tried with subprocess. Using subprocess, you can use the commands from the py file.
thanks for the reply, I call to the function from a 'server action' and that works because I put it a logger message, and then in the function I do this:
return subprocess.call(["/usr/bin/php", "location_of_the_file/prueba.php"])
My Php is the version 2.7, so I must use:
import commands
commands.getstatusoutput('sudo -S php /route_directory/script_name.php')
this return the error code too if you need it. If you don't want it:
commands.getoutput('sudo -S php /route_directory/script_name.php') is enough
and add sudo permissions in sudoers file:
odoo ALL=(ALL) NOPASSWD:ALL
www-data ALL=(ALL) NOPASSWD:ALL