Related
when using find/find_one pymongo methods when on an apache2 server i get the following error :
No <class 'cryptography.x509.extensions.TLSFeature'> extension was found
when using pymongo on an apache2 server to connect and insert or delete in my mongodb collections it works just fine, but when i try to pull something out of the database (using find or find_one methods) i get an error, please note that this error only occurs while running the apache2 server, because when i connected and used find methods in a locally run python script it gave me the information without any errors.
if it is of any relevance, the web framework i am using is flask.
Edit : As for what is producing the error i dont know for sure, so here are the logs.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/var/www/html/srv21/SRVApp.py", line 17, in downloadpage
ThreadID = ThreadID.next()
File "/usr/local/lib/python3.10/dist-packages/pymongo/cursor.py", line 1248, in next
if len(self.__data) or self._refresh():
File "/usr/local/lib/python3.10/dist-packages/pymongo/cursor.py", line 1165, in _refresh
self.__send_message(q)
File "/usr/local/lib/python3.10/dist-packages/pymongo/cursor.py", line 1052, in __send_message
response = client._run_operation(
File "/usr/local/lib/python3.10/dist-packages/pymongo/_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pymongo/mongo_client.py", line 1330, in _run_operation
return self._retryable_read(
File "/usr/local/lib/python3.10/dist-packages/pymongo/_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pymongo/mongo_client.py", line 1442, in _retryable_read
with self._socket_from_server(read_pref, server, session) as (sock_info, read_pref):
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.10/dist-packages/pymongo/mongo_client.py", line 1282, in _socket_from_server
with self._get_socket(server, session) as sock_info:
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.10/dist-packages/pymongo/mongo_client.py", line 1217, in _get_socket
with server.get_socket(handler=err_handler) as sock_info:
File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pool.py", line 1407, in get_socket
sock_info = self._get_socket(handler=handler)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pool.py", line 1520, in _get_socket
sock_info = self.connect(handler=handler)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pool.py", line 1358, in connect
sock = _configured_socket(self.address, self.opts)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pool.py", line 1061, in _configured_socket
sock = ssl_context.wrap_socket(sock, server_hostname=host)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pyopenssl_context.py", line 369, in wrap_socket
ssl_conn.do_handshake()
File "/usr/local/lib/python3.10/dist-packages/pymongo/pyopenssl_context.py", line 125, in do_handshake
return self._call(super(_sslConn, self).do_handshake, *args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/pymongo/pyopenssl_context.py", line 108, in _call
return call(*args, **kwargs)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1894, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1603, in _raise_ssl_error
self._context._ocsp_helper.raise_if_problem()
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 319, in raise_if_problem
raise self._problems.pop(0)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 539, in wrapper
valid = callback(conn, ocsp_data, data)
File "/usr/local/lib/python3.10/dist-packages/pymongo/ocsp_support.py", line 298, in _ocsp_callback
ext = _get_extension(cert, _TLSFeature)
File "/usr/local/lib/python3.10/dist-packages/pymongo/ocsp_support.py", line 114, in _get_extension
return cert.extensions.get_extension_for_class(klass)
File "/usr/local/lib/python3.10/dist-packages/cryptography/x509/extensions.py", line 135, in get_extension_for_class
raise ExtensionNotFound(
cryptography.x509.extensions.ExtensionNotFound: No <class 'cryptography.x509.extensions.TLSFeature'> extension was found
I am getting TypeError, when I try to delete Warehouse instance.
Note: If I delete Shop instance, Warehouse under that Shop needs be deleted, that's why I used on_delete=models.CASCADE.
class Warehouse(models.Model):
"""Warehouse model"""
name = models.CharField(max_length=255)
shop = models.ForeignKey(Shop, on_delete=models.CASCADE)
class WarehouseViewSet(viewsets.ModelViewSet):
"""Viewset"""
queryset = models.Warehouse.objects.all()
serializer_class = serializers.WarehouseSerializer
Error:
TypeError: 'NoneType' object is not callable
[14/Feb/2021 22:10:46] "DELETE /api/v1/shop/warehouse/2/ HTTP/1.1" 500 113266
Internal Server Error: /api/v1/shop/warehouse/2/
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Python38\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Python38\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Python38\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Python38\lib\site-packages\rest_framework\viewsets.py", line 114, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Python38\lib\site-packages\rest_framework\views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "C:\Python38\lib\site-packages\rest_framework\views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "C:\Python38\lib\site-packages\rest_framework\views.py", line 476, in raise_uncaught_exception
raise exc
File "C:\Python38\lib\site-packages\rest_framework\views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "C:\Python38\lib\site-packages\rest_framework\mixins.py", line 91, in destroy
self.perform_destroy(instance)
File "C:\Python38\lib\site-packages\rest_framework\mixins.py", line 95, in perform_destroy
instance.delete()
File "C:\Python38\lib\site-packages\django\db\models\base.py", line 921, in delete
collector.collect([self], keep_parents=keep_parents)
File "C:\Python38\lib\site-packages\django\db\models\deletion.py", line 224, in collect
field.remote_field.on_delete(self, field, sub_objs, self.using)
Found the solution. I did not handle on_delete for Children model.
SOLUTION
class WarehouseChildren(models.Model):
data = models.PositiveIntegerField(default=0)
warehouse = models.ForeignKey(Warehouse, on_delete=models.SET_NULL, null=True)
or
class WarehouseChildren(models.Model):
data = models.PositiveIntegerField(default=0)
warehouse = models.ForeignKey(Warehouse, on_delete=models.CASCADE)
I have made it to which the model in django is built, but once adding data and clicking save my app crash
i get GDAL exception - OGR Failure, and it highlights in the crash page " {{ field.field }}" as the reason for the error.
here's screen shot Admin view for adding data to the model
i get this right away after clicking save
Anyone been through this? any help?
Thanks
Update :
I'm getting this error :
[12/Apr/2019 14:38:46] "GET /static/admin/img/gis/move_vertex_off.svg HTTP/1.1"
200 1129
[12/Apr/2019 14:39:14] "GET /static/admin/img/gis/move_vertex_on.svg HTTP/1.1" 2
00 1129
GDAL_ERROR 4: b'Unable to open EPSG support file gcs.csv.\nTry setting the GDAL_
DATA environment variable to point to the\ndirectory containing EPSG csv files.'
Internal Server Error: /admin/trial2/shop/add/
Traceback (most recent call last):
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\core\
handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\core\
handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\core\
handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\admin\options.py", line 606, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\utils
\decorators.py", line 142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\views
\decorators\cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\admin\sites.py", line 223, in inner
return view(request, *args, **kwargs)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\admin\options.py", line 1634, in add_view
return self.changeform_view(request, None, form_url, extra_context)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\utils
\decorators.py", line 45, in _wrapper
return bound_method(*args, **kwargs)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\utils
\decorators.py", line 142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\admin\options.py", line 1522, in changeform_view
return self._changeform_view(request, object_id, form_url, extra_context)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\admin\options.py", line 1554, in _changeform_view
form_validated = form.is_valid()
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\forms
\forms.py", line 185, in is_valid
return self.is_bound and not self.errors
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\forms
\forms.py", line 180, in errors
self.full_clean()
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\forms
\forms.py", line 381, in full_clean
self._clean_fields()
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\forms
\forms.py", line 399, in _clean_fields
value = field.clean(value)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\gis\forms\fields.py", line 79, in clean
geom.transform(self.srid)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\gis\geos\geometry.py", line 471, in transform
g = gdal.OGRGeometry(self._ogr_ptr(), srid)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\gis\gdal\geometries.py", line 115, in __init__
self.srs = srs
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\gis\gdal\geometries.py", line 284, in _set_srs
sr = SpatialReference(srs)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\gis\gdal\srs.py", line 92, in __init__
self.import_epsg(srs_input)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\gis\gdal\srs.py", line 277, in import_epsg
capi.from_epsg(self.ptr, epsg)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\gis\gdal\prototypes\errcheck.py", line 118, in check_errcode
check_err(result, cpl=cpl)
File "C:\Users\lgcge\Documents\copypostgis\venv\lib\site-packages\django\contr
ib\gis\gdal\error.py", line 59, in check_err
raise e(msg)
django.contrib.gis.gdal.error.GDALException: OGR failure.
[12/Apr/2019 14:39:45] "POST /admin/trial2/shop/add/ HTTP/1.1" 500 160518
admin.py :
from django import forms
from django.contrib.gis import admin
from django.contrib.gis.db import models
from django.contrib.gis.admin import OSMGeoAdmin
from .models import Shop
#admin.register(Shop)
class ShopAdmin(OSMGeoAdmin):
list_display = ('name', 'location')
model.py
from __future__ import unicode_literals
from django.contrib.gis.db import models
from django.contrib.gis.geos import Point
class Shop(models.Model):
name = models.CharField(max_length=100)
location = models.PointField()
address = models.CharField(max_length=100)
city = models.CharField(max_length=50)
Apologies for copy/pasting and only slightly modifying #Kiwi's answer. I tried adding a comment to the original answer but I could not add formatted code.
It seems now that you cannot install the 64 bit version of OSGEO4W any more. I installed the only version available here and modified #Kiwi's answer to reflect the lack of 64 bit. I'm on Windows 10. All works fine with the below.
import platform
import environ
WINDOWS = platform.system() == "Windows"
if WINDOWS:
# the below needs to change for linux
GDAL_LIBRARY_PATH = r'C:\OSGeo4W\bin\gdal303.dll'
GEOS_LIBRARY_PATH = r'C:\OSGeo4W\bin\geos_c.dll'
OSGEO4W = r"C:\OSGeo4W"
os.environ['OSGEO4W_ROOT'] = OSGEO4W
os.environ['GDAL_DATA'] = "C:\Program Files\GDAL\gdal-data" # OSGEO4W + r"\share\gdal"
os.environ['PROJ_LIB'] = OSGEO4W + r"\share\proj"
os.environ['PATH'] = OSGEO4W + r"\bin;" + os.environ['PATH']
if os.name == 'nt':
import platform
OSGEO4W = r"C:\OSGeo4W"
if '64' in platform.architecture()[0]:
OSGEO4W += "64"
assert os.path.isdir(OSGEO4W), "Directory does not exist: " + OSGEO4W
os.environ['OSGEO4W_ROOT'] = OSGEO4W
os.environ['GDAL_DATA'] = "C:\Program Files\GDAL\gdal-data" #OSGEO4W + r"\share\gdal"
os.environ['PROJ_LIB'] = OSGEO4W + r"\share\proj"
os.environ['PATH'] = OSGEO4W + r"\bin;" + os.environ['PATH']
the issue was that this code enforces the paths defined in it over geodjango, so even if you set system variables, still this code would dominate over the system variables.
If anyone has issue with OGR don't hesitate to comment
I had the same problem and this is how I was able to solve it.
first check your GDAL version and GEOS
by running following scripts
gdal-config --version
and
geos-config --version
If the versions of GDAL and GEOS do not match, you will need to either install a compatible version of GEOS or update GDAL to a version that is compatible with the version of GEOS you have installed.
For example if you have GEOS version 3.8.0 or above you will need to upgrade GDAL >= 3.1.2
In Odoo 9 community outgoing email used to work (smtp configured, etc.), but now I get the following error when trying to send any email (invoice, internal note, etc.) from any account, for any template.
Things I changed since it worked that might (or might not) be linked to this issue:
I installed and uninstalled the SMTP Server Per User plugin
I changed the "from: " email address in the email templates
Any clue why this occurs? Or any clue what this "body" key is and where it is supposed to be defined? Thanks!
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 605, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 642, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 316, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 309, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 893, in __call__
return self.method(*args, **kw)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 471, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 998, in call_button
action = self._call_kw(model, method, args, {})
File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 986, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 238, in wrapper
return old_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 369, in old_api
result = method(recs, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/wizard/mail_compose_message.py", line 191, in send_mail_action
return self.send_mail()
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/account/models/account_invoice.py", line 1306, in send_mail
return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/wizard/mail_compose_message.py", line 248, in send_mail
ActiveModel.browse(res_id).message_post(message_type='comment', subtype=subtype, **mail_values)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/models/mail_thread.py", line 1712, in message_post
new_message = MailMessage.create(values)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/models/mail_message.py", line 864, in create
user_signature=self.env.context.get('mail_notify_user_signature', True))
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/models/mail_message.py", line 926, in _notify
partners._notify(self, force_send=force_send, user_signature=user_signature)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/models/res_partner.py", line 127, in _notify
('notify_email', '!=', 'none')])._notify_by_email(message, force_send=force_send, user_signature=user_signature)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 236, in wrapper
return new_api(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/mail/models/res_partner.py", line 178, in _notify_by_email
new_emails, new_recipients_nbr = self._notify_send(not_values['body'], not_values['subject'], recipient_template_values['not_followers'], **base_mail_values)
KeyError: 'body'
#v11 odoo community
Solved Error : Odoo - outgoing email KeyError: 'body'
When Other User sends message on contacts page it gives outgoing email KeyError: 'body'.
This Error is occur from Mail Template : [mail module /data/ mail_data.xml]
so change Your Template Body code Or You Can Also inherit Mail Template:
Remove extra content in this mail_data.xml file.
% if ctx.get('website_url'):
% endif
Only This code Work Properly :
<p style="color: #555555;">
Sent by
% if ctx.get('website_url'):
<a href="${ctx['website_url']}" style="text-decoration:none; color: #875A7B;">
% endif
${ctx.get('company_name')}
</a>
using
<a target="_blank" href="https://www.odoo.com" style="text-decoration:none; color: #875A7B;">Odoo</a>.
</p>
Also Reference : https://i.stack.imgur.com/h8yMK.png
I did not solve the issue myself, but the person who did told me it came from a translation file and an "<" sign that was interpreted as a smaller than in the python code. So he changed the translation file to remove the smaller than.
I have Object class and i need to browse the model document.directory in this class. I tried this.
class node_database(object):
obj=openerp.registry(cr.dbname).get('document.directory')
print'obj',obj # it ptints document.directory
datas=obj.browse(cr,uid,ids)
print'datas',datas # Here nothing print
and also tried this:
osv_pool = pooler.get_pool(dbname)
dir_obj=osv_pool.get('document.directory')
Search function works fine but browse not?
Getting this error:
2016-06-24 06:41:52,690 9427 ERROR dms1 openerp.addons.document_ftp.ftpserver: Traceback (most recent call last):
File "/home/kabeer/odoo-8.0-20151229/openerp/addons/document_ftp/ftpserver/ftpserver.py", line 1806, in try_as_current_user
re=self.run_as_current_user(function, *args, **kwargs)
File "/home/kabeer/odoo-8.0-20151229/openerp/addons/document_ftp/ftpserver/ftpserver.py", line 1779, in run_as_current_user
return function(*args, **kwargs)
File "/home/kabeer/odoo-8.0-20151229/openerp/addons/document_ftp/ftpserver/abstracted_fs.py", line 509, in get_list_dir
listing = self.listdir(datacr)
File "/home/kabeer/odoo-8.0-20151229/openerp/addons/document_ftp/ftpserver/abstracted_fs.py", line 377, in listdir
res = node.children(cr)
File "/home/kabeer/odoo-8.0-20151229/openerp/addons/document/document.py", line 981, in children
res = self._child_get(cr, domain=domain) + self._file_get(cr)
File "/home/kabeer/odoo-8.0-20151229/openerp/addons/document/document.py", line 1022, in _child_get
print'cntobj_search_read',cntobj.search_read(cr, uid,[('id','=',1)],['name'],context=ctx)
File "/home/kabeer/odoo-8.0-20151229/openerp/api.py", line 256, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kabeer/odoo-8.0-20151229/openerp/models.py", line 5186, in search_read
result = self.read(cr, uid, record_ids, fields, context=read_ctx)
File "/home/kabeer/odoo-8.0-20151229/openerp/api.py", line 256, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kabeer/odoo-8.0-20151229/openerp/models.py", line 3144, in read
records = self.browse(cr, user, ids, context)
File "/home/kabeer/odoo-8.0-20151229/openerp/api.py", line 256, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kabeer/odoo-8.0-20151229/openerp/models.py", line 5266, in browse
return self._browse(Environment(cr, uid, context or {}), ids)
File "/home/kabeer/odoo-8.0-20151229/openerp/api.py", line 740, in __new__
env, envs = None, cls.envs
File "/home/kabeer/odoo-8.0-20151229/openerp/tools/func.py", line 109, in __get__
return self.fget.__get__(None, owner)()
File "/home/kabeer/odoo-8.0-20151229/openerp/api.py", line 713, in envs
return cls._local.environments
File "/usr/lib/python2.7/dist-packages/werkzeug/local.py", line 71, in __getattr__
raise AttributeError(name)
AttributeError: environments
Any solution pls?
for item in obj.search(cr, uid, []):
obj = self.browse(cr, uid, item)
print obj.name
Resolved this issue by create a new cursor.
new_cr = openerp.sql_db.db_connect(self.context.cr.dbname).cursor()
uid, context = self.context.uid, self.context.context
with api.Environment.manage():
self.env = api.Environment(new_cr, uid, context)
try:
datas=obj.browse(cr,uid,ids)
print'datas',datas # Here print
finally:
self.env.cr.close()