On 2016-02-13 02:20, Vincent Bastos wrote:
> Hey,
> 
> I am getting the following error for a state field:
> 
> The value "None" of field "State" on "..." is not in the selection.
> 
> However I do have the default method in the class:
> 
>     @staticmethod
>     def default_state():
>         return 'draft'

This means that you are creating a record with the value 'None' for the
state field. The default value method is only used if there is no key
for the field in the dictionary.

> The only thing I am uncertain about is that I have seen this method defined 
> as a class method rather than a static method, but even changing this does 
> nothing.

staticmethod or classmethod at this point doesn't change but it is
semantically more correct to use a classmethod.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: [email protected]
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/20160213141316.GO20880%40tetsuo.

Reply via email to