Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
1589 Представления

I want to select a few records in a tree view, then click a button


The click on the button should open a wizard and the selected records should be available into the wizard for a bit of editing

How can I acheve that ?

Аватар
Отменить
Лучший ответ

Hi,

To get selected records in the button function, we can define the tree view as follows,


    <record id="student_student_view_tree" model="ir.ui.view">
<field name="name">student.student.view.tree</field>
<field name="model">student.student</field>
        <field name="arch" type="xml">
            <tree string="Student" edit="1">
                <header>
                    <button type="object" string="Click me"
                            name="action_click_me"/>
                </header>
                <field name='roll_number'/>
                <field name='number'/>
                <field name="name" decoration-bf="1"/>
                <field name="age"/>
                <field name="email"/>
                <field name='teacher'/>
                <field name="grade"/>
                <field name='state'/>
            </tree>
        </field>
    </record>


Or we can inherit any treeview of the model and add the button in the header.

Here the button function action_click_me, we get the selected records in self.


We can get the selected records in tree view in (self._context.get('active_ids', []))


Hope it helps,

   

       

           


       

   


Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
авг. 22
2286
2
июл. 25
25873
4
дек. 23
22272
5
июл. 24
15632
1
дек. 22
3270