Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
2460 Widoki

 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>
Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor

Thank you so much!

Najlepsza odpowiedź

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
mar 23
1717
1
lis 22
2369
3
kwi 24
3722
1
cze 23
4314
2
sie 24
2942