Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
2588 Vistas

 I'm just starting on odoo and i have experienced a minor issue during tutorials. I was following how to create a form but i can't fix the misalignment issue. I think it's because of the Text field (Description), when i remove it, the fields are aligned perfectly. Any  fixes?


Here's the sample view since i can't post a picture yet:


Title: _____ ​Description:

_________________________________________________ ​Postcode:

_________________________________________________


____________  ​Date availability ​__________  Expected Price:

____________  ​Selling Price ​__________  Bedrooms

____________


when it should be like this

Title: ___________________

Description: ______________________________________________

___________________________________________________________

Postcode: __________

Data availability: _____________

Selling price: _________________


Something like that.


Here's the xml:

<odoo><recordid="estate_property_action"model="ir.actions.act_window"><fieldname="name">Propertiesfield><fieldname="res_model">estate.propertyfield><fieldname="view_mode">tree,formfield>record>
odoo>
Avatar
Descartar
Mejor respuesta

Hi,

You may haven't defined the form view for your newly added model and thus odoo is generating a form view, with available fields in the model.

In order to resolve the issue and to have a properly aligned form view, you have to add a form view for your model inside your addon. Once you define the form, it will align as per how you defined inside the module.


Sample form view:


<record id="category_form" model="ir.ui.view">
<field name="name">category form viewfield>
<field name="model">test_new_api.categoryfield>
<field name="arch" type="xml">
<form string="Category">
<sheet>
<group>
<field name="name"/>
<field name="parent"/>
<field name="root_categ"/>
<field name="dummy"/>
<field name="color"/>
group>
sheet>
form>
field>
record>



Thanks

Avatar
Descartar
Autor

Thank you so much!

Mejor respuesta

To fix the misalignment issue in the form, you can try to adjust the width of the Text field (Description) in the XML code. You can do this by setting the 'width' attribute to the desired width size, or you can also try setting the 'widget' attribute to 'text' which should allow you to adjust the width of the field.

After making the adjustments, make sure to save the XML code and restart the Odoo server.

Avatar
Descartar
Mejor respuesta

Hi,

You can add the form with proper align using tags. like this example.

<form string="Model Form">
<sheet>
<group>
<field name="name"/>
<field name="description"/>
<field name="post_code"/>
<field name="data"/>
<field name="sell_price"/>
</group>
</sheet>
</form>

Please check this video link

https://www.youtube.com/watch?v=lwvK4WeTHdI

Regards

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
mar 23
1796
1
nov 22
2508
3
abr 24
3836
1
jun 23
4501
2
ago 24
3162