Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
4179 Zobrazení

Hi,


I would have 2 models of the following


class Table(modes.Models):
    _name = 'mymodule.table'
    name = name = fields.Char(
        required=True,
        string='Table Name',
        help='Table Name',
    )
    table_lines = field.One2many(
        'mymodule.table.line',
        'table_id',
        string='Lines'
    )


class TableLine(models.Model):
    _name = 'mymodule.table.line'
    name = fields.Char(
        required=True,
        string='Name',
        help='Line Name',
    )
    data = fields.Char(
        required=True,
        string='Data',
        help='Data',
    )
table_id = fields.Many2one(
'mymodule.table',
ondelete='cascade',
string='Table'
)

   
How could I create a form which has a tree/list view of my TableLine items and able to set them in order?

 

Avatar
Zrušit
Autor Nejlepší odpověď

I just found out that, I need to add an attribute my TableLine model.

sequence = fields.Integer(
string="Sequence",
help='Set the order by sequence'
)

 and then in the tree view of this model


<!-- Tree view for TableLine settings -->
<record id="table_line_tree" model="ir.ui.view">
<field name="name">Table Lines</field>
<field name="model">mymodule.table.line</field>
<field name="arch" type="xml">
<tree>
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="data"/>
</tree>
</field>
</record>        


This should do the trick.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 19
5523
1
čvn 24
1529
4
dub 20
10369
1
lis 15
6562
1
říj 15
9270