Hello,

what is the best way in Tryton to view a tree with many parents per
entry?


Goal
----
We have an Artist class which can be a person or a band/group/project.
Bands could be made of other Artists.
I would like to see a tree view with Artists, which can have many
Bands as a parent. So one and the same Artist can be member of many
bands, like this:

* Arto Tunçboyacıyan (solo artist person)
* Daron Malakianv (solo artist person)
* Serj Tankian (solo artist person)
* System of a Down (band)
  * Serj Tankian
  * Daron Malakianv
* Scars on Broadway (band)
  * Daron Malakian
* Serart (project)
  * Serj Tankian
  * Arto Tunçboyacıyan


Status Quo
----------
In Tryton we have the tree view which is able to show parent-children
relationships as a graph. But this view seems to be limited to have
only one parent relation.

The general setup in Tryton 3.2 for a tree view is like this:

class Artist(ModelSQL, ModelView):
    'Artist'
    __name__ = 'artist.artist'
    name = fields.Char('Name', required=True)
    parent = fields.Many2One(
        'artist.artist', 'Parent', select=True, states=STATES,
        depends=DEPENDS)
    children = fields.One2Many(
        'artist.artist', 'parent', 'Children', states=STATES,
        depends=DEPENDS) active = fields.Boolean('Active')

XML:

        <record model="ir.ui.view" id="artist_tree_view">
            <field name="model">artist.artist</field>
            <field name="type">tree</field>
            <field name="field_childs">children</field>
            <field name="name">artist_tree</field>
        </record>
        <record model="ir.action.act_window" id="act_artist_tree">
            <field name="name">Artists</field>
            <field name="res_model">artist.artist</field>
            <field name="domain">[]</field>
            <field name="search_value">[]</field>
        </record>
        <record model="ir.action.act_window.view" id="act_artist_tree1">
            <field name="view" ref="artist_tree_view"/>
            <field name="act_window" ref="act_artist_tree"/>
        </record>
        <menuitem action="act_artist_tree" id="menu_artist_tree"
            sequence="20"/>

I feel there is a need for an Many2Many relation, but I do not get a
clue. Any Ideas are welcome.

TIA and regards
Udo Spallek

Attachment: pgpdG_J7kRYdc.pgp
Description: Digitale Signatur von OpenPGP

Reply via email to