Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
3940 Vizualizări

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 !
Imagine profil
Abandonează
Autor Cel mai bun răspuns

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...

Imagine profil
Abandonează
Cel mai bun răspuns

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>

 

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
dec. 21
5405
2
oct. 20
4125
0
aug. 19
4121
1
aug. 19
10438
2
iul. 23
784