diff --git a/mis_builder/__openerp__.py b/mis_builder/__openerp__.py index 92ca85c6..42119387 100644 --- a/mis_builder/__openerp__.py +++ b/mis_builder/__openerp__.py @@ -39,6 +39,7 @@ 'views/mis_builder.xml', 'security/ir.model.access.csv', 'security/mis_builder_security.xml', + 'report/report_mis_report_instance.xml', ], 'test': [ ], diff --git a/mis_builder/models/mis_builder.py b/mis_builder/models/mis_builder.py index 194ab7ee..33e59911 100644 --- a/mis_builder/models/mis_builder.py +++ b/mis_builder/models/mis_builder.py @@ -28,6 +28,7 @@ import re import traceback import pytz +from openerp import api from openerp.api import Environment from openerp.osv import orm, fields from openerp import tools @@ -711,6 +712,7 @@ class mis_report_instance(orm.Model): 'target': 'new', } + @api.cr_uid_id_context def compute(self, cr, uid, _id, context=None): assert isinstance(_id, (int, long)) if context is None: diff --git a/mis_builder/report/__init__.py b/mis_builder/report/__init__.py index 4a6549d5..c5280449 100644 --- a/mis_builder/report/__init__.py +++ b/mis_builder/report/__init__.py @@ -23,3 +23,4 @@ ############################################################################## from . import mis_builder_xls +from . import report_mis_report_instance diff --git a/mis_builder/report/report_mis_report_instance.py b/mis_builder/report/report_mis_report_instance.py new file mode 100644 index 00000000..e57af779 --- /dev/null +++ b/mis_builder/report/report_mis_report_instance.py @@ -0,0 +1,50 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# mis_builder module for Odoo, Management Information System Builder +# Copyright (C) 2014-2015 ACSONE SA/NV () +# +# 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 . +# +############################################################################## + +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) diff --git a/mis_builder/report/report_mis_report_instance.xml b/mis_builder/report/report_mis_report_instance.xml new file mode 100644 index 00000000..7a331d95 --- /dev/null +++ b/mis_builder/report/report_mis_report_instance.xml @@ -0,0 +1,55 @@ + + + + + + + + diff --git a/mis_builder/views/mis_builder.xml b/mis_builder/views/mis_builder.xml index 20f198be..eee43a1e 100644 --- a/mis_builder/views/mis_builder.xml +++ b/mis_builder/views/mis_builder.xml @@ -100,7 +100,7 @@ - Export report instance result + MIS report instance XLS report mis.report.instance ir.actions.report.xml mis.report.instance.xls @@ -108,6 +108,15 @@ + + MIS report instance QWEB PDF report + mis.report.instance + ir.actions.report.xml + mis_builder.report_mis_report_instance + qweb-pdf + + + mis.report.instance.result.view.form mis.report.instance @@ -115,6 +124,7 @@
+