Sequence and handle widget in list view

widget: handle

List view is ordered by record id by default. However, you can change ordering by means of _order in python class.

The handle widget and sequence field together makes the sequencing feature on list view as it shown below:

handle widget

Step 1: Add sequence field in your python class

It is needed to add an integer field and ordering declaration in the python class:

class SdEmployeeGate(models.Model):
_name = 'sd_employee.gate'
_description = 'Gate in a Building'
_order = 'sequence,id asc'
sequence = fields.Integer('Sequence', default=10)

Step 2: Add the sequence field and handle widget to the  view xml file.

        <record model="ir.ui.view" id="sd_employee_gate_list">
<field name="name">sd_employee Gate List</field>
<field name="model">sd_employee.gate</field>
<field name="arch" type="xml">
<tree editable="top">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="location"/>
<field name="devices" widget="many2many_tags"/>
<field name="users" widget="many2many_avatar_user"/>
</tree>
</field>
</record>

Views
1 Total Views
1 Members Views
0 Public Views
Actions
0 Likes
0 Dislikes
0 Comments
Share on Social Networks
Share Link
Share by mail

Please login to share this webpage by email.