Restore colors attribute on tree view

53 views
Skip to first unread message

Carlos Ibrahim Arias

unread,
Mar 30, 2017, 8:50:08 AM3/30/17
to tryton-dev
Hello World : )

I'm developing an installation using tryton 3.8 to gnuhealth 3 and the client wants to use colors on tree views in appointments and other models.

I found that this functionallity was removed as indicated on https://tryton-rietveld.appspot.com/16551002

I tried to restore the color attribute adding back all the removed lines but I'm getting the following error:

Traceback (most recent call last):
  File "/trytond/protocols/jsonrpc.py", line 162, in _marshaled_dispatch
    response['result'] = dispatch_method(method, params)
  File "/trytond/protocols/jsonrpc.py", line 191, in _dispatch
    res = dispatch(*args)
  File "/trytond/protocols/dispatcher.py", line 162, in dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/model/modelview.py", line 342, in fields_view_get
    result['field_childs'])
  File "/trytond/model/modelview.py", line 398, in _view_look_dom_arch
    for xpath, attribute, value in cls.view_attributes():
TypeError: unbound method view_attributes() must be called with ir.module instance as first argument (got nothing instead)

Anyone can help?

Thanks in advanced,

Carlos

Sergi Almacellas Abellana

unread,
Mar 30, 2017, 8:55:10 AM3/30/17
to tryto...@googlegroups.com
El 30/03/17 a les 13:56, Carlos Ibrahim Arias ha escrit:
> Hello World : )
>
> I'm developing an installation using tryton 3.8 to gnuhealth 3 and the
> client wants to use colors on tree views in appointments and other models.

Why you don't use icons? The colors were removed in favor of icons.
>
> I found that this functionallity was removed as indicated on
> https://tryton-rietveld.appspot.com/16551002
>
> I tried to restore the color attribute adding back all the removed lines
> but I'm getting the following error:
>
> Traceback (most recent call last):
> File "/trytond/protocols/jsonrpc.py", line 162, in _marshaled_dispatch
> response['result'] = dispatch_method(method, params)
> File "/trytond/protocols/jsonrpc.py", line 191, in _dispatch
> res = dispatch(*args)
> File "/trytond/protocols/dispatcher.py", line 162, in dispatch
> result = rpc.result(meth(*c_args, **c_kwargs))
> File "/trytond/model/modelview.py", line 342, in fields_view_get
> result['field_childs'])
> File "/trytond/model/modelview.py", line 398, in _view_look_dom_arch
> for xpath, attribute, value in cls.view_attributes():
> TypeError: unbound method view_attributes() must be called with
> ir.module instance as first argument (got nothing instead)

I don't understand why this error is related to the patch. The problem
here is that view_attributes must be a classmethod, but you have one
which is defined as instance method.


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

Cédric Krier

unread,
Mar 30, 2017, 9:05:05 AM3/30/17
to tryton-dev
On 2017-03-30 04:56, Carlos Ibrahim Arias wrote:
> I tried to restore the color attribute adding back all the removed lines
> but I'm getting the following error:
>
> Anyone can help?

I doubt you will find any help to restore a feature that was decided to
remove. Instead I can suggest you to use icons instead of colors. They
are better for accessibility because they are readable for blind people
and they can express an exact meaning.

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

Carlos Ibrahim Arias

unread,
Apr 10, 2017, 2:55:07 PM4/10/17
to tryton-dev
I understand that this function has been deprecated and removed from the code but the point is that there are final users for whom this is a requirement. We should give them the possibility to chose what they want for their usability and accessibility if they consider is good for them. 

In this case the final user is demanding this option. Please help me to fullfill his requirement. 

I restored all the removed code indicated at the changeset http://hg.tryton.org/trytond/rev/f21ba9c81eb6, but when adding the following @classmethod for testing to the class Appointment the elements in the tree view are in black color, and they should be in red color.

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

Thanks in advanced

Raimon Esteve

unread,
Apr 12, 2017, 10:31:52 AM4/12/17
to tryto...@googlegroups.com

I understand that this function has been deprecated and removed from the code but the point is that there are final users for whom this is a requirement. We should give them the possibility to chose what they want for their usability and accessibility if they consider is good for them. 

In this case the final user is demanding this option. Please help me to fullfill his requirement. 

I restored all the removed code indicated at the changeset http://hg.tryton.org/trytond/rev/f21ba9c81eb6, but when adding the following @classmethod for testing to the class Appointment the elements in the tree view are in black color, and they should be in red color.

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

This code show all lines in red color.

See other example: list modules and installed.


Are you patched the client (tryton) and trytond?

Regards.
Reply all
Reply to author
Forward
0 new messages