Understanding views and forms


#1

I’ve created a basic view from the flectra-bin scaffolding, uncommenting the sections I need for a very basic UI

I’m wanting to change the layout of the basic auto-generated edit form
How would I move the circled field label and value to a new line for easier reading?

Here’s the XML

<record model="ir.ui.view" id="mwl_test.list">
  <field name="name">mwl_test list</field>
  <field name="model">mwl_test.edi_profile</field>
  <field name="arch" type="xml">
    <tree>
	  <field name="name"/>
	  <field name="transaction"/>
      <field name="version"/>
	  <field name="from_id"/>
      <field name="to_id"/>
	  <field name="path"/>
	  <field name="active"/>
    </tree>
  </field>
</record>


<!-- actions opening views on models -->

<record model="ir.actions.act_window" id="mwl_test.action_window">
  <field name="name">mwl_test window</field>
  <field name="res_model">mwl_test.edi_profile</field>
  <field name="view_mode">tree,form</field>
</record>


<!-- server action to the one above -->

<record model="ir.actions.server" id="mwl_test.action_server">
  <field name="name">mwl_test server</field>
  <field name="model_id" ref="model_mwl_test_edi_profile"/>
  <field name="state">code</field>
  <field name="code">
    action = {
      "type": "ir.actions.act_window",
      "view_mode": "tree,form",
      "res_model": self._name,
    }
  </field>
</record>


<!-- Top menu item -->

<menuitem name="mwl_test" id="mwl_test.menu_root"/>

<!-- menu categories -->

<menuitem name="EDI Profile" id="mwl_test.menu_1" parent="mwl_test.menu_root"/>
<!--<menuitem name="Menu 2" id="mwl_test.menu_2" parent="mwl_test.menu_root"/>-->

<!-- actions -->

<menuitem name="List" id="mwl_test.menu_1_list" parent="mwl_test.menu_1"
          action="mwl_test.action_window"/>
<!--
<menuitem name="Server to list" id="mwl_test" parent="mwl_test.menu_2"
          action="mwl_test.action_server"/>
-->

I’m assuming I need to start a form within the view XML
TIA for any help or advice.


#2

This worked

<record model="ir.ui.view" id="mwl_test.list">
  <field name="name">mwl_test list</field>
  <field name="model">mwl_test.edi_profile</field>
  <field name="arch" type="xml">
    <tree>
	  <field name="name"/>
	  <field name="transaction"/>
      <field name="version"/>
	  <field name="from_id"/>
      <field name="to_id"/>
	  <field name="path"/>
	  <field name="active"/>
    </tree>
  </field>
</record>

<record model="ir.ui.view" id="mwl_test.form">
  <field name="name">mwl_test form</field>
  <field name="model">mwl_test.edi_profile</field>
  <field name="arch" type="xml">
    <form>
	<group string="EDI Profile">
	  <field name="name"/>
	  <field name="transaction"/>
      <field name="version"/>
	  <field name="from_id"/>
      <field name="to_id"/>
	  <field name="path"/>
	  <field name="active"/>
	</group>
  </form>
  </field>
</record>



<!-- actions opening views on models -->

<record model="ir.actions.act_window" id="mwl_test.action_window">
  <field name="name">mwl_test window</field>
  <field name="res_model">mwl_test.edi_profile</field>
  <field name="view_mode">tree,form</field>
</record>


<!-- server action to the one above -->

<record model="ir.actions.server" id="mwl_test.action_server">
  <field name="name">mwl_test server</field>
  <field name="model_id" ref="model_mwl_test_edi_profile"/>
  <field name="state">code</field>
  <field name="code">
    action = {
      "type": "ir.actions.act_window",
      "view_mode": "tree,form",
      "res_model": self._name,
    }
  </field>
</record>


<!-- Top menu item -->

<menuitem name="mwl_test" id="mwl_test.menu_root"/>

<!-- menu categories -->

<menuitem name="EDI Profile" id="mwl_test.menu_1" parent="mwl_test.menu_root"/>
<!--<menuitem name="Menu 2" id="mwl_test.menu_2" parent="mwl_test.menu_root"/>-->

<!-- actions -->

<menuitem name="List" id="mwl_test.menu_1_list" parent="mwl_test.menu_1"
          action="mwl_test.action_window"/>
<!--
<menuitem name="Server to list" id="mwl_test" parent="mwl_test.menu_2"
          action="mwl_test.action_server"/>
-->


#3

Nice that you have found a working solution.
But your form view is not completely correct.

Please check the doc here: https://doc.flectrahq.com/reference/views.html#forms

As written in the doc your form should always have a section inside.
And for correct display you also should use tags.

Without additional attributes on every group is created with two columns (2 other groups or 1x label, 1x content). So <group><group><field name="name"/></group></group> will split the width because the child group is located in left part.

Having only one group will use the full width of the screen.