-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from open2bizz/10.0
Update van eigen fork
- Loading branch information
Showing
18 changed files
with
286 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
orbeon/services/persistence_server/*.cfg | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ | |
import models | ||
import services | ||
import tests | ||
import controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# open2bizz | ||
# Copyright (C) 2016 open2bizz (open2bizz.nl). | ||
# | ||
# 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 Affero 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/>. | ||
# | ||
############################################################################## | ||
from . import orbeon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# Copyright (c) 2016 - Open2bizz | ||
# Author: Open2bizz | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU 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. | ||
# | ||
# A copy of the GNU General Public License is available at: | ||
# <http://www.gnu.org/licenses/gpl.html>. | ||
# | ||
############################################################################## | ||
import requests | ||
from urlparse import urlparse | ||
from werkzeug.wrappers import Response | ||
from odoo import http | ||
import base64 | ||
from odoo.tools import config | ||
import logging | ||
logger = logging.getLogger(__name__) | ||
|
||
class Orbeon(http.Controller): | ||
orbeon_base_route = 'orbeon' | ||
|
||
@http.route('/%s/<path:path>' % orbeon_base_route, type='http', auth="user", csrf=False) | ||
def render_orbeon_page(self, path, redirect=None, **kw): | ||
orbeon_server = http.request.env["orbeon.server"].search_read([], ['url']) | ||
if len(orbeon_server) == 0: | ||
return 'Orbeon server not found' | ||
else : | ||
orbeon_server = orbeon_server[0] | ||
o = urlparse(orbeon_server['url']) | ||
|
||
odoo_session = http.request.session | ||
|
||
orbeon_headers = ['cookie'] | ||
in_headers = { name : value for (name, value) in http.request.httprequest.headers.items() | ||
if name.lower() in orbeon_headers} | ||
|
||
in_headers.update({'Openerp-Server' : 'localhost'}) | ||
in_headers.update({'Openerp-Port' : str(config.get('xmlrpc_port'))}) | ||
in_headers.update({'Openerp-Database' : odoo_session.get('db') }) | ||
in_headers.update({'Authorization' : 'Basic %s' % base64.b64encode("%s:%s" % (odoo_session.get('login'), odoo_session.get('password')) ) } ) | ||
|
||
logger.debug('Calling Orbeon on url %s with header %s' % (o.netloc, in_headers)) | ||
curl = urlparse(http.request.httprequest.url)._replace(netloc=o.netloc) | ||
|
||
resp = requests.request( | ||
method=http.request.httprequest.method, | ||
url=curl.geturl(), | ||
headers=in_headers, | ||
data=http.request.httprequest.get_data(), | ||
#cookies=http.request.httprequest.cookies, | ||
allow_redirects=False) | ||
|
||
excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection' | ||
, 'openerp-server', 'openerp-port', 'openerp-database', 'authorization' ] | ||
headers = [(name, value) for (name, value) in resp.raw.headers.items() | ||
if name.lower() not in excluded_headers] | ||
|
||
response = Response(resp.content, resp.status_code, headers) | ||
return response | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# open2bizz | ||
# Copyright (C) 2017 open2bizz (open2bizz.nl). | ||
# | ||
# 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 Affero 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/>. | ||
# | ||
############################################################################## | ||
from odoo import fields, models, _, api, osv | ||
from openerp.exceptions import Warning | ||
|
||
|
||
import logging | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class OrbeonReportQwebChooser(models.TransientModel): | ||
_name = 'orbeon.report.qweb.chooser' | ||
_description = "Choose QWEB report" | ||
|
||
report_xml_id = fields.Many2one( | ||
'ir.actions.report.xml', | ||
string="Reports" | ||
) | ||
|
||
def run_report(self, context={}): | ||
rep = self.env['orbeon.runner'].browse(context.get('orbeon_runner_id')) | ||
return rep[0].run_qweb_report(self.report_xml_id.id) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# open2bizz | ||
# Copyright (C) 2017 open2bizz (open2bizz.nl). | ||
# | ||
# 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 Affero 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/>. | ||
# | ||
############################################################################## | ||
from odoo import fields, models, _, api, osv | ||
from openerp.exceptions import Warning | ||
|
||
|
||
import logging | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class OrbeonRunner(models.Model): | ||
_inherit = ['orbeon.runner'] | ||
|
||
builder_reports_count = fields.Integer( | ||
compute='_builder_reports_count', | ||
string='Builder reports count' | ||
) | ||
|
||
@api.one | ||
def _builder_reports_count(self): | ||
self.builder_reports_count = len(self.builder_id.report_xml_ids) | ||
|
||
def run_qweb_report(self, report_id): | ||
rep = self.env['ir.actions.report.xml'].browse(report_id) | ||
data = { | ||
'ids': [self.id], | ||
'model': 'orbeon.runner', | ||
'form': [self.id], | ||
'context':{} | ||
} | ||
return { | ||
'type' : 'ir.actions.report.xml', | ||
'report_name' : rep.report_name, | ||
'datas' : data, | ||
} | ||
|
||
|
||
|
||
@api.multi | ||
def report_button(self, context=None): | ||
if self.builder_id.report_xml_ids: | ||
if len(self.builder_id.report_xml_ids) > 1: | ||
ids = [rec.ir_actions_report_xml_id.id for rec in self.builder_id.report_xml_ids ] | ||
context.update({ 'rep_ids' : ids, 'orbeon_runner_id' : self.id }) | ||
return { | ||
'name': 'Choose report', | ||
'view_type': 'form', | ||
'view_mode': 'form', | ||
'res_model': 'orbeon.report.qweb.chooser', | ||
'type': 'ir.actions.act_window', | ||
'target': 'new', | ||
'context': context | ||
} | ||
else: | ||
return self.run_qweb_report(self.builder_id.report_xml_ids[0].ir_actions_report_xml_id.id ) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="orbeon_builder_report_xml_form" model="ir.ui.view"> | ||
<field name="name">orbeon.builder.report.xml.form</field> | ||
<field name="model">orbeon.builder.report.xml</field> | ||
<field name="type">form</field> | ||
<field name="arch" type="xml"> | ||
<form string="Report"> | ||
<group> | ||
<field name="sequence"/> | ||
<field name="ir_actions_report_xml_id"/> | ||
</group> | ||
</form> | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<data> | ||
|
||
<record id="orbeon_report_qweb_orbeon_runner_form" model="ir.ui.view"> | ||
<field name="name">orbeon.runner_form.kanban</field> | ||
<field name="model">orbeon.runner</field> | ||
<field name="priority" eval="20" /> | ||
<field name="inherit_id" ref="orbeon.orbeon_runner_form_kanban" /> | ||
<field name="arch" type="xml"> | ||
<data> | ||
<xpath expr="//div[contains(@class, 'col-xs-6 o_kanban_primary_left')]" position="after"> | ||
<field name="builder_reports_count" invisible="1"/> | ||
|
||
<a type="button"> | ||
<button class="btn btn-primary" name="report_button" type="object" attrs="{'invisible': [('builder_reports_count', '=', 0)]}">Report</button> | ||
</a> | ||
</xpath> | ||
</data> | ||
</field> | ||
</record> | ||
|
||
|
||
</data> | ||
</odoo> |
Oops, something went wrong.