跳至内容
菜单
此问题已终结
3 回复
178 查看

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?

形象
丢弃

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.

最佳答案

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

形象
丢弃
编写者 最佳答案

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

形象
丢弃
编写者

Codesphere Tech: Hello Lakhan Vachhani!

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

最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
2
8月 25
1008
3
9月 25
684
2
8月 25
4047
1
2月 25
7874
2
7月 25
2765