2

Odoo shrinks the column header based on datatypes and when there are many fields in one2many tree view. the columns are shrinked.

When I checked the file list_editable_renderer.js under web folder There are these constants for column width

 const fixedWidths = {
            boolean: '70px',
            date: '92px',
            datetime: '146px',
            float: '92px',
            integer: '74px',
            monetary: '104px',
        };

I am just not able to solve this issue.

One2many

I tried changing few of the JS code, None seem to be working. Any help or guidance would be of a great help

Shravy
  • 656
  • 1
  • 23
  • 61
  • You can add a custom CSS to set the minimum width for those fields. You can set a class attribute (`no_shrink`) on the tree view then, in CSS, use that class to target the tree and use the `data-name` attribute to target a specif field. For example, you can target the `tax_id` field in sale order by using the following selector `.no_shrink th[data-name="tax_id"]` – Kenly Jul 07 '21 at 15:01
  • @Kenly, Thank you first of all for your time. I need to set custom width in the CSS right? .no_shrink th[data-name="tax_id"]{width: 1000px;} like this? – Shravy Jul 08 '21 at 01:21
  • You need to set the `min-width`. For example `.word_break th[data-name="tax_id"]{min-width: 50px;}`. – Kenly Jul 08 '21 at 08:17
  • Did you succeed to set the ``min-width`` – Kenly Jul 13 '21 at 10:04
  • Hi Kenly, Here is how I have tried it. – Shravy Jul 13 '21 at 12:09
  • .ef_saletree th[data-name="x_customer_order_length"]{min-width: 50px;} This I have defined in css file – Shravy Jul 13 '21 at 12:09
  • Since Its a tree view of Sale order I have given it like this - – Shravy Jul 13 '21 at 12:10
  • Still it is not showing any effect on tree view column, the customer_order_length is in a custom module, inheriting sale order line – Shravy Jul 13 '21 at 12:10

1 Answers1

1

You can add a custom CSS to set the minimum width for those fields. You can set a class attribute on the tree view then, in CSS, use that class to target the tree and use the data-name attribute to target a specif field.

By default, min-width is set to 74px, use !important to force the new value.

To show Customer length label, try length of 130px.

Example:

.ef_saletree th[data-name="x_customer_order_length"]{min-width: 130px !important;}
Kenly
  • 24,317
  • 7
  • 44
  • 60
  • Thank you for the efforts that you have shown. .ef_saletree [data-name="x_customer_order_length"]{width: 130px !important;}. This did the trick Kenly. Really appreciate your efforts. Thank you for helping me out. – Shravy Jul 16 '21 at 09:02
  • 1
    I'm glad to help – Kenly Jul 16 '21 at 09:12