-
-
Save ecarreras/e350f8fd52b4a341228f to your computer and use it in GitHub Desktop.
Get and view an erp5 pdf report from command line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from erppeek import Client | |
import sys | |
import base64 | |
from subprocess import call | |
import time | |
report = 'xml_report_name' | |
ids = [object_id] | |
O = Client('http://localhost:8069', 'database','user','pass') | |
report_id = O.report(report, ids) | |
sys.stdout.write("Waiting") | |
res = {'state': False} | |
while not res['state']: | |
res = O.report_get(report_id) | |
sys.stdout.write(".") | |
time.sleep(0.2) | |
sys.stdout.flush() | |
sys.stdout.write("\n") | |
with open('report.pdf','w') as f: | |
f.write(base64.b64decode(res['result'])) | |
call(['evince', 'report.pdf']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment