Hello
I am trying to generate an excel report and when generating it odoo displays an access permissions error. The code that gives an error is the following:
PYbook.save(f_out)generating the following error:
f_out.flush()
self.export_file = base64.b64encode(open(f_out.name, "rb").read())
self.export_filename = "Purchases-Analysis.xls"
f_out.close()
Odoo Server Error
Traceback (most recent call last): File "C:\Odoo\Odoo 14\server\odoo\addons\base\models\ir_http.py", line 237, in _dispatch result = request.dispatch() File "C:\Odoo\Odoo 14\server\odoo\http.py", line 683, in dispatch result = self._call_function(**self.params) File "C:\Odoo\Odoo 14\server\odoo\http.py", line 359, in _call_function return checked_call(self.db, *args, **kwargs) File "C:\Odoo\Odoo 14\server\odoo\service\model.py", line 94, in wrapper return f(dbname, *args, **kwargs) File "C:\Odoo\Odoo 14\server\odoo\http.py", line 347, in checked_call result = self.endpoint(*a, **kw) File "C:\Odoo\Odoo 14\server\odoo\http.py", line 912, in __call__ return self.method(*args, **kw) File "C:\Odoo\Odoo 14\server\odoo\http.py", line 531, in response_wrap response = f(*args, **kw) File "C:\Odoo\Odoo 14\server\odoo\addons\web\controllers\main.py", line 1393, in call_button action = self._call_kw(model, method, args, kwargs) File "C:\Odoo\Odoo 14\server\odoo\addons\web\controllers\main.py", line 1381, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "C:\Odoo\Odoo 14\server\odoo\api.py", line 396, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "C:\Odoo\Odoo 14\server\odoo\api.py", line 383, in _call_kw_multi result = method(recs, *args, **kwargs) File "c:\odoo\odoo 14\server\custom_addons\andys\andys_purchases_analysis\wizard\purchases_analysis.py", line 290, in action_export self.export_file = base64.b64encode(open(f_out.name, "rb").read()) Exception The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Odoo\Odoo 14\server\odoo\http.py", line 639, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "C:\Odoo\Odoo 14\server\odoo\http.py", line 315, in _handle_exception raise exception.with_traceback(None) from new_cause PermissionError: [Errno 13] Permission denied: 'C:\\Users\\frx\\AppData\\Local\\Temp\\tmpq09lk748'
I tried to apply the suggestion from the post below with the sudo() command. before the read. But it does not work.
https://www.odoo.com/es_ES/forum/ayuda-1/permissionerror-errno-13-permission-denied-160577
I appreciate the help