Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
19072 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhấ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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhấ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?

Ảnh đại diện
Huỷ bỏ