Skip to Content
Menú
This question has been flagged
3519 Vistes

in .py file:

import matplotlib.pyplot as plt

....

datafile=fields.Binary(u'select Excel File',required=True)

@api.multi

def plotfig(self,cr):

file_like=io.BytesIO(base64.b64decode(self.datafile))

table=pandas.read_excel(file_like)

x=table.iloc[:,1]

y=table.iloc[:,2]

plt.plot(x,y)

plt.show()


Now the users can upload "excel" file onto "datafile", and when users click button "plotfig", odoo will read out data from "datafile", plot a figure and show it on odoo server; but because the figure is shown on odoo server, users can't see / save it; so how shall I let users see the figure and save it on users' PC?


Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
de jul. 16
2655
0
de maig 15
3534
1
de març 15
5134
4
de des. 15
6709
1
de juny 24
3164