Use os separator in filename when calling file_open
This commit is contained in:
1 parent
9bd91ec4e6
commit
0a82985b48
1 file changed
+5
-2
@@ -5,6 +5,7 @@ from trytond.osv import fields, OSV
|
||||
from trytond.tools import file_open
|
||||
from trytond.backend import TableHandler
|
||||
import base64
|
||||
import os
|
||||
|
||||
|
||||
class Action(OSV):
|
||||
@@ -269,7 +270,8 @@ class ActionReport(OSV):
|
||||
data = report[name + '_data']
|
||||
if not data and report[name[:-8]]:
|
||||
try:
|
||||
data = base64.encodestring(file_open(report[name[:-8]],
|
||||
data = base64.encodestring(file_open(
|
||||
report[name[:-8]].replace('/', os.sep),
|
||||
mode='rb').read())
|
||||
except:
|
||||
data = False
|
||||
@@ -284,7 +286,8 @@ class ActionReport(OSV):
|
||||
res = {}
|
||||
for report in self.browse(cursor, user, ids, context=context):
|
||||
try:
|
||||
data = base64.encodestring(file_open(report.style,
|
||||
data = base64.encodestring(file_open(
|
||||
report.style.replace('/', os.sep),
|
||||
mode='rb').read())
|
||||
except:
|
||||
data = False
|
||||
|
||||
Reference in new issue
Block a user