Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
3923 Visualizzazioni

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
Abbandona
Autore Risposta migliore

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
dic 21
5391
2
ott 20
4122
0
ago 19
4115
1
ago 19
10434
2
lug 23
784