[MIG] report_py3o, report_py3o_fusion_server: Migration to 12.0
parent
a131cbe6b9
commit
8fae3bc1cc
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Therp BV <http://therp.nl>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from . import models
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Therp BV <http://therp.nl>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
'name': 'Py3o Report Engine - Fusion server support',
|
||||
'summary': 'Let the fusion server handle format conversion.',
|
||||
'version': '10.0.1.0.0',
|
||||
'version': '12.0.1.0.0',
|
||||
'category': 'Reporting',
|
||||
'license': 'AGPL-3',
|
||||
'author': 'XCG Consulting,'
|
||||
|
@ -23,7 +22,7 @@
|
|||
"demo/py3o_pdf_options.xml",
|
||||
],
|
||||
'data': [
|
||||
"views/ir_report.xml",
|
||||
"views/ir_actions_report.xml",
|
||||
'security/ir.model.access.csv',
|
||||
'views/py3o_server.xml',
|
||||
'views/py3o_pdf_options.xml',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<record id="report_py3o.res_users_report_py3o" model="ir.actions.report.xml">
|
||||
<record id="report_py3o.res_users_report_py3o" model="ir.actions.report">
|
||||
<field name="py3o_is_local_fusion" eval="1"/>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Therp BV <http://therp.nl>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from . import ir_actions_report_xml
|
||||
from . import ir_actions_report
|
||||
from . import py3o_pdf_options
|
||||
from . import py3o_report
|
||||
from . import py3o_server
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# © 2013 XCG Consulting <http://odoo.consulting>
|
||||
# © 2017 Therp BV <http://therp.nl>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
@ -14,8 +13,8 @@ except ImportError:
|
|||
logger.debug('Cannot import py3o.formats')
|
||||
|
||||
|
||||
class IrActionsReportXml(models.Model):
|
||||
_inherit = 'ir.actions.report.xml'
|
||||
class IrActionsReport(models.Model):
|
||||
_inherit = 'ir.actions.report'
|
||||
|
||||
@api.multi
|
||||
@api.constrains("py3o_is_local_fusion", "py3o_server_id", "py3o_filetype")
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 Akretion (http://www.akretion.com)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# © 2013 XCG Consulting <http://odoo.consulting>
|
||||
# © 2016 ACSONE SA/NV
|
||||
# © 2017 Therp BV <http://therp.nl>
|
||||
|
@ -12,7 +11,7 @@ from datetime import datetime
|
|||
from contextlib import closing
|
||||
from openerp import _, api, models
|
||||
from openerp.exceptions import UserError
|
||||
from StringIO import StringIO
|
||||
from io import BytesIO
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -27,15 +26,15 @@ class Py3oReport(models.TransientModel):
|
|||
_inherit = 'py3o.report'
|
||||
|
||||
@api.multi
|
||||
def _create_single_report(self, model_instance, data, save_in_attachment):
|
||||
def _create_single_report(self, model_instance, data):
|
||||
""" This function to generate our py3o report
|
||||
"""
|
||||
self.ensure_one()
|
||||
report_xml = self.ir_actions_report_xml_id
|
||||
report_xml = self.ir_actions_report_id
|
||||
filetype = report_xml.py3o_filetype
|
||||
if not report_xml.py3o_server_id:
|
||||
return super(Py3oReport, self)._create_single_report(
|
||||
model_instance, data, save_in_attachment,
|
||||
model_instance, data,
|
||||
)
|
||||
elif report_xml.py3o_is_local_fusion:
|
||||
result_path = super(
|
||||
|
@ -43,9 +42,9 @@ class Py3oReport(models.TransientModel):
|
|||
report_py3o_skip_conversion=True,
|
||||
)
|
||||
)._create_single_report(
|
||||
model_instance, data, save_in_attachment,
|
||||
model_instance, data
|
||||
)
|
||||
with closing(open(result_path, 'r')) as out_stream:
|
||||
with closing(open(result_path, 'rb')) as out_stream:
|
||||
tmpl_data = out_stream.read()
|
||||
datadict = {}
|
||||
else:
|
||||
|
@ -53,8 +52,8 @@ class Py3oReport(models.TransientModel):
|
|||
suffix='.' + filetype, prefix='p3o.report.tmp.')
|
||||
tmpl_data = self.get_template(model_instance)
|
||||
|
||||
in_stream = StringIO(tmpl_data)
|
||||
with closing(os.fdopen(result_fd, 'w+')) as out_stream:
|
||||
in_stream = BytesIO(tmpl_data)
|
||||
with closing(os.fdopen(result_fd, 'wb+')) as out_stream:
|
||||
template = Template(in_stream, out_stream, escape_false=True)
|
||||
localcontext = self._get_parser_context(model_instance, data)
|
||||
expressions = template.get_all_user_python_expression()
|
||||
|
@ -107,5 +106,5 @@ class Py3oReport(models.TransientModel):
|
|||
report_xml.report_name, filetype, convert_seconds)
|
||||
if len(model_instance) == 1:
|
||||
self._postprocess_report(
|
||||
result_path, model_instance.id, save_in_attachment)
|
||||
result_path, model_instance.id)
|
||||
return result_path
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2013 XCG Consulting (http://odoo.consulting)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import fields, models
|
||||
|
@ -6,6 +5,7 @@ from odoo import fields, models
|
|||
|
||||
class Py3oServer(models.Model):
|
||||
_name = 'py3o.server'
|
||||
_description = 'Py3o server'
|
||||
_rec_name = 'url'
|
||||
|
||||
url = fields.Char(
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Therp BV <http://therp.nl>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from . import test_report_py3o_fusion_server
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Therp BV <http://therp.nl>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
import mock
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<record id="view_ir_actions_report_base" model="ir.ui.view">
|
||||
<field name="model">ir.actions.report.xml</field>
|
||||
<field name="model">ir.actions.report</field>
|
||||
<field name="inherit_id" ref="report_py3o.py3o_report_view" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="py3o_multi_in_one" position="after">
|
|
@ -27,7 +27,6 @@
|
|||
<label for="image_jpeg_quality" attrs="{'invisible': [('image_compression', '!=', 'jpeg')]}"/>
|
||||
<div name="image_jpeg_quality" attrs="{'invisible': [('image_compression', '!=', 'jpeg')]}">
|
||||
<field name="image_jpeg_quality" class="oe_inline"/>
|
||||
<label string=" %"/>
|
||||
</div>
|
||||
<field name="image_reduce_resolution"/>
|
||||
</group>
|
||||
|
|
Loading…
Reference in New Issue