Stéphane Bidoul
10 years ago
6 changed files with 121 additions and 1 deletions
-
1mis_builder/__openerp__.py
-
2mis_builder/models/mis_builder.py
-
1mis_builder/report/__init__.py
-
50mis_builder/report/report_mis_report_instance.py
-
55mis_builder/report/report_mis_report_instance.xml
-
13mis_builder/views/mis_builder.xml
@ -0,0 +1,50 @@ |
|||||
|
# -*- encoding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# mis_builder module for Odoo, Management Information System Builder |
||||
|
# Copyright (C) 2014-2015 ACSONE SA/NV (<http://acsone.eu>) |
||||
|
# |
||||
|
# This file is a part of mis_builder |
||||
|
# |
||||
|
# mis_builder is free software: you can redistribute it and/or modify |
||||
|
# it under the terms of the GNU Affero General Public License v3 or later |
||||
|
# as published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# mis_builder is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU Affero General Public License v3 or later for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU Affero General Public License |
||||
|
# v3 or later along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
import logging |
||||
|
|
||||
|
from openerp import api, models |
||||
|
|
||||
|
_logger = logging.getLogger(__name__) |
||||
|
|
||||
|
|
||||
|
class ReportMisReportInstance(models.AbstractModel): |
||||
|
|
||||
|
_name = 'report.mis_builder.report_mis_report_instance' |
||||
|
|
||||
|
@api.multi |
||||
|
def render_html(self, data=None): |
||||
|
docs = self.env['mis.report.instance'].browse(self._ids) |
||||
|
docs_computed = {} |
||||
|
for doc in docs: |
||||
|
docs_computed[doc.id] = doc.compute()[0] |
||||
|
_logger.info("%s", docs_computed) |
||||
|
docargs = { |
||||
|
'doc_ids': self._ids, |
||||
|
'doc_model': 'mis.report.instance', |
||||
|
'docs': docs, |
||||
|
'docs_computed': docs_computed, |
||||
|
} |
||||
|
return self.env['report'].\ |
||||
|
render('mis_builder.report_mis_report_instance', docargs) |
@ -0,0 +1,55 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<openerp> |
||||
|
<data> |
||||
|
|
||||
|
<template id="report_mis_report_instance"> |
||||
|
<t t-call="report.html_container"> |
||||
|
<t t-foreach="docs" t-as="o"> |
||||
|
<t t-call="report.external_layout"> |
||||
|
<div class="page"> |
||||
|
<h2 t-field="o.name"></h2> |
||||
|
<table> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<t t-foreach="docs_computed[o.id]['header']" t-as="h"> |
||||
|
<th> |
||||
|
<div> |
||||
|
<t t-esc="h_value['kpi_name']"/> |
||||
|
</div> |
||||
|
</th> |
||||
|
<th t-foreach="h_value['cols']" t-as="col"> |
||||
|
<div> |
||||
|
<t t-esc="col['name']"/> |
||||
|
</div> |
||||
|
<div> |
||||
|
<t t-esc="col['date']"/> |
||||
|
</div> |
||||
|
</th> |
||||
|
</t> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr t-foreach="docs_computed[o.id]['content']" t-as="c"> |
||||
|
<td t-att-style="c_value['default_style']"> |
||||
|
<div> |
||||
|
<t t-esc="c_value['kpi_name']"/> |
||||
|
</div> |
||||
|
</td> |
||||
|
<t t-foreach="c_value['cols']" t-as="value"> |
||||
|
<td t-att-style="c_value['default_style']"> |
||||
|
<div t-att-style="value_value.get('style')"> |
||||
|
<t t-esc="value_value['val_r']"/> |
||||
|
</div> |
||||
|
</td> |
||||
|
</t> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
|
||||
|
</data> |
||||
|
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue