BadStatusLine: '' error on deleting google calendar event from python code - api

I've successfully created and updated the calendar events from python. And the below is my code to delete an event from python code.
def delete_google_event(self, cr, uid, task, user):
g_client = gtools.gcal.google_calendar_interface()
g_client.connect(user.google_email, user.google_password)
g_client.delete(task.google_event_id)
message = "Google event deleted, old id: %s" % (task.google_event_id)
I get the below error when using the above code. From the error message BadStatusLine: '' i understand that i receive a request from the server that system do not understand. But not sure how to solve it. And also the error seems to be with google cal API. Will there be any versioning prob? (i do it in openerp and i guess it's not a problem of openerp)
{/usr/lib/python2.7/dist-packages/gtools/gcal.py} deleting http://www.google.com/calendar/feeds/default/private/full/fpdoqrq4q5rroggkn2uaamojb0
{/usr/lib/python2.7/dist-packages/gtools/gcal.py} quering element uri: http://www.google.com/calendar/feeds/default/private/full/fpdoqrq4q5rroggkn2uaamojb0
!!!!http://localhost:9888/
!!!!
!!!!http://localhost:9888/
!!!!http://localhost:9888/
!!!!
!!!!http://localhost:9888/
2013-09-02 12:21:16,945 17720 ERROR jul-16-7575-t1 openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
File "/opt/workspace/openerp space/openerp-7.0-20130716-231027/openerp/osv/osv.py", line 131, in wrapper
return f(self, dbname, *args, **kwargs)
File "/opt/workspace/openerp space/openerp-7.0-20130716-231027/openerp/osv/osv.py", line 197, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/workspace/openerp space/openerp-7.0-20130716-231027/openerp/osv/osv.py", line 185, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/workspace/openerp space/openerp-7.0-20130716-231027/openerp/addons/google_calendar_task_sync/project_google_calendar.py", line 67, in unlink
self.delete_google_event(cr, uid, task, goog_uid)
File "/opt/workspace/openerp space/openerp-7.0-20130716-231027/openerp/addons/google_calendar_task_sync/project_google_calendar.py", line 92, in delete_google_event
g_client.delete(task.google_event_id)
File "/usr/lib/python2.7/dist-packages/gtools/gcal.py", line 78, in delete
self.cal_srv.DeleteEvent(event_uri)
File "/usr/lib/pymodules/python2.7/gdata/calendar/service.py", line 313, in DeleteEvent
url_params=url_params, escape_params=escape_params)
File "/usr/lib/pymodules/python2.7/gdata/service.py", line 1429, in Delete
headers=extra_headers, url_params=url_params)
File "/usr/lib/pymodules/python2.7/atom/__init__.py", line 92, in optional_warn_function
return f(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/atom/service.py", line 185, in request
data=data, headers=all_headers)
File "/usr/lib/pymodules/python2.7/gdata/auth.py", line 725, in perform_request
return http_client.request(operation, url, data=data, headers=headers)
File "/usr/lib/pymodules/python2.7/atom/http.py", line 174, in request
return connection.getresponse()
File "/usr/lib/python2.7/httplib.py", line 1030, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 407, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 371, in _read_status
raise BadStatusLine(line)
BadStatusLine: ''
I've referred this link Why am I getting this error in python ? (httplib). Still not sure of the prob. Kindly give me some clues to fix this. Thanks a lot for your time.

Hurrah!! It works fine in the Direct Connection. But not under proxy.

Related

External ID not found

Odoo Server Error
Traceback (most recent call last):
File "/home/odoo/src/odoo/14.0/odoo/tools/cache.py", line 85, in lookup
r = d[key]
File "/home/odoo/src/odoo/14.0/odoo/tools/func.py", line 71, in wrapper
return func(self, *args, **kwargs)
File "/home/odoo/src/odoo/14.0/odoo/tools/lru.py", line 34, in getitem
a = self.d[obj]
KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7f5794273a60>, 'account.account_invoices_without_payment')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/14.0/addons/web/controllers/main.py", line 2121, in report_download
response = self.report_routes(reportname, docids=docids, converter=converter, context=context)
File "/home/odoo/src/odoo/14.0/odoo/http.py", line 532, in response_wrap
response = f(*args, **kw)
File "/home/odoo/src/odoo/14.0/addons/web/controllers/main.py", line 2056, in report_routes
pdf = report.with_context(context)._render_qweb_pdf(docids, data=data)[0]
File "/home/odoo/src/odoo/14.0/addons/account/models/ir_actions_report.py", line 41, in _render_qweb_pdf
invoice_reports = (self.env.ref('account.account_invoices_without_payment'), self.env.ref('account.account_invoices'))
File "/home/odoo/src/odoo/14.0/odoo/api.py", line 511, in ref
return self['ir.model.data'].xmlid_to_object(xml_id, raise_if_not_found=raise_if_not_found)
File "/home/odoo/src/odoo/14.0/odoo/addons/base/models/ir_model.py", line 1944, in xmlid_to_object
t = self.xmlid_to_res_model_res_id(xmlid, raise_if_not_found)
File "/home/odoo/src/odoo/14.0/odoo/addons/base/models/ir_model.py", line 1928, in xmlid_to_res_model_res_id
return self.xmlid_lookup(xmlid)[1:3]
File "", line 2, in xmlid_lookup
File "/home/odoo/src/odoo/14.0/odoo/tools/cache.py", line 90, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/odoo/src/odoo/14.0/odoo/addons/base/models/ir_model.py", line 1921, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system:
account.account_invoices_without_payment
The error occurs when I tried to print an invoice. It happens even if I choose an empty print template. Any help?Thanks.
In my opinion, you should be check table ir_model_data with name=account.account_invoices_without_payment. If you can find, you must update module account. If you can't find, you can be insert new record table ir_model_data with name and res_id = id view account_invoices_without_payment in ir_ui_view.
May be help you.
Please upgrade the module account and make sure that the db using correctly. You can give db-filter to choose the db correctly
After checking in the settings-> external id. I find that somehow this external id got deleted for unknown reason. I opened an new database and compared and find that this is the case then I create a new eternal id according to the new db's value.

Socket error when connect to Google Big Query in my local PC

It was working fine for me to run following steps in past two days to connect to Big query in pycharm in my PC
step 1:gcloud auth application-default login
step 2 :then connect to BG in the Pycharm in my local PC.
however, when I used the same method to try today:
Below error occurs:
Since I am behind "Great Wall" in China, so can only use VPN to login in google cloud, so I am not sure if it is caused by the VPN or does it have something to do with the setting of my google'account ? however, I tried with "service-account-key", it happen to be the same issue log:
Traceback (most recent call last):
File "C:/Users/emma/PycharmProjects/GCP/INIT.py", line 134, in <module>
explicit()
File "C:/Users/emma/PycharmProjects/GCP/INIT.py", line 54, in explicit
for dataset in bigquery_client.list_datasets():
File "C:\Python27\lib\site-packages\google\cloud\iterator.py", line 218, in _items_iter
for page in self._page_iter(increment=False):
File "C:\Python27\lib\site-packages\google\cloud\iterator.py", line 247, in _page_iter
page = self._next_page()
File "C:\Python27\lib\site-packages\google\cloud\iterator.py", line 347, in _next_page
response = self._get_next_page_response()
File "C:\Python27\lib\site-packages\google\cloud\iterator.py", line 396, in _get_next_page_response
query_params=params)
File "C:\Python27\lib\site-packages\google\cloud\_http.py", line 299, in api_request
headers=headers, target_object=_target_object)
File "C:\Python27\lib\site-packages\google\cloud\_http.py", line 193, in _make_request
return self._do_request(method, url, headers, data, target_object)
File "C:\Python27\lib\site-packages\google\cloud\_http.py", line 223, in _do_request
body=data)
File "C:\Python27\lib\site-packages\google_auth_httplib2.py", line 187, in request
self._request, method, uri, request_headers)
File "C:\Python27\lib\site-packages\google\auth\credentials.py", line 121, in before_request
self.refresh(request)
File "C:\Python27\lib\site-packages\google\oauth2\service_account.py", line 310, in refresh
request, self._token_uri, assertion)
File "C:\Python27\lib\site-packages\google\oauth2\_client.py", line 143, in jwt_grant
response_data = _token_endpoint_request(request, token_uri, body)
File "C:\Python27\lib\site-packages\google\oauth2\_client.py", line 104, in _token_endpoint_request
method='POST', url=token_uri, headers=headers, body=body)
File "C:\Python27\lib\site-packages\google_auth_httplib2.py", line 116, in __call__
url, method=method, body=body, headers=headers, **kwargs)
File "C:\Python27\lib\site-packages\httplib2\__init__.py", line 1609, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "C:\Python27\lib\site-packages\httplib2\__init__.py", line 1351, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "C:\Python27\lib\site-packages\httplib2\__init__.py", line 1272, in _conn_request
conn.connect()
File "C:\Python27\lib\site-packages\httplib2\__init__.py", line 1075, in connect
raise socket.error, msg
socket.error: [Errno 10060]
I update the python-cloud library, then everything works fine now.
Hope it keep it all the time :(

Unknown report type: webkit Error when printing report?

I been with the following error for the past few days and I can't get a clue how to proceed.
The full error is:
2015-01-26 17:29:25,162 21218 ERROR myodoo openerp.service.report: Exception: Unknown report type: webkit
Traceback (most recent call last):
File "/opt/odoo/openerp/service/report.py", line 93, in go
result, format = openerp.report.render_report(cr, uid, ids, object, datas, context)
File "/opt/odoo/openerp/report/__init__.py", line 40, in render_report
return registry['ir.actions.report.xml'].render_report(cr, uid, ids, name, data, context)
File "/opt/odoo/openerp/api.py", line 237, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/openerp/addons/base/ir/ir_actions.py", line 155, in render_report
return new_report.create(cr, uid, res_ids, data, context)
File "/opt/odoo/openerp/report/report_sxw.py", line 391, in create
raise NotImplementedError(_('Unknown report type: %s') % report_type)
NotImplementedError: Unknown report type: webkit
2015-01-26 17:29:25,397 21218 ERROR myodoo openerp.addons.web.controllers.main: An exception occured during an http request
Traceback (most recent call last):
File "/opt/odoo/addons/web/controllers/main.py", line 69, in wrap
return f(*args, **kwargs)
File "/opt/odoo/addons/web/controllers/main.py", line 1576, in index
request.session.db, request.session.uid, request.session.password, report_id)
File "/opt/odoo/openerp/http.py", line 807, in proxy_method
result = dispatch_rpc(self.service_name, method, args)
File "/opt/odoo/openerp/http.py", line 100, in dispatch_rpc
result = dispatch(method, params)
File "/opt/odoo/openerp/service/report.py", line 34, in dispatch
res = fn(db, uid, *params)
File "/opt/odoo/openerp/service/report.py", line 141, in exp_report_get
return _check_report(report_id)
File "/opt/odoo/openerp/service/report.py", line 119, in _check_report
raise openerp.osv.orm.except_orm(exc.message, exc.traceback)
except_orm: (u'Unknown report type: webkit', (<type 'exceptions.NotImplementedError'>, NotImplementedError(u'Unknown report type: webkit',), <traceback object at 0x7fa2f9af8dd0>))
I been developing on my module so I thought it was something I touched, but even when I install previous working versions of the module I still get the same error.
That makes me feel that there might be a change in the system but I checked if wkhtmltopdf is working and everything seems normal.
Any clue on where to look will be really appreciated.
Thanks!
It can be that you don't have the Webkit report engine installed.
Check if the report_webkit module is installed.

Openerp Login Error

I've been getting this error and can't view the user's list and projects/task or even login using the user's login information.
Can anyone help me..
Thank you.
OpenERP Server Error
Client Traceback (most recent call last):
File "/opt/openerp/server/openerp/addons/web/http.py", line 195, in dispatch
response["result"] = method(self, **self.params)
File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1012, in search_read
return self.do_search_read(req, model, fields, offset, limit, domain, sort)
File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1047, in do_search_read
records = Model.read(ids, fields or False, req.context)
File "/opt/openerp/server/openerp/addons/web/session.py", line 40, in proxy
result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
File "/opt/openerp/server/openerp/addons/web/session.py", line 28, in proxy_method
result = self.session.send(self.service_name, method, *args)
File "/opt/openerp/server/openerp/addons/web/session.py", line 101, in send
raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)
Server Traceback (most recent call last):
File "/opt/openerp/server/openerp/addons/web/session.py", line 87, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/opt/openerp/server/openerp/netsvc.py", line 361, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp/server/openerp/service/web_services.py", line 601, in dispatch
res = fn(db, uid, *params)
File "/opt/openerp/server/openerp/osv/osv.py", line 167, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/opt/openerp/server/openerp/osv/osv.py", line 121, in wrapper
return f(self, dbname, *args, **kwargs)
File "/opt/openerp/server/openerp/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/openerp/server/openerp/osv/osv.py", line 164, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/openerp/server/openerp/addons/base/res/res_users.py", line 796, in read
res = super(users_view, self).read(cr, uid, ids, fields, context=context, load=load)
File "/opt/openerp/server/openerp/addons/base/res/res_users.py", line 272, in read
result = super(res_users, self).read(cr, uid, ids, fields=fields, context=context, load=load)
File "/opt/openerp/server/openerp/osv/orm.py", line 3575, in read
result = self._read_flat(cr, user, select, fields, context, load)
File "/opt/openerp/server/openerp/osv/orm.py", line 3660, in _read_flat
record.update(res3[record[col]])
KeyError: 3
Error shows that record for id 3 is not exist in database.
When you try to read the data from database its delete the record which you are trying to read.
Please reconnect and try to open project/task.
It's difficult to find the error with only that information, but I had several times a Key Error due to a problem updating the openerp server, and after updating again all, the problem dissapeared.
Try to update the module base from the user interface, and if that doesn't work, try to restart and update all the openerp server from the console.
Take a backup of database ,delete the current database and create a new one, later you can import all your data.
if there is any functional field, please check it. This kind of key error will raise in functional fields while returning the values in a desired format.

After OpenERP 7 upgrade "ERROR: relation "ir_model_constraint" does not exist"

I'd been using OpenERP 6 OK and decided to upgrade to version 7.
I downloaded openerp_7.0alpha-20121206-000102-1_all.deb from http://nightly.openerp.com/trunk/nightly/deb/ and installed it. Now when I browse to http://localhost:8069 I can no longer select the database (because when there is one DB there is no reason to show the selector,) and after log in I get:
OpenERP Server Error
Client Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/addons/web/http.py", line 195, in dispatch
response["result"] = method(self, **self.params)
File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 833, in authenticate
req.session.authenticate(db, login, password, env)
File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 113, in authenticate
uid = self.proxy('common').authenticate(db, login, password, env)
File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 28, in proxy_method
result = self.session.send(self.service_name, method, *args)
File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 101, in send
raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)
Server Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 87, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 361, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 413, in dispatch
return fn(*params)
File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 424, in exp_authenticate
res_users = pooler.get_pool(db).get('res.users')
File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 50, in get_pool
return get_db_and_pool(db_name, force_demo, status, update_module)[1]
File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 33, in get_db_and_pool
registry = RegistryManager.get(db_name, force_demo, status, update_module, pooljobs)
File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 156, in get
update_module, pooljobs)
File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 178, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module)
File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 296, in load_modules
loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report)
File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 164, in load_module_graph
init_module_models(cr, package.name, models)
File "/usr/lib/pymodules/python2.7/openerp/modules/module.py", line 373, in init_module_models
result = obj._auto_init(cr, {'module': module_name})
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3211, in _auto_init
self._add_sql_constraints(cr)
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3350, in _add_sql_constraints
self._save_constraint(cr, conname, 'u')
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 2859, in _save_constraint
""", (constraint_name, self._module))
File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 162, in wrapper
return f(self, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 227, in execute
res = self._obj.execute(query, params)
ProgrammingError: relation "ir_model_constraint" does not exist
LINE 2: SELECT 1 FROM ir_model_constraint, ir_module_mod...
^
So I try to run it manually like:
sudo openerp-server stop
su - openerp
openerp-server -d openerp1 -u all
and I get
2012-12-07 07:00:43,417 7584 ERROR openerp1 openerp: Failed to initialize database `openerp1`.
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/openerp/cli/server.py", line 97, in preload_registry
db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=openerp.tools.config['init'] or openerp.tools.config['update'], pooljobs=False)
File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 33, in get_db_and_pool
registry = RegistryManager.get(db_name, force_demo, status, update_module, pooljobs)
File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 156, in get
update_module, pooljobs)
File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 178, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module)
File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 296, in load_modules
loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report)
File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 164, in load_module_graph
init_module_models(cr, package.name, models)
File "/usr/lib/pymodules/python2.7/openerp/modules/module.py", line 373, in init_module_models
result = obj._auto_init(cr, {'module': module_name})
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3211, in _auto_init
self._add_sql_constraints(cr)
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3350, in _add_sql_constraints
self._save_constraint(cr, conname, 'u')
File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 2859, in _save_constraint
""", (constraint_name, self._module))
File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 162, in wrapper
return f(self, *args, **kwargs)
File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 227, in execute
res = self._obj.execute(query, params)
ProgrammingError: relation "ir_model_constraint" does not exist
LINE 2: SELECT 1 FROM ir_model_constraint, ir_module_mod...
What can I do, or should I have done to upgrade?
There is no free upgrade mechanism from OpenERP 6.0 to 7.0 for now. OpenERP SA makes a living by selling a commercial upgrade solution, for which you get a considerable discount if you have a yearly support contract with them.
Using -u all will probably attempt to upgrade you database schema, but il will not migrate your data (i.e. if a column was renamed, you will not get your data moved from the old column to the new one), and the views will not be migrated either : the new views with the same XML ids replace the old ones, new views are created, and old views are still there, possibly referencing fields which no longer exist. Basically your DB is now a total mess, and hopefully you have a backup which you can use to continue running v 6.0.
Did you have installed V6.1 too in the same machine?
This error happend when you have mixed old version modules and new ones.
I recommend install a Virtual Machine and try again on it, if im right, you ca unistall the package, delete all files (modules) related to the package and re-install.
If you need to repair database to old version, re-instal 6.1 or 6.0 and bring up your server with parameters -u all -d nameofdb.
Regards.