Add item in selection field



I need to add an item to an existing selection field. I override the class in my module and i put the section field with my adds in it, but when update the database my add isn’t visible ??
This is not the correct way ??


(Maxime Richez) #2

I’m doing this way:

class NAME(metaclass=PoolMeta):
        __name__ = "xxxx"

    def __setup__(cls):
        super(ModuleName, cls).__setup__()
        selection = ('sent', 'Sent')
        if selection not in cls.field_name.selection:

(Sergi Almacellas Abellana) #3

@maxx on python3 it is no longer required to specify the name and cls to super class:

You can replace:

    super(moduleName, cls).__setup__()



(Korbinian Preisler) #4

You may also need to close and reopen the tab of the view with the affected field to see the new value even if you run the Tryton Client in “–dev” mode.



@maxx : Thank you, I had forgotten this way of doing

(system) closed #6

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.