Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
177 Weergaven

I am new to Odoo, and working with 19 version.

I need to hide "Units" from the quantity column.

I tried making invisible the field over:

<field name="product_uom_id" groups="uom.group_uom" widget="many2one_uom" invisible="1"/> on sale.order.line.list 

<field name="product_uom_id" force_save="1" groups="uom.group_uom" widget="many2one_uom" readonly="product_uom_readonly" required="not display_type" invisible="1"/> on  sale.order.line.form.readonly


<span t-field="line.product_uom_id" invisible="1">units</span> on  report_saleorder_document 

Is there another viw that I am missing? Or is my xml coding incorrect?

Avatar
Annuleer

Hello,
Specify the report name where you want to hide UOM.

Hello,
Below is the line I found on the report_saleorder_document in Odoo 18..
<span t-field="line.product_uom">units</span>
Inherit the template and remove this line or hide..

Hello, Lorena
invisible attributes works only in field level not in tags and if you have already inherited that template just replace the position with blank or remove the code.

Beste antwoord

Hello Lorena,

 

If you want to hide the “Units of Measure” from the PDF report (for example, in the Sale Order report), you can do this easily by inheriting the specific QWeb report template and applying the d-none class using XPath with the position="attributes" directive.

 

Steps to Hide UoM in PDF Report

 

Inherit the report template and use XPath to add the Bootstrap d-none class to the UoM field.

 

Example Code:

<odoo>

<!-- Inherit the Sale Order PDF report -->

<template id="report_saleorder_document_inherit_hide_uom" inherit_id="sale.report_saleorder_document">


<!-- Hide only the UoM text (the span field) -->

<xpath expr="//span[@t-field='line.product_uom']" position="attributes">

<attribute name="class">d-none</attribute>

</xpath>

        </template>

</odoo>

 

If you have any questions, feel free to reach out.


Hope this helps!


Thanks & Regards,

Email : odoo@aktivsoftware.com

Avatar
Annuleer
Auteur Beste antwoord

Codesphere Tech: I want to hide Units (not quantity) from quotation PDF reports.

Avatar
Annuleer
Auteur

Codesphere Tech: Hello Lakhan Vachhani!

I deleted the line and the magic happenned!! Thank you!!

Beste antwoord

Hi,


Try the following code,


1- Sale order line.


Override the tree view for sale.order.line and remove the UoM widget from the product_uom_qty field. Example:


<record id="view_order_line_tree_no_uom" model="ir.ui.view">

    <field name="name">sale.order.line.tree.no.uom</field>

    <field name="model">sale.order.line</field>

    <field name="inherit_id" ref="sale.view_order_line_tree"/>

    <field name="arch" type="xml">

        <xpath expr="//field[@name='product_uom_qty']" position="replace">

            <field name="product_uom_qty"/>

        </xpath>

    </field>

</record>


2- PDF report.


Simply remove or comment out the product_uom_id span, or replace it with just the quantity field:


<span t-field="line.product_uom_qty"/>


Hope it helps

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
aug. 25
1008
3
sep. 25
684
2
aug. 25
4047
1
feb. 25
7874
2
jul. 25
2765