odooodoo-14odoo-view

Format to xml view in odoo


I would like to give this structure to new fields that I add to this (inherited) view.

xml view

This is the xml code that I am using:

<?xml version="1.0" encoding="utf-8"?>
<odoo>

  <data noupdate="0">
        <record id="fleet_vehicule_l10n_new_form"
            model="ir.ui.view">
            <field name="name">fleet.vehicle.l10n.new.form</field>
            <field name="model">fleet.vehicle</field>
            <field name="inherit_id"
                ref="fleet.fleet_vehicle_view_form" />
            <field name="arch"
                type="xml">

                <field name="model_id"
                    position="after">
                    <group >
                        <field name="vehiculo_sat" />
                    </group>
                </field>

                <field name="description"
                    position="after">

                    <group string="MX EDI group">

                        <field name="transport_permit_no" />
                        <field name="transport_insurer" />
                        <field name="transport_insurance_policy" />
                        <field name="transport_perm_sct" />

                        <field name="vehicle_model" />
                        <field name="vehicle_config" />
                        <field name="vehicle_licence" />
                        <field name="trailer_ids" />
                        <field name="figure_ids" />
                    </group>
                </field>
            </field>
        </record>
    </data>
</odoo>

How can I achieve this? I understand that odoo uses bootstrap, but I don't know how to apply the classes in the xml of an inherited view.

Edit

I try this, but still not working:

<field name="description" position="after">



  <!-- <field name="vehicle_licence" />
                        <field name="vehicle_model" /> -->
  <group>

    <field name="transport_permit_no" />
    <field name="transport_insurer" />
    <field name="transport_insurance_policy" />
    <field name="transport_perm_sct" />
  </group>

  <field name="vehicle_config" />
  <group>
    <field name="trailer_ids" />
  </group>
  <group>
    <field name="figure_ids" />
  </group>
</field>

enter image description here

What am I doing wrong?


Solution

  • The description filed is inside a group, so adding two groups inside a group won't work like in the picture above.

    You can add the group to sheet like following:

    <xpath expr="//sheet" position="inside">
        <group>
            <group string="MX EDI group">
                <field name="transport_permit_no"/>
                <field name="transport_insurer"/>
                <field name="transport_insurance_policy"/>
                <field name="transport_perm_sct"/>
                <field name="vehicle_model"/>
                <field name="vehicle_config"/>
                <field name="vehicle_licence"/>
            </group>
             <group string="Second Group">
                 
             </group>
         </group>
         <group>
             <field name="trailer_ids"/>
             <field name="figure_ids"/>
         </group>
     </xpath>
    

    The default fleet vehicle form added six groups inside a group, so you can append the two groups inside that group

    Example:

    <xpath expr="//sheet/group" position="inside">
        <group string="MX EDI group">
            <field name="transport_permit_no"/>
            <field name="transport_insurer"/>
            <field name="transport_insurance_policy"/>
            <field name="transport_perm_sct"/>
            <field name="vehicle_model"/>
            <field name="vehicle_config"/>
            <field name="vehicle_licence"/>
        </group>
        <group string="Second Group">
            
        </group>
    </xpath>
    <xpath expr="//sheet/group" position="after">
        <group>
            <field name="trailer_ids"/>
            <field name="figure_ids"/>
        </group>
    </xpath>
    

    The default col attribute value for group is 2