跳至內容
選單
此問題已被標幟
2 回覆
3924 瀏覽次數

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 !
頭像
捨棄
作者 最佳答案

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

頭像
捨棄
最佳答案

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>

 

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
12月 21
5392
2
10月 20
4122
0
8月 19
4115
1
8月 19
10434
2
7月 23
784