Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
4357 Vistas

hi all ! How can i change the layout of existing module in odoo ? Please provide learning sources.


edit: without using odoo studio.

Avatar
Descartar
Mejor respuesta

Try using xpath either you have to replace or inserting inside the layout.
For example:

<template name="websitecustom" id="website.custom" inherit_id="website.homepage">
        <xpath expr="//div[@id='wrap']" position="replace">
<p> Insert here </p>
      </xpath>
    </template>


Avatar
Descartar
Mejor respuesta

Hi,

If you are looking to apply changes inside the odoo views, like form, tree, pivot etc, you can inherit those views apply changes like changing labels, adding new fields, hiding existing fields etc. For this, just you need to create a new module inherit the corresponding view and apply changes using the xpath in the inherited view.

Sample:

See the sample of adding a new field in existing view in the sales module,

<record id="sale_order_inherit" model="ir.ui.view">
<field name="name">sale.order.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="new_field"/>
</field>
</field>
</record>

Another sample of making an existing field invisible,

<record id="sale_order_inherit" model="ir.ui.view">
<field name="name">sale.order.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="payment_term_id" position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>

If you are new to odoo, have a look at this explaining the same: How To Inherit And Add New Fields To Existing Views

Thanks

Avatar
Descartar
Autor

sir thank you for quick response.but what if i want to change position of create button of an existing module like for example i want that create button on left side of screen. This kind of layout change i am talking about.

you have to use xpath for that then the position:inside