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
2316 Widoki

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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.


Awatar
Odrzuć

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>

Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
wrz 22
2572
1
sie 22
2586
0
kwi 22
3493
1
sty 22
4421
2
paź 16
3298