Browse Source

[MOD] Module renamed to <base_report_auto_create_qweb>

Added Known Issues to Readme file
pull/195/head
oihane 10 years ago
committed by Alex Comba
parent
commit
dd5e769e89
  1. 20
      base_report_auto_create_qweb/README.rst
  2. 6
      base_report_auto_create_qweb/__init__.py
  3. 39
      base_report_auto_create_qweb/__openerp__.py
  4. 6
      base_report_auto_create_qweb/models/__init__.py
  5. 43
      base_report_auto_create_qweb/models/report_xml.py

20
base_report_auto_create_qweb/README.rst

@ -0,0 +1,20 @@
Report Management
=================
When creating a report in Settings > Technical > Actions > Reports or
Settings > Technical > Reports > Reports it will create an empty Qweb template
and the required linking info so that the user does not need to know how to do
all the links.
Known issues / Roadmap
======================
* When copying, duplicate all the required objects
Credits
=======
Contributors
------------
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Ana Juaristi <anajuaristi@avanzosc.es>

6
base_report_auto_create_qweb/__init__.py

@ -0,0 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from . import models

39
base_report_auto_create_qweb/__openerp__.py

@ -0,0 +1,39 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
##############################################################################
{
"name": "Report Management",
"version": "1.0",
"depends": [
"base",
"report",
],
"author": "OdooMRP team, "
"AvanzOSC, "
"Serv. Tecnol. Avanzados - Pedro M. Baeza",
"website": "http://www.odoomrp.com",
"contributors": [
"Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>",
"Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>",
"Ana Juaristi <anajuaristi@avanzosc.es>",
],
"category": "Tools",
"summary": "",
"data": [],
"installable": True,
}

6
base_report_auto_create_qweb/models/__init__.py

@ -0,0 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from . import report_xml

43
base_report_auto_create_qweb/models/report_xml.py

@ -0,0 +1,43 @@
# -*- encoding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, api, exceptions, _
class IrActionsReport(models.Model):
_inherit = 'ir.actions.report.xml'
@api.model
def create(self, values):
if (values.get('report_type') in ['qweb-pdf', 'qweb-html'] and
values.get('report_name') and
values['report_name'].find('.') == -1):
raise exceptions.Warning(
_("Template Name must contain at least a dot in it's name"))
report_xml = super(IrActionsReport, self).create(values)
if values.get('report_type') in ['qweb-pdf', 'qweb-html']:
qweb_view_data = {
'name': values['report_name'].split('.')[1],
'mode': 'primary',
'type': 'qweb',
'arch': '<?xml version="1.0"?>\n'
'<t t-name="%s">\n</t>' % values['report_name'],
}
qweb_view = self.env['ir.ui.view'].create(qweb_view_data)
model_data_data = {
'module': values['report_name'].split('.')[0],
'name': values['report_name'].split('.')[1],
'res_id': qweb_view.id,
'model': 'ir.ui.view',
}
self.env['ir.model.data'].create(model_data_data)
value_view_data = {
'name': values['name'],
'model': values['model'],
'key2': 'client_print_multi',
'value_unpickle': 'ir.actions.report.xml,%s' % report_xml.id,
}
self.env['ir.values'].create(value_view_data)
return report_xml
Loading…
Cancel
Save