跳至内容
菜单
此问题已终结

 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>
形象
丢弃
最佳答案

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

形象
丢弃
编写者

Thank you so much!

最佳答案

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.

形象
丢弃
最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
2
3月 23
1716
1
11月 22
2364
3
4月 24
3719
1
6月 23
4303
2
8月 24
2938