Created
November 15, 2018 11:54
-
-
Save gdalmau/756b40cafd0291bb5498d13116e7dfa3 to your computer and use it in GitHub Desktop.
Imprimir report desde erppeek
This file contains 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
import base64 | |
import sys | |
import time | |
from subprocess import Popen | |
from erppeek import Client | |
c = Client(... | |
report = 'giscedata.facturacio.factura' | |
params = {'context': {}} | |
factura_ids = [] | |
context = { | |
'lang': 'es_ES', | |
'tz': 'Europe/Madrid', | |
'active_id': factura_ids[0], | |
'active_ids': factura_ids, | |
} | |
report_id = c.report(report, factura_ids, params, context) | |
sys.stdout.write("Waiting") | |
res = {'state': False} | |
while not res['state']: | |
res = c.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'])) | |
Popen(['okular', 'report.pdf']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment