Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
6 ตอบกลับ
19886 มุมมอง

Hi,

I want to change the Odoo default color in the custom module. Is there any easy way to do that?




Thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

I think you can achieve by using following steps

=>Override the scss file addons --> web --> static --> src --> scss --> primary_variables.scss and change these file's color

$o-community-color: green; #choose the color here (i selected green for community version)
$o-enterprise-color: #875A7B;
$o-enterprise-primary-color: #00A09D;


then link the scss file path in xml template

        <template id="_assets_primary_variables" inherit_id="web._assets_primary_variables">
            <xpath expr="//link[last()]" position="after">
                <link rel="stylesheet" type="text/scss" href=" { scss file path }"/>
            </xpath>
        </template>

The output of the above changes will be as following


Hope it helps

อวตาร
ละทิ้ง

Could you explain how should i override scss file?

คำตอบที่ดีที่สุด

Yes, there is an easy way to change the Odoo default color in a custom module. You can use a library like "ColorPicker" to quickly and easily modify the colors of your Odoo module. All you need to do is set the fields you want to change to the ColorPicker widget, then select the color you want. This can be done in a few simple steps.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

This method no longer works in Odoo 15.

Adding assets​ in the __manifest__.py​ file doesn't work either:

'assets': {
    'web.assets_common': [
        'my_theme/static/src/scss/primary_variables.scss',
    ],


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

where  link the xml template ? in views ? or creating a new view? sorry but i dont find where have to do this 






อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

What's the best way to deploy this in a module?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I also had to set the o-brand-odoo and o-brand-primary value in my custom.scss file...

$o-community-color: #0A7099;
$o-brand-odoo: $o-community-color;
$o-brand-primary: $o-community-color;
อวตาร
ละทิ้ง