I build a model from scratch and I need to build a report for only some fields.
The problem is that each job(field i called it : name) from my model has many debits in the 'account.move.line' model, however it is not a (many2one or one2many relation), I have checked that a list resulted from a method in my model is having what I am looking for, however I have a problem in displaying it in the qweb fromat, so I decided to insert this list in a new field in my model called debitx, but nothing change.
here is my method code:
@api.multi def _get_debit(self): total_len = self.env['account.move.line'].search([('analytic_account_id', '=', self.name)]) l = [] for item in total_len: item=item['debit'] l.append(item) records = self.env['transfer.jobs'] for i in l: records.write({'debitx':i})
the _get_debit method is inside my new (compute) field called debitx, this method is a member of my manage.job model.
and her is my report :
<?xml version="1.0"?>
<odoo> <report id="action_library_book_report"
string="JOBS REPORT"
model="transfer.jobs" report_type="qweb-pdf"
name="job_management.report_library_book_template" />
<template id="report_library_book_template">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<!-- Report header content -->
<div class="container">
<div class="row bg-primary">
<div class="col-3">JOB NO.</div>
<div class="col-2">Customer</div>
<div class="col-2">Debit</div>
<div class="col-2">Credit</div>
<div class="col-2">Balance</div>
</div>
<t t-foreach="docs" t-as="line">
<div class="row">
<!-- Report Row Content -->
<div class="col-3">
<h4><span t-field="line.name" /></h4>
</div>
<div class="col-2">
<span t-field="line.customer" />
</div>
<div class="col-2">
<span t-field="line.debitx"/>
</div>
<div class="col-2">
<!-- Render Authors -->
</div>
</div>
</t>
<!-- Report footer content ...-->
</div>
<t t-foreach="docs" t-as="o">
<!-- Report row content -->
</t>
<!-- Report footer content -->
</div>
</t>
</t>
</template>
</odoo>
Any suggestions, or how to create a qweb report from only lists returned by methods.