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

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!

อวตาร
ละทิ้ง

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.

ผู้เขียน

Thanks!

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

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!

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

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 22
3899
0
ม.ค. 23
2598
CRM LEAD TREE (VIEW:LIST) DECORATION แก้ไขแล้ว
2
ก.พ. 22
3400
Auto refresh tree view แก้ไขแล้ว
1
มิ.ย. 23
5736
3
เม.ย. 21
6495