Skip to Content
Menu
This question has been flagged
2 Replies
22465 Views


I generate xls file from odoo, the code works in my laptop but in server machine it doesn't i tried the both commands:

1- sudo chmod -R 777 /usr/local/lib/python3.6/

2-sudo chown -R 777 /odoo/

but nothing has changed

Thanks for help


Erreur:
Odoo Server Error

Traceback (most recent call last):
File "/odoo/odoo-server/odoo/http.py", line 656, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/odoo/odoo-server/odoo/http.py", line 314, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/odoo/odoo-server/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/odoo/odoo-server/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/odoo/odoo-server/odoo/http.py", line 346, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/odoo/odoo-server/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/odoo/odoo-server/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/odoo/odoo-server/odoo/http.py", line 941, in __call__
return self.method(*args, **kw)
File "/odoo/odoo-server/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw)
File "/odoo/odoo-server/addons/web/controllers/main.py", line 966, in call_button
action = self._call_kw(model, method, args, {})
File "/odoo/odoo-server/addons/web/controllers/main.py", line 954, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/odoo/odoo-server/odoo/api.py", line 749, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/odoo/odoo-server/odoo/api.py", line 736, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/odoo/custom/lsee/quality_pharm_report/wizard/dangerous_product_balance_wizard.py", line 20, in print_report_xls
return self.env['report.xls'].report_action(workbook, _('Dangerous product Excel'))
File "/odoo/custom/lsee/report_xls/wizard/report_xls.py", line 21, in report_action
workbook.save(filename)
File "/usr/local/lib/python3.6/dist-packages/xlwt/Workbook.py", line 710, in save
doc.save(filename_or_stream, self.get_biff_data())
File "/usr/local/lib/python3.6/dist-packages/xlwt/CompoundDoc.py", line 262, in save
f = open(file_name_or_filelike_obj, 'w+b')
PermissionError: [Errno 13] Permission denied: 'Produits dangereux Excel.xls'


Avatar
Discard
Best Answer

Make sure you have the permission on the directory where you are creating the Excel. 

If you don't find any clue, just create the excel in the "/tmp" directory.

Avatar
Discard
Author

Thanks

create the excel file in "/tmp" folder worked for me, thanks.
import tempfile
fileobj_or_path = tempfile.gettempdir() + '/file.xlsx'
wb = xlsxwriter.Workbook(fileobj_or_path)

Best Answer
sudo chown -R odoo:odoo /odoo/  here odoo is the odoo user/Role, change the user name accordingly. 
Avatar
Discard
Author

Thanks

Related Posts Replies Views Activity
1
Mar 23
1417
0
Oct 21
1278
1
Aug 21
2263
1
Dec 20
16649
1
Jan 20
3716