İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
3916 Görünümler

Hello,

I have created a QWeb report on the tasks, that I can launch from the list view of tasks (menu print after selecting e few tasks).
I also managed to launch it from the task form view in a button:

    <button class="oe_stat_button" type="action" name="600" icon="fa-file-o" string="My Report" />

Now, I would like to be able to launch it from a project form view, like if I had selected all its tasks in the task list view : what should I add in the button code so that it passes the tasks to the report ?
I tried to add "args" or "context", but it doesn't work (or I don't know the right syntax).

(I'm using Odoo 12 for now)

Thanks for your help !
Avatar
Vazgeç
Üretici En İyi Yanıt

Thank you Eduardo for your answer.
But I'm not sure to understand what to do with that...
Where should I put this xml code ? Directly In the form view ?
And how do I call it then ?


I tried to modify the button code in the project form. adding the context, but it doesn't work better.

    <button class="oe_stat_button" type="action" name="600" icon="fa-file-o" string="My Report" context="{'active_ids': task_ids}" />

When clicking, I get the report generated on the first task of the first of all my projects...

Avatar
Vazgeç
En İyi Yanıt

Maybe you could call an ir.actions.server and return the print report action with other active ids.

<record id="project_redirect_report_with_all_tasks" model="ir.actions.server">
    <field name="name">Redirect to task reports with all project tasks</field>
    <field name="model_id" ref="project.model_project_task"/>
    <field name="binding_model_id" ref="project.model_project_project"/>
    <field name="binding_type">action</field>
    <field name="state">code</field>
    <field name="code">[action] = env.ref('my_other_print_action_report').read()
action['context'].update({'active_ids': records.mapped('task_ids').ids})
    </field>

 

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Ara 21
5379
2
Eki 20
4119
0
Ağu 19
4114
1
Ağu 19
10433
2
Tem 23
784