Help

0

Column width in sale order lines

Avatar
C2S

Hello all,

I have added some custom fields to the sales order line tree view, in the sales order form.

This has caused the sales order lines tree view to overflow and a scroll bar appeared to be able to navigate.

I would like to see all the sales order lines columns without having to scroll horizontally, I have already reduced width in all my custom fields but it isn't enough. 

Is there a way to reduce the width in the columns of base fields such as "Quantity", "Delivered", etc ? 

I tried to add custom CSS but I can't seem to overwrite the widths, which seems generated in a dynamic way.

Any ideas ?

Thank you !

Ernesto. 

1 Comment
Avatar
Discard
Avatar
C2S
-

Hi all !

No one can help me or point me in the right direction on this one ?

Thanks !

2 Answers
0
Avatar
silpa m s
Best Answer

Hi,

Please try to inherit base fields which all you want and put inline css with !important. By default odoo will take the core css and using !important we can override the particular style.

if you want to reduce size of Quantity

<field name="qty" style="width:20px !important;"/>

Hope this will help you.

Thanks

1 Comment
Avatar
Discard
Avatar
C2S
-

Hi Silpa and thank you for your answer !!

I've located the right field with xpath, but the attribute width isn't affected at all :(

Here's my xpath sentence:

<xpath expr="//form[1]/sheet[1]/notebook[1]/page[@name='order_lines']/field[@name='order_line']/tree[1]/field[@name='product_uom_qty']" position="attributes">

<attribute name="style">width:20px !important;</attribute>

</xpath>

What is weird is that if I do the same thing with another attribute, like invisible, it works:

<xpath expr="//form[1]/sheet[1]/notebook[1]/page[@name='order_lines']/field[@name='order_line']/tree[1]/field[@name='product_uom_qty']" position="attributes">

<attribute name="invisible">1</attribute>

</xpath>

It's like the width isn't affected ...

Here's the fragment I want to modify from the sales form view:

<label for="product_uom_qty"/>

<div class="o_row" name="ordered_qty">

<field

context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom, 'uom_qty_change':True, 'company_id': parent.company_id}"

name="product_uom_qty"/>

</div>

Any idea why the style isn't applied ?

Thank you !!

0
Avatar
MUHAMMAD Imran
Best Answer

You can do this via custom CSS. create a file css and give there your own columns width.

Like that:

<template id="assets_login_backend" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/yourmodulename/static/src/css/web_backend_style.css"/>
</xpath>

</template> 

then do css according to your need. I have done this once. If you will feel any issue let me know. I will help you in that.


Thank

MUHAMMAD IMRAN

1 Comment
Avatar
Discard
Avatar
C2S
-

Thank you Muhammad for your answer ! I'm sorry to reply this late.

If I do what you propose, let's say I create a custom class, then how can I insert it onto the standard Odoo code ? Xpath the class into the div or the element I want to modify ?