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

Hi all,

Is it possible to lock the unit of measure field to read only on the order lines in the sales order.

Thanks 

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

Yes, it is possible. You just need to open the xml file and add readonly="1" attribute to the uom field.

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

Hi,

Please refer to the code below:


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

    <field name="name">sale.order.view.form.inherit</field>

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

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

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

        <xpath

                expr="//field[@name='order_line']/list/field[@name='product_uom']" position="attributes">

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

        </xpath>

    </field>

</record>


Hope it helps.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
< field  name = "uom_id"  readonly = "1" />

This will make the Unit of Measure field read-only in the form view, meaning users will not be able to modify it.

You can use the attribute to conditionally make the field read-only based on a certain condition (such as the state of the manufacturing order).

< field name = "uom_id" attrs = "{'readonly': [('state', '=', 'done')]}" />

In this example, the UOM field will be read-only when the state of the Manufacturing Order is set to Done .

อวตาร
ละทิ้ง