Enric Tobella
7 years ago
committed by
etobella
No known key found for this signature in database
GPG Key ID: 1A2546A1B7BA2451
14 changed files with 101 additions and 95 deletions
-
11report_xml/README.rst
-
2report_xml/__init__.py
-
7report_xml/__manifest__.py
-
2report_xml/controllers/__init__.py
-
11report_xml/controllers/main.py
-
3report_xml/demo/report.xml
-
3report_xml/models/__init__.py
-
55report_xml/models/report_action.py
-
25report_xml/models/report_generator.py
-
41report_xml/static/src/js/report/qwebactionmanager.js
-
2report_xml/tests/__init__.py
-
17report_xml/tests/test_report_xml.py
-
8report_xml/views/report_xml_templates.xml
-
9report_xml/views/webclient_templates.xml
@ -1,5 +1,5 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
|
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html). |
||||
|
|
||||
from . import controllers |
from . import controllers |
||||
from . import models |
from . import models |
@ -1,4 +1,4 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
|
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html). |
||||
|
|
||||
from . import main |
from . import main |
@ -1,5 +1,4 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
|
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html). |
||||
|
|
||||
from . import report_action |
from . import report_action |
||||
from . import report_generator |
|
@ -1,25 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es> |
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
|
|
||||
import logging |
|
||||
|
|
||||
from odoo import api, models |
|
||||
|
|
||||
_logger = logging.getLogger(__name__) |
|
||||
|
|
||||
|
|
||||
class ReportGenerator(models.Model): |
|
||||
_inherit = "report" |
|
||||
|
|
||||
@api.model |
|
||||
def _get_report_from_name(self, report_name): |
|
||||
res = super(ReportGenerator, self)._get_report_from_name(report_name) |
|
||||
if res: |
|
||||
return res |
|
||||
report_obj = self.env['ir.actions.report.xml'] |
|
||||
qwebtypes = ['qweb-xml'] |
|
||||
conditions = [('report_type', 'in', qwebtypes), |
|
||||
('report_name', '=', report_name)] |
|
||||
context = self.env['res.users'].context_get() |
|
||||
return report_obj.with_context(context).search(conditions, limit=1) |
|
@ -0,0 +1,41 @@ |
|||||
|
odoo.define('report_xml.report', function(require){ |
||||
|
'use strict'; |
||||
|
|
||||
|
var ActionManager= require('web.ActionManager'); |
||||
|
var crash_manager = require('web.crash_manager'); |
||||
|
var framework = require('web.framework'); |
||||
|
|
||||
|
ActionManager.include({ |
||||
|
ir_actions_report: function (action, options){ |
||||
|
var self = this; |
||||
|
action = _.clone(action); |
||||
|
if (action.report_type === 'qweb-xml') { |
||||
|
framework.blockUI() |
||||
|
var report_xml_url = 'report/xml/' + action.report_name; |
||||
|
if(action.context.active_ids){ |
||||
|
report_xml_url += '/' + action.context.active_ids.join(','); |
||||
|
} |
||||
|
else{ |
||||
|
report_xml_url += '?options=' + encodeURIComponent(JSON.stringify(action.data)); |
||||
|
report_xml_url += '&context=' + encodeURIComponent(JSON.stringify(action.context)); |
||||
|
} |
||||
|
self.getSession().get_file({ |
||||
|
url: report_xml_url, |
||||
|
data: {data: JSON.stringify([ |
||||
|
report_xml_url, |
||||
|
action.report_type, |
||||
|
])}, |
||||
|
error: crash_manager.rpc_error.bind(crash_manager), |
||||
|
success: function (){ |
||||
|
if(action && options && !action.dialog){ |
||||
|
options.on_close(); |
||||
|
} |
||||
|
}, |
||||
|
}); |
||||
|
framework.unblockUI(); |
||||
|
return |
||||
|
} |
||||
|
return self._super(action, options); |
||||
|
} |
||||
|
}); |
||||
|
}); |
@ -1,4 +1,4 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
||||
|
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html). |
||||
|
|
||||
from . import test_report_xml |
from . import test_report_xml |
@ -1,9 +1,9 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<odoo> |
<odoo> |
||||
|
|
||||
<template id="utf8_header"> |
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<t t-raw="0"/> |
|
||||
</template> |
|
||||
|
<template id="utf8_header"> |
||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<t t-raw="0"/> |
||||
|
</template> |
||||
|
|
||||
</odoo> |
</odoo> |
@ -0,0 +1,9 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<template id="report_xml.assets_backend" inherit_id="web.assets_backend"> |
||||
|
<xpath expr="." position="inside"> |
||||
|
<script type="text/javascript" src="/report_xml/static/src/js/report/qwebactionmanager.js"/> |
||||
|
</xpath> |
||||
|
|
||||
|
</template> |
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue