Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
3 Vastaukset
9194 Näkymät

Hi,

I'd like to know if it's possible to define custom decorations for the tree view or if there is a way to specify custom colors for lines.

Thanks!

Avatar
Hylkää

Hi,

Possible decorations are listed here: https://www.odoo.com/fr_FR/forum/aide-1/what-are-the-possibilities-of-decoration-100630

you can check in code how they are defined and add, likewise, your custom ones.

Tekijä

Thanks!

Paras vastaus

Hi,


Try referring the blog on How to Add Colors to Tree View in Odoo 15 :  https://www.cybrosys.com/blog/how-to-add-colors-to-tree-view-in-odoo-15


Hope it helps

Avatar
Hylkää
Paras vastaus

Hi! I was able to create one IN ODOO 12!, but i needed to modify some little things in the base and web modules, wich isnt too recomended, but are little changes without risk of "watefall failure"

(essentialy i search in base and web the appears of "decoration-success" together with the other decorators and repast him defining for "decoration-customized1" , and finally creating in one .css  in my main module the style for o_list_view o_data_row o_text-customized1)


1)  base-> ir_ui_view python

add in ATTRS_WITH_FIELD_NAMES the


    'decoration-customized1',


2) in web/static/src/js/views/list/list_renderer.js

in var DECORATIONS = add


    'decoration-customized1',


3) in base/rng/tree_view.rng add:


            <rng:optional><rng:attribute name="decoration-customized1"/></rng:optional>


4)in my main module in

static/src/css/your_custom_classes.css define the style, for example:



.o_list_view .o_data_row.decoration-customized1 {


    background-color: #ffe4b5 !important; /* ejemplo: un beige suave */


    color: #000000 !important; /* texto rojo oscuro */


}


.o_list_view .o_data_row.text-customized1 {


    background-color: #ffe4b5 !important; /* ejemplo: un beige suave */


    color: #000000 !important; /* texto rojo oscuro */


}


5) and then in my main module

views/assets.xml declare


<?xml version="1.0" encoding="UTF-8"?>


<odoo>


  <data>


    <!-- Carga JS y CSS en backend -->


    <template id="assets_backend" inherit_id="web.assets_backend" name="Abatar Trucks Assets">


      <xpath expr="." position="inside">


        <link rel="stylesheet" type="text/css" href="/your_custom_module/static/src/css/your_custom_classes.css"/>


      </xpath>


    </template>


  </data>


</odoo>




6) add the "assets.xml" in your manifest declaration



This had to be enough.

If some dont work i call some modifys additionals that made, but im not sure about if are essentially necessary:


in web/static/lib/bootstrap/css/bootstrap.css


.text-customized1 {


  color: #000000 !important;


}




a.text-customized1:hover, a.text-customized1:focus {


  color: #555555 !important;


}



in web/static/lib/bootstrap/scss/_variables.scss

here are some color definitions that can create

replying the "succes" or "mute" for

customized1



and in web/static/lib/bootstrap/scss/utilities/_text.scss 

too


I hope that be useful like a guide at least!

Avatar
Hylkää
Paras vastaus

Hi Guillaume Deflaux,

Can you please check the below link to define custom decorations for the tree view with specify custom colors for lines:

https://www.cybrosys.com/blog/add-colors-to-tree-view-odoo-13

I Hope this will help you. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
toukok. 22
3932
0
tammik. 23
2619
2
helmik. 22
3442
1
kesäk. 23
5774
3
huhtik. 21
6517