İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
2317 Görünümler

Hi, I am new to odoo development following this tutorial in development (sry: couldn't attach the link.

however, after adding menu items, it kinda works, but the fields in the form is all over the place and it is not structured at all. Where did i do wrong.

Avatar
Vazgeç
En İyi Yanıt

Hi,
That might be because you didn't follow the proper structure for the View.

Group appropriate fields and try giving widgets for Many2many fields. Also use notebook pages for Many2one fields. 

Also, if you are adding chatter, add it after the form tag. Following these might give you a structured form

Regards

Avatar
Vazgeç
Üretici En İyi Yanıt

I am really really new to this, and was following the tutorials with these codes

in views.xml

 id="test_model_action" model="ir.actions.act_window">
     name="name">Test action
     name="res_model">test.model
     name="view_mode">tree,form
in menus.xml
 id="test_menu_root" name="Test">
     id="test_first_level_menu" name="First Level">
         id="test_model_menu_action" action="test_model_action"/>
    
The fields are scattered across the form. It does not appear as shown in the goal section.


Avatar
Vazgeç

Create form view for this model as like follows
<record id="test_modle_form_view" model="ir.ui.view">
<field name="name">test.model.form</field>
<field name="model">test.modle</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="test_field_1"/>
<field name="test_field_2"/>
</group>
</group>
</sheet>
</form>
</field>
</record>

En İyi Yanıt

Hi 

You can add the fields inside the form inside the tag.

Try with this code snippet for a form view

<record id="school_class_form_view" model="ir.ui.view">
   <field name="name">school.student.form</field>
   <field name="model">school.student</field>
   <field name="arch" type="xml">
       <form string="Student">
           <header>
                  <button name="action_confirm" type="object"
                           string="Confirm"
                           states="draft"/>
                   <field name="state" widget="statusbar"/>
           </header>
           <sheet>
               <group>
                   <group>
                       <field name="admn_code"/>
                       <field name="name"/>
                       <field name="address"/>
                       <field name="class_id"/>
                       <field name="division"/>
                   </group>
                   <group>
                       <field name="dob"/>
                       <field name="age"/>
                       <field name="admn_date"/>
                       <field name="officer_id"/>
                   </group>
               </group>
           </sheet>
           <div class="oe_chatter">
               <field name="message_follower_ids"/>
               <field name="activity_ids"/>
               <field name="message_ids"/>
           </div>
       </form>
   </field>
</record>


https://www.cybrosys.com/blog/basic-views-in-odoo-15#:~:text=Form%20View%20is%20used%20to,both%20structural%20and%20semantic%20components.

https://www.odoo.com/documentation/16.0/developer/reference/backend/views.html


Hope this Helps

Regards

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Eyl 22
2581
1
Ağu 22
2587
0
Nis 22
3496
1
Oca 22
4423
2
Eki 16
3298