Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

qweb report for project list

By
shaneebkhan
on 11/19/15, 12:22 AM 786 views

hai,

     i created a report for listing all projects (like tree view )

but it shows the error when i try to print task details as sub report 

file 

<?xml version="1.0" encoding="utf-8"?>

<!--Custom report. -->

<openerp>

<data>

<template id="project_rpt_document">

<t t-call="report.external_layout">

<div class="page">

<div class="row">

<table class="table table-condensed" style="border: 1px solid #9999">

<tbody>

<tr class="border-black">

<td><strong>Project Name</strong></td>

<td><strong>Customer</strong></td>

<td><strong>Project Manager</strong></td>

<td><strong>Start Date</strong></td>

<td><strong>End Date</strong></td>

</tr>

<tr t-foreach="o.parent_id.child_ids" t-as="child">

<td><span t-field="child.name"/></td>

<td><span t-field="child.partner_id"/></td>

<tr t-foreach="child.task_ids" t-as="line">

<td><span t-field="line.name"/></td>

<td><span t-field="line.date_start"/></td>

<td><span t-field="line.date_end"/></td>

</tr>

</tr>

</tbody>

</table>

</div>

</div>

</t>

</template>

<template id="project_rpt">

<t t-call="report.html_container">

<t t-foreach="doc_ids" t-as="doc_id">

<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'project.project_rpt_document')" />

</t>

</t>

</template>

<report id="custom_project_rpt" model="project.project"

string="Total Projects" report_type="qweb-pdf"

name="project.project_rpt" attachment_use="False"

file="project.project_rpt" />

</data>

</openerp>

it shows erorr

QWebException: ""'account.analytic.account' object has no attribute 'task_ids'" while evaluating

'child.task_ids'" while evaluating

"translate_doc(doc_id, doc_model, 'partner_id.lang', 'project.project_rpt_document')"

is there any way to changes object 'account.analytic.account' to project .project ?

other wise how to generate sub report ?

1
HTCorps
On 11/23/15, 6:09 AM

Try adding 'project_ids' and 'task_ids' fields to project.task

Eg:

class task(osv.osv):

_name = "project.task"

_description = "Task"

_columns = {

'project_ids': fields.many2many('project.project', 'project_task_type_rel', 'type_id', 'project_id', 'Projects'),

'task_ids': fields.one2many('project.task', 'project_id',

domain=[('stage_id.fold', '=', False)]),

}

Now write the xml code like this

<?xml version="1.0" encoding="utf-8"?>

<!--Custom report.-->

<openerp>

<data>

<template id="project_rpt_document">

<t t-call="report.external_layout">

<div class="page">

<div class="row">

<table class="table table-condensed" style="border: 1px solid #9999">

<tbody>

<tr>

<td><font color="blue">Project no</font></td>

<td><font color="blue">Project Name</font></td>

<td><font color="blue">Project Manager</font></td>

<td><font color="blue">Customer</font></td>

<td><font color="blue">Progres</font></td>

<td><font color="blue">Status</font></td>

</tr>

<tr t-foreach="o.project_ids" t-as="line">

<td><span t-field="line.id"/></td>

<td><span t-field="line.name"/></td>

<td><span t-field="line.user_id"/></td>

<td><span t-field="line.partner_id"/></td>

<td><span t-field="line.progress_rate"/></td>

<td><span t-field="line.state"/></td>

<tr>

<td colspan="1">

<td><font color="blue">Task Name</font></td></td>

<td><font color="blue">Stage</font></td>

<td><font color="blue">Starting Date</font></td>

<td><font color="blue">Ending Date</font></td>

<td><font color="blue">Work Progress</font></td>

</tr>

<tr t-foreach="line.task_ids" t-as="task">

<td colspan="1">

<td><span t-field="task.name"/></td>

<td><span t-field="o.stage_id"/></td>

<td><span t-field="o.date_start"/></td>

<td><span t-field="o.date_end"/></td>

<td><span t-field="o.progress"/></td>

</td></tr>

</tr>

</tbody>

</table>

</div>

</div>

</t>

</template>

<template id="project_rpt">

<t t-call="report.html_container">

<t t-foreach="doc_ids" t-as="doc_id">

<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'project.project_rpt_document')"/>

</t>

</t>

</template>

<report

id="custom_project_rpt"

model="project.task"

string="Time Tracking"

report_type="qweb-pdf"

name="project.project_rpt"

attachment_use="False"

file="project.project_rpt"

/>

</data>

</openerp>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/19/15, 12:22 AM
Seen: 786 times
Last updated: 11/27/15, 1:49 AM