İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
19047 Görünümler

Hi, I am trying to create a module that changes the upper left OpenERP logo, at the top of left menu.

I have a basic knowledge of how to create modules.

In /openerp/addons/web/static/src/xml/base.xml

<td class="oe_leftbar" valign="top">
   <t t-set="debug" t-value="__debug__ ? '&debug' : ''"/>
   <a class="oe_logo" t-attf-href="/?ts=#{Date.now()}#{debug}">
      <span class="oe_logo_edit">Edit Company data</span>
      <img t-att-src='widget.session.url("/web/binary/company_logo")'/>
   </a>
     ...

img t-att-src='widget.session.url("/web/binary/company_logo") this line is confusing me, because of widget.session.url.

In my module should I extend it and simply give the path of my image or is there any other way of doing this?

Any suggestions?

Avatar
Vazgeç
En İyi Yanıt

Hi,

You need to extend _get_logo method of /addons/base/res_company.py Line 268. You can just replace the name "res_company_logo.png" with your image after putting the image in res folder.

Hope this helps.

Avatar
Vazgeç
En İyi Yanıt

Don<t forget to clear the cache, you can test with inconito in chrome (I wasted alot of time because of that)

Avatar
Vazgeç
Üretici En İyi Yanıt

To inherit from /openerp/addons/project/project.py class.

I do this:

from openerp.osv import fields, osv
class test_module(osv.osv):
_inherit = "project.project"

// some code ...

test_module()

But now I have to inherit from /openerp/addons/base/res/res_company.py

How can I inherit from res_company.py and override the desired function?

Avatar
Vazgeç