Skip to Content
Menu
This question has been flagged

 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
Discard
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
Discard
Author

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
Discard
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
Discard
Related Posts Replies Views Activity
2
Mar 23
1711
1
Nov 22
2357
3
Apr 24
3710
1
Jun 23
4280
2
Aug 24
2928