Hi, I am new to python and opnerp, and I am using OpenERP-7.
I have created a module and trying to override the def _get_logo(self, cr, uid, ids) method of /addons/base/res_company.py Line 268 to change the default company logo.
My module directory structure is:
âââ logo
âââ __init__.py
âââ change_logo
âââ __init__.py
âââ res_company.py
âââ sample.png
âââ __openerp__.py
res_company.py:
from osv import fields,osv
class res_company(osv.osv):
_inherit = "res.company"
def _get_logo(self, cr, uid, ids):
print '++++++++++++++ module is working ++++++++++++++'
return open(os.path.join( tools.config['root_path'], 'addons', 'base', 'res', 'sample.png'), 'rb') .read().encode('base64')
res_company()
And when I install the module, I get this:
2014-03-02 16:03:53,949 21968 INFO testdb2 openerp.modules.loading: loading 1 modules...
2014-03-02 16:03:53,974 21968 INFO testdb2 openerp.modules.loading: loading 28 modules...
2014-03-02 16:03:53,990 21968 INFO testdb2 openerp.modules.module: module change_logo: creating or updating database tables
2014-03-02 16:03:54,048 21968 INFO testdb2 openerp.modules.loading: loading 28 modules...
2014-03-02 16:03:54,050 21968 INFO testdb2 openerp.modules.loading: loading 28 modules...
2014-03-02 16:03:54,051 21968 INFO testdb2 openerp.modules.loading: loading 28 modules...
2014-03-02 16:03:54,053 21968 INFO testdb2 openerp.modules.loading: loading 28 modules...
2014-03-02 16:03:54,112 21968 INFO testdb2 openerp.modules.loading: Modules loaded.
2014-03-02 16:03:54,113 21968 INFO testdb2 openerp.addons.base.res.res_config: getting next operation
2014-03-02 16:03:54,113 21968 INFO testdb2 openerp.addons.base.res.res_config: getting next <openerp.addons.base.ir.ir_actions.ir_actions_todo object at 0x7fc868a77b50>
2014-03-02 16:03:54,115 21968 INFO testdb2 openerp.addons.base.res.res_config: next action is None
2014-03-02 16:03:54,116 21968 INFO testdb2 werkzeug: 127.0.0.1 - - [02/Mar/2014 16:03:54] "POST /web/dataset/call_button HTTP/1.1" 200 -
2014-03-02 16:03:54,134 21968 INFO testdb2 werkzeug: 127.0.0.1 - - [02/Mar/2014 16:03:54] "POST /web/menu/load_needaction HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 40825)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 640, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 693, in finish
self.wfile.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
Can you please tell me, what am I missing here?