Skip to Content
Menú
This question has been flagged

Hi everyone,

In the Sale Order form, there’s a field called Delivery Date, which is currently located under the Other Info tab. This placement feels unintuitive. It would be much better and easier to use if this field were placed directly below the Quotation Date.

I tried moving it via Studio, but unfortunately, it wasn’t that simple. So, I need to find another way.

I found the relevant group in the sale.order.form:

<group name="sale_shipping" string="Shipping">
    <label for="commitment_date" string="Delivery Date"/>
    <div name="commitment_date_div" class="o_row">
        <field name="commitment_date" readonly="state == 'cancel' or locked"/>
        <span name="expected_date_span" class="text-muted">
            Expected: <field name="expected_date" class="oe_inline" widget="date"/>
        </span>
    </div>
</group>

However, simply copying and pasting this to a different location doesn’t seem like a good idea and won’t work. Also, I prefer not to modify the base sale.order.form directly.

Instead, I was considering creating a new view or using an inherited view to make the adjustments, but I haven’t been able to get it to work.

I looked around the community but couldn’t find a related topic or solution. I previously created a custom field where our sales team can set the week number, but this approach doesn’t work well for planning. If we use the Delivery Date correctly, Odoo can group orders by weeks, making it easier to plan deliveries.

I believe I can keep that custom field and use the information from this post: Display in a Field the Week Number of the Commitment Date to have it both ways.

However, replacing the Delivery Date field seems more complicated than I initially thought.

Any tips or tricks would be greatly appreciated!

Thanks in advance,

Avatar
Descartar
Best Answer

Hii,

Here's how to do it with a custom module or via XML in Studio (Advanced > XML view):

<odoo>

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

        <field name="name">sale.order.form.move.commitment.date</field>

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

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

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

           

            <!-- Insert after Quotation Date -->

            <xpath expr="//field[@name='date_order']" position="after">

                <group>

                    <field name="commitment_date"/>

                </group>

            </xpath>


            <!-- Optional: remove original delivery date group from Other Info -->

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

            <!-- You can also use position="attributes" to hide it instead -->

        </field>

    </record>

</odoo>


i hope it is usefull

Avatar
Descartar
Best Answer

Hi,


Try with the following code


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

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

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

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

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


        <!-- Insert after Quotation Date -->

        <xpath expr="//field[@name='date_order']" position="after">

            <field name="commitment_date" readonly="state == 'cancel' or locked"/>

        </xpath>


        <!-- Remove it from the old location -->

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

    </field>

</record>



Hope it helps

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
d’abr. 25
597
2
de set. 24
1589
1
d’abr. 24
1529
4
de gen. 23
3520
4
d’abr. 25
1764