Skip to Content
Menú
This question has been flagged
3 Respostes
2585 Vistes

 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
Best Answer

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!

Best Answer

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
Best Answer

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
Related Posts Respostes Vistes Activitat
2
de març 23
1792
1
de nov. 22
2502
3
d’abr. 24
3822
1
de juny 23
4488
2
d’ag. 24
3156