view attributes classmethod

79 views
Skip to first unread message

Francisco Maria Moyano Casco

unread,
Aug 1, 2017, 12:10:07 PM8/1/17
to tryton
Hi,
     I can't make work the view attribute classmethod. The code I use is this:

   @classmethod
    def view_attributes(cls):
        return [('/tree', 'colors', 'yellow'),]

   
Is there any example of how to use it with colors attribute?

   Thanks
         Francisco

Sergi Almacellas Abellana

unread,
Aug 3, 2017, 5:03:09 AM8/3/17
to try...@googlegroups.com
El 01/08/17 a les 16:54, Francisco Maria Moyano Casco ha escrit:
> Hi,
> I can't make work the view attribute classmethod. The code I use
> is this:
>
> * @classmethod
> def view_attributes(cls):
> return [('/tree', 'colors', 'yellow'),]
>
> *Is there any example of how to use it with colors attribute?
The colors attribute has been removed since version 3.8. See:

https://bugs.tryton.org/issue4861

for the full rational.



--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Francisco Maria Moyano Casco

unread,
Aug 4, 2017, 3:20:47 AM8/4/17
to tryton
 
So, there is no way to put some color on the tree list like before? Is there anything to replace that feature?
I need some elements on the three to change a property (colour was what I used for) depending on the state of the register. Something like "If state == urgent then color = red, elif state == not so urgent then color = blue, else color = green". Do you know what I mean?

Thanks
   Francisco

Sergi Almacellas Abellana

unread,
Aug 4, 2017, 3:24:38 AM8/4/17
to try...@googlegroups.com
El 04/08/17 a les 02:59, Francisco Maria Moyano Casco ha escrit:
> So, there is no way to put some color on the tree list like before? Is
> there anything to replace that feature?

The icons are here to replace colors:

https://bugs.tryton.org/msg22153


> I need some elements on the three to change a property (colour was what
> I used for) depending on the state of the register. Something like "If
> state == urgent then color = red, elif state == not so urgent then color
> = blue, else color = green". Do you know what I mean?

Yes. You should only have one button for each color. You should create
an icon for 'urgent', 'not so urgent' and 'green', and use each icon
depending on the record state (using a funcition field to compute it).

Francisco Maria Moyano Casco

unread,
Aug 4, 2017, 9:36:48 AM8/4/17
to tryton


El viernes, 4 de agosto de 2017, 4:24:38 (UTC-3), Sergi Almacellas Abellana escribió:
El 04/08/17 a les 02:59, Francisco Maria Moyano Casco ha escrit:
> So, there is no way to put some color on the tree list like before? Is
> there anything to replace that feature?

The icons are here to replace colors:

https://bugs.tryton.org/msg22153

Yea, I read the whole discussion. Very cool feature
 



> I need some elements on the three to change a property (colour was what
> I used for) depending on the state of the register. Something like "If
> state == urgent then color = red, elif state == not so urgent then color
> = blue, else color = green". Do you know what I mean?

Yes. You should only have one button for each color. You should create
an icon for 'urgent', 'not so urgent' and 'green', and use each icon
depending on the record state (using a funcition field to compute it).

--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk
 
Ok!

A last question, and I'm out. Is there any documentation about the whole ModelView.view_attributes()? Thanks
By the way, I'm working on Tryton 3.8

Thanks for all.

Karla Stenger

unread,
Aug 4, 2017, 10:02:41 AM8/4/17
to try...@googlegroups.com
2017-08-04 10:05 GMT-03:00 Francisco Maria Moyano Casco
<moyanocasco...@gmail.com>:
>
>
> El viernes, 4 de agosto de 2017, 4:24:38 (UTC-3), Sergi Almacellas Abellana
> escribió:
>>
>> El 04/08/17 a les 02:59, Francisco Maria Moyano Casco ha escrit:
>> > So, there is no way to put some color on the tree list like before? Is
>> > there anything to replace that feature?
>>
>> The icons are here to replace colors:
>>
>> https://bugs.tryton.org/msg22153

For future versions you can also take a look at
https://bugs.tryton.org/issue6643

>
>
> Yea, I read the whole discussion. Very cool feature
>
>>
>>
>>
>>
>> > I need some elements on the three to change a property (colour was what
>> > I used for) depending on the state of the register. Something like "If
>> > state == urgent then color = red, elif state == not so urgent then color
>> > = blue, else color = green". Do you know what I mean?
>>
>> Yes. You should only have one button for each color. You should create
>> an icon for 'urgent', 'not so urgent' and 'green', and use each icon
>> depending on the record state (using a funcition field to compute it).
>>
>> --
>> Sergi Almacellas Abellana
>> www.koolpi.com
>> Twitter: @pokoli_srk
>
>
> Ok!
>
> A last question, and I'm out. Is there any documentation about the whole
> ModelView.view_attributes()? Thanks
> By the way, I'm working on Tryton 3.8
>
> Thanks for all.
>
> --
> 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/3ad672ce-9ecb-4c3d-bd6d-136a3431a53c%40googlegroups.com.



--
-------------------------
Karla Mª Stenger Sábat
karla....@gmail.com

Cédric Krier

unread,
Aug 4, 2017, 10:35:07 AM8/4/17
to try...@googlegroups.com
On 2017-08-04 11:01, Karla Stenger wrote:
> 2017-08-04 10:05 GMT-03:00 Francisco Maria Moyano Casco
> <moyanocasco...@gmail.com>:
> >
> >
> > El viernes, 4 de agosto de 2017, 4:24:38 (UTC-3), Sergi Almacellas Abellana
> > escribió:
> >>
> >> El 04/08/17 a les 02:59, Francisco Maria Moyano Casco ha escrit:
> >> > So, there is no way to put some color on the tree list like before? Is
> >> > there anything to replace that feature?
> >>
> >> The icons are here to replace colors:
> >>
> >> https://bugs.tryton.org/msg22153
>
> For future versions you can also take a look at
> https://bugs.tryton.org/issue6643

This issue will not bring back the color on the list but only a visual
effect about the validity of the value of a field.
For me, the argument of https://bugs.tryton.org/issue4861 are still
valid even with the CSS of GTK+-3

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

Karla Stenger

unread,
Aug 4, 2017, 11:18:31 AM8/4/17
to try...@googlegroups.com
2017-08-04 11:30 GMT-03:00 Cédric Krier <cedric...@b2ck.com>:
> On 2017-08-04 11:01, Karla Stenger wrote:
>> 2017-08-04 10:05 GMT-03:00 Francisco Maria Moyano Casco
>> <moyanocasco...@gmail.com>:
>> >
>> >
>> > El viernes, 4 de agosto de 2017, 4:24:38 (UTC-3), Sergi Almacellas Abellana
>> > escribió:
>> >>
>> >> El 04/08/17 a les 02:59, Francisco Maria Moyano Casco ha escrit:
>> >> > So, there is no way to put some color on the tree list like before? Is
>> >> > there anything to replace that feature?
>> >>
>> >> The icons are here to replace colors:
>> >>
>> >> https://bugs.tryton.org/msg22153
>>
>> For future versions you can also take a look at
>> https://bugs.tryton.org/issue6643
>
> This issue will not bring back the color on the list but only a visual
> effect about the validity of the value of a field.
> For me, the argument of https://bugs.tryton.org/issue4861 are still
> valid even with the CSS of GTK+-3

ok, the title got me busted :-)

>
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric...@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/20170804143035.GF3538%40kei.
Reply all
Reply to author
Forward
0 new messages