1

I'm using odoo 8 in my class I use a field selection but when I use it in the view XML with the widget statusbar the values are all in not order (all mess up) it is showing me the values in the statusbar first cancel, then new, then confirm all in disorder why is doing this?

this is my code in the class

'state': fields.selection ({('new','Nueva'),
                    ('draft','Asignada'),
                    ('cancel','Cancelada'),
                    ('sent','Revisada'),
                    ('confirmed','Atendiendose'),
                    ('done','Liberada'),
                    ('agent','Agendada')},
                     'Estatus Orden')

in the view xml i only worte this:

field name="state" widget="statusbar"

I don't know how to order correctly because the bar shows the list in not order does anybody know?

pna
  • 5,651
  • 3
  • 22
  • 37
FC Hackers
  • 45
  • 3
  • 9

2 Answers2

0

You can arrange the sequence of the state. You can add state to status bar in the following way

<field name="state" widget="statusbar" statusbar_visible="new,draft,confirmed,cancel" />    
  • i did that already and only showed me in screen 5 from the 7 states.and they are not in the same order as i wrote in the code, why is doing this to me – FC Hackers Mar 05 '15 at 17:33
0

You need to replace {} in fields.selection by [].

Because there is huge difference between set {} and list [].

Set :

The sets module provides classes for constructing and manipulating unordered collections of unique elements. Common uses include membership testing, removing duplicates from a sequence, and computing standard math operations on sets such as intersection, union, difference, and symmetric difference.

Refer more about Set

List :

Lists are are really variable-length arrays, not Lisp-style linked lists. The list type is a container that holds a number of other objects, in a given order (Ordered Collection). The list type implements the sequence protocol, and also allows you to add and remove objects from the sequence.

Refer more about List

Field definition :

'state': fields.selection ([('new','Nueva'), ('draft','Asignada'), ('cancel','Cancelada'), ('sent','Revisada'), ('confirmed','Atendiendose'), ('done','Liberada'), ('agent','Agendada')], 'Estatus Orden')

Difference between Set and List

Sets and Lists in Python

In Python, when to use a Dictionary, List or Set?

Community
  • 1
  • 1