2015-06-26 10:25 GMT+02:00 [email protected] <[email protected]>:
>
>
> Am Freitag, 26. Juni 2015 08:32:10 UTC+2 schrieb Albert Cervera Areny:
>>
>> 2015-06-25 21:28 GMT+02:00  <[email protected]>:
>> > Hi,
>> >
>> > I want to check a One2Many field if the creator of the dataset is the
>> > actual
>> > logged in user. I try with domain like the following, but this don't
>> > work.
>> > All user can see all datasets. How can i solve the Problem?
>> >
>> >
>> > aaaaa = fields.One2Many('own.class','bbbbb','aaaaa',domain=[
>> >      ('create_uid', '=', Transaction().user)])
>> >
>> >
>> >
>> > @classmethod
>> >    def __setup__(cls):
>> >        super(Hshn, cls).__setup__()
>> >
>> >        cls._buttons.update({
>> >                'btn1': {
>> >                    #'readonly': Eval('like_state') != 'like',
>> >                    'readonly': Eval('aaaaa',[0])
>> >                    },
>> >                })
>>
>> I don't understand the constraint. Why do you need that?
>>
>> --
>> Albert Cervera i Areny
>> Tel. 93 553 18 03
>> @albertnan
>> www.NaN-tic.com
>
>
> in a tree view in each row is a button.
> This button should be only enable if the logged in user didn't have clicked
> this button anytime before.
> The class 'own.class' saves which row was clicked. (with the one2Many
> field). The construction of the one2Many field works,
> but what is missing is the that i can't read out if the create_uid of the
> class 'own.class' and the current logged in user are the same and make the
> Butten only readonly in this case.
> Thats what i treied with the domain.

You're trying to add a Python expression in PYSON, which is not Python...

The following should work:

('create_uid', '=', Eval('_user'))




-- 
Albert Cervera i Areny
Tel. 93 553 18 03
@albertnan
www.NaN-tic.com

Reply via email to