Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
2621 Visualizzazioni

The new key should not be added at the end. it should be added in the middle.For example, Assume that we have draft,quotation,order in state(selection) field. I need to add new key as 'verification' before 'order' key in selection field.
Any Solution?

Avatar
Abbandona

I think it you need to add in the middle, then you might have to rewrite the field with new selections instead of using selection_add

Risposta migliore

Create new class that inherits your base class, overwrite your state fields as below:

state = fields.Selection(selection_add=[('verifcation', 'Verification'), ('order',)])

You can search with 'selection_add' in Odoo base(fields.py), to see more details in Odoo 13.

Avatar
Abbandona
Risposta migliore

The Selection field accepts a method so provide that method to the selection value create a method and return the values in the order that you want.

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
ago 25
2598
1
lug 25
1005
1
ago 25
1151
0
mag 25
1458
2
apr 25
3610