Field Dict Tree view


Is it possible to visualize a Fields.Dict in a tree view ? I tried to use different widgets for the field in the tree.xml file but nothing seems to work. I am using Tryton 5.0.

Otherwise, I tried to create function fields to get/set the values. More precisely, my situation is:

  • a function field of a dict field with a getter and a setter_void
  • a function field of a char field (just to try to visualize one of the element of the dictionary), with a getter/setter

What I tried to do is:

  • to call a new setter for the function dict field, from the setter of the function char field
  • or to cls.write my function dict field directly into the setter of the function char field
  • or to update the values of my function dict field into an overloaded write() method

Nothing seems to work, I feel like I must go through the call of the setter of the function dict field to update the values of it.

How can I make it work ? Any help would be much appreciated.
Thank you.

Yes since Issue 8296: Implement Dict widget for tree view - Tryton issue tracker but as for xxx2Many fields, it will display only the number of keys.

For the other part I must say I could not follow nor understand what you try to achieve.

The version of the client that I am using does not include this part of the code sadly.
I just wanted to split the values of the dictionary into other function fields in order to visualize them afterwards and set the dictionnary properly.

Then you just need to define Function fields with only a getter that generate the string with the value to display. It will be easier to format the value in the coming release with Issue 10758: Display attribute values to complete variant name - Tryton issue tracker.

In my case, the difficulty remains in updating a fields.Function(fields.Dict()) from the values of others fields.Function(fields.Char()).
Thank you.

Another option is to upgrade to a newer series which will include the feature for free.
Note that the upgrade between tryton series is fully supported and you can upgrade whenever you want.

If the first Function field has a setter then you can make a write on it the setter of the second.
But it is strange to have Function fields of Function fields, why not take and update the data from the source?

There is existing code around the function field that I wanted to modify.