Re: [tryton] default for selection field for a state

2016-02-18 Thread Vincent Bastos
On Fri, Feb 19, 2016 at 3:10 AM, Guillem Barba Domingo <
guillemba...@gmail.com> wrote:

> 2016-02-15 10:26 GMT+01:00 Vincent Bastos :
>
>>
>>
>> On Mon, Feb 15, 2016 at 6:08 PM, Cédric Krier 
>> wrote:
>>
>>> On 2016-02-14 22:15, Vincent Bastos wrote:
>>> > On Sunday, February 14, 2016 at 8:00:03 PM UTC+10, Cédric Krier wrote:
>>> > >
>>> > > On 2016-02-13 14:44, Vincent Bastos wrote:
>>> > > > Also, even the client displays the value 'draft' in that field
>>> before
>>> > > save
>>> > > > button is pressed.
>>> > >
>>> > > You can not trust the client to display the erroneous value because
>>> it
>>> > > is limited to display only value from the selection.
>>> > >
>>> >
>>> >
>>> > So somehow the client sends the value 'None' for the field State...
>>>
>>> I doubt about that. This is probably your code that does that.
>>
>>
>> yes, somehow my code tells the client to send that :) ...
>>
>
> It's hard to say without see the code. Can you post the state field
> definition?
>
> --
> Guillem Barba
> http://www.guillem.alcarrer.net
>

 Thanks for trying to help Guillem, but I fixed my error. I was missing a
field dependency.


-- 
*Vincent Bastos*
*Lava Lab Software*

-- 
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/CACLX58AF2GZH%3DvdPGvn-_%2BLRqiFMiLEPBfN-hXkn%3DkGhzRgsnQ%40mail.gmail.com.


Re: [tryton] default for selection field for a state

2016-02-18 Thread Guillem Barba Domingo
2016-02-15 10:26 GMT+01:00 Vincent Bastos :

>
>
> On Mon, Feb 15, 2016 at 6:08 PM, Cédric Krier 
> wrote:
>
>> On 2016-02-14 22:15, Vincent Bastos wrote:
>> > On Sunday, February 14, 2016 at 8:00:03 PM UTC+10, Cédric Krier wrote:
>> > >
>> > > On 2016-02-13 14:44, Vincent Bastos wrote:
>> > > > Also, even the client displays the value 'draft' in that field
>> before
>> > > save
>> > > > button is pressed.
>> > >
>> > > You can not trust the client to display the erroneous value because it
>> > > is limited to display only value from the selection.
>> > >
>> >
>> >
>> > So somehow the client sends the value 'None' for the field State...
>>
>> I doubt about that. This is probably your code that does that.
>
>
> yes, somehow my code tells the client to send that :) ...
>

It's hard to say without see the code. Can you post the state field
definition?

-- 
Guillem Barba
http://www.guillem.alcarrer.net

-- 
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/CAMgcrAw-5yf0XQ7qfAHSGTmL0gtDz7g0kCKRH0KPOFkf-G6P0w%40mail.gmail.com.


Re: [tryton] default for selection field for a state

2016-02-15 Thread Vincent Bastos
On Mon, Feb 15, 2016 at 6:08 PM, Cédric Krier  wrote:

> On 2016-02-14 22:15, Vincent Bastos wrote:
> > On Sunday, February 14, 2016 at 8:00:03 PM UTC+10, Cédric Krier wrote:
> > >
> > > On 2016-02-13 14:44, Vincent Bastos wrote:
> > > > Also, even the client displays the value 'draft' in that field before
> > > save
> > > > button is pressed.
> > >
> > > You can not trust the client to display the erroneous value because it
> > > is limited to display only value from the selection.
> > >
> >
> >
> > So somehow the client sends the value 'None' for the field State...
>
> I doubt about that. This is probably your code that does that.


yes, somehow my code tells the client to send that :) ...


-- 
*Vincent Bastos*
*Lava Lab Software*

-- 
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/CACLX58D%2BuS94hVQ2eQqK30GxVCNt_87Swx6jbM_NZ4txOiHWiQ%40mail.gmail.com.


Re: [tryton] default for selection field for a state

2016-02-15 Thread Vincent Bastos
On Mon, Feb 15, 2016 at 6:08 PM, Cédric Krier  wrote:

> On 2016-02-14 22:15, Vincent Bastos wrote:
> > On Sunday, February 14, 2016 at 8:00:03 PM UTC+10, Cédric Krier wrote:
> > >
> > > On 2016-02-13 14:44, Vincent Bastos wrote:
> > > > Also, even the client displays the value 'draft' in that field before
> > > save
> > > > button is pressed.
> > >
> > > You can not trust the client to display the erroneous value because it
> > > is limited to display only value from the selection.
> > >
> >
> >
> > So somehow the client sends the value 'None' for the field State...
>
> I doubt about that. This is probably your code that does that.
>
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "tryton" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tryton/20160215080812.GE11535%40tetsuo.
>



-- 
*Vincent Bastos*
*Lava Lab Software*

-- 
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/CACLX58C900HDUqh0OAuCxi_nGiuM-kp-XOibSSDvZDs%3D46WhPQ%40mail.gmail.com.


Re: [tryton] default for selection field for a state

2016-02-15 Thread Cédric Krier
On 2016-02-14 22:15, Vincent Bastos wrote:
> On Sunday, February 14, 2016 at 8:00:03 PM UTC+10, Cédric Krier wrote:
> >
> > On 2016-02-13 14:44, Vincent Bastos wrote: 
> > > Also, even the client displays the value 'draft' in that field before 
> > save 
> > > button is pressed. 
> >
> > You can not trust the client to display the erroneous value because it 
> > is limited to display only value from the selection. 
> >
> 
> 
> So somehow the client sends the value 'None' for the field State... 

I doubt about that. This is probably your code that does that.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
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/20160215080812.GE11535%40tetsuo.


Re: [tryton] default for selection field for a state

2016-02-14 Thread Vincent Bastos


On Sunday, February 14, 2016 at 8:00:03 PM UTC+10, Cédric Krier wrote:
>
> On 2016-02-13 14:44, Vincent Bastos wrote: 
> > 
> > 
> > On Sunday, February 14, 2016 at 12:15:04 AM UTC+10, Cédric Krier wrote: 
> > > 
> > > 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. 
> > > 
> > 
> > Tryton is telling me that I am trying to save a record with the field 
> state 
> > with a value None, but this field is required, so this is wrong. Right? 
>
> No, the field is not required but the value None is not in the selection 
> list. 


> > How can that be if the selection dictionary does not have any keys with 
> > None values, and there is even a default method? 
>
> I don't understand what you are talking about. What are you calling 
> "selection dictionary"? 
> As I said default method is only used if you don't specify a value. Here 
> it is pretty sure that you put 'None' as value. 
>

The available choices for this selection field does not include an option 
with the value None.
 

>
> > Also, even the client displays the value 'draft' in that field before 
> save 
> > button is pressed. 
>
> You can not trust the client to display the erroneous value because it 
> is limited to display only value from the selection. 
>


So somehow the client sends the value 'None' for the field State... 

-- 
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/ea7b4c30-41e9-45b2-b469-ca0fe37f3780%40googlegroups.com.


Re: [tryton] default for selection field for a state

2016-02-14 Thread Cédric Krier
On 2016-02-13 14:44, Vincent Bastos wrote:
> 
> 
> On Sunday, February 14, 2016 at 12:15:04 AM UTC+10, Cédric Krier wrote:
> >
> > 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. 
> >
> 
> Tryton is telling me that I am trying to save a record with the field state 
> with a value None, but this field is required, so this is wrong. Right?

No, the field is not required but the value None is not in the selection
list.

> How can that be if the selection dictionary does not have any keys with 
> None values, and there is even a default method?

I don't understand what you are talking about. What are you calling
"selection dictionary"?
As I said default method is only used if you don't specify a value. Here
it is pretty sure that you put 'None' as value.

> Also, even the client displays the value 'draft' in that field before save 
> button is pressed.

You can not trust the client to display the erroneous value because it
is limited to display only value from the selection.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
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/20160214095518.GA11535%40tetsuo.


Re: [tryton] default for selection field for a state

2016-02-13 Thread Cédric Krier
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: cedric.kr...@b2ck.com
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.


Re: [tryton] default for selection field for a state

2016-02-13 Thread Vincent Bastos


On Sunday, February 14, 2016 at 12:15:04 AM UTC+10, Cédric Krier wrote:
>
> 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. 
>

Tryton is telling me that I am trying to save a record with the field state 
with a value None, but this field is required, so this is wrong. Right?

How can that be if the selection dictionary does not have any keys with 
None values, and there is even a default method?

Also, even the client displays the value 'draft' in that field before save 
button is pressed.

-- 
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/05996563-7cef-4300-b347-00c1450d9511%40googlegroups.com.