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

Hi everyone, i'm an Odoo developer and i need your help in a question i'm facing today.

(i'm using odoo 16v on my enviroment)

So my task i to hide a span in a form view in 'sales' the snippet of the form is this:

<group name="sale_shipping">
   <label for="commitment_date" string="Delivery Date"/>
      <div name="commitment_date_div" class="o_row">
           <field name="commitment_date"/>
  <span name="expected_date_span" class="text-muted">Expected:
​<field name="expected_date" class="oe_inline" widget="date"/>
​</span>
       </div>
</group>

i hided the field 'expected_date' correctly but the span's string "Expected:" still remain.


i tryed with this solution:

 <xpath expr="//group[@name='sale_shipping']/div[@name='commitment_date_div']/span[@name='expected_date_span']" position="attributes">
 <attribute name="invisible">1</attribute>
 </xpath>

but nevertheless, it give me this error along the terminal:


    raise err from from_exception
ValueError: Impossibile localizzare l'elemento "<xpath expr="//group[@name=&#39;sale_shipping&#39;]/div[@name=&#39;commitment_date_div&#39;]/span[@name=&#39;expected_date_span&#39;]">" nella vista principale
2025-05-26 14:24:11,781 1 INFO test_fritzfelix_30288 werkzeug: 172.18.0.1 - - [26/May/2025 14:24:11] "POST /web/dataset/call_kw/sale.order/get_views HTTP/1.1" 200 - 21 0.021 0.112

translated in english in short "Impossible to find the element in the view". but i gave to him the whole path to the span, i can find the solution.

someone can help me?

Thanks Cristian

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

the snippet you showed me is correct but you act in the Odoo core, because that form is in the odoo Core i need to act via xpath as i said in the description and hide it.

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

<xpath expr="//group[@name='sale_shipping']/div[@name='commitment_date_div']" position="replace">

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

        <field name="commitment_date"/>

        <span name="expected_date_span" class="text-muted" attrs="{'invisible': True}">

            Expected:

            <field name="expected_date" class="oe_inline" widget="date"/>

        </span>

    </div>

</xpath>


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มิ.ย. 23
2905
1
มิ.ย. 23
2711
1
พ.ย. 22
6758
1
ก.ค. 16
7491
1
มิ.ย. 15
4446