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

Hello everyone,

I have created a new area under "General Settings" (res_config_settings) for Odoo 12.

If I set my module as "application = True", I can see the icon defined for the module shown on the new General Settings Area

My problem is that my module is not an application. It is an addon and in this case, I cannot see the icon shown on this new settings area.

How can I force an icon to be shown on General Settings area?

Thank you all in advance

Best regards

PM

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

You have to define some settings in res.config.settings model and in view, for example


<odoo>
    <record id="res_config_settings_view_form" model="ir.ui.view">
        <field name="name">Debranding Configuration</field>
        <field name="model">res.config.settings</field>
        <field name="inherit_id" ref="website.res_config_settings_view_form"/>
        <field name="arch" type="xml">
            <xpath expr="//div[hasclass('app_settings_block')]" position="after">
                <div class="app_settings_block"
                     data-string="Debrand"
                     string="Debrand"
                     data-key="odoo-debrand-11"
                >
                                ...

.....

Here is an example form my debranding module. You can refer to this module and can find how I did for the debranding settings.

links:   https://github.com/hilarak/odoo_community_addons/blob/12.0/odoo-debrand-11/views/views.xml

Appstore: https://www.odoo.com/apps/modules/12.0/odoo-debrand-11/


Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you @Hilar,

Your links are very useful. I do use your debranding module also.

I have looked on the code and I did not find any part of it where you refer the "icon" to be shown under new area for general Settings. Unfortunately I am unable to post images here since several weeks.

I will try to explain myself:

- When we access General Settings, we can see on the left side, settings for the several applications installed.

Here we have: General Settings, Invoicing, Sales, Inventory... and so on, depending on the applications installed.

Every specific "settings area" has an icon which is the exact same icon as the application icon (ie. for the invoicing settings area, we can see the icon defined for the invoicing application).

I have created a "new settings area" for my addon, but the icon defined for my addon does not show on this new "settings area" I have created.

For testing purposes, I changed my addon to became an application instead of an addon and the icon shows fine for this new "settings area" I have created. So, if I define my addon as an application, icon shows fine, if I make it an addon, the icon does not show.

How can I make the icon show on this area for an addon (not an application)?

Thank you once again

best regards

PM

Câu trả lời hay nhất

Hello Paulo 

For adding icon in general settings you just follow one thing.

<div class="app_settings_block" data-string="Website Addon" string="

Website Addon" data-key="module_name">

In data key add your module name that's it then you able to see icon without setting application= True

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 7 20
13450
3
thg 10 23
9538
1
thg 9 23
3651
1
thg 5 23
2558
2
thg 4 23
3204