Take into accounts most remarks of @lasley
Remove <data> in views Protect import of py3o libs Remove dep on base module Other small changespull/695/head
parent
38fd4cdae8
commit
6ee47a5392
|
@ -1,4 +0,0 @@
|
||||||
report_py3o 1.3
|
|
||||||
|
|
||||||
Production release
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Copyright 2013 XCG Consulting (http://odoo.consulting)
|
# Copyright 2013 XCG Consulting (http://odoo.consulting)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
{
|
{
|
||||||
'name': 'LibreOffice Report Engine',
|
'name': 'Py3o Report Engine',
|
||||||
'summary': 'Reporting engine based on Libreoffice (ODT -> ODT, '
|
'summary': 'Reporting engine based on Libreoffice (ODT -> ODT, '
|
||||||
'ODT -> PDF, ODT -> DOC, ODT -> DOCX, ODS -> ODS, etc.)',
|
'ODT -> PDF, ODT -> DOC, ODT -> DOCX, ODS -> ODS, etc.)',
|
||||||
'version': '9.0.1.0.0',
|
'version': '9.0.1.0.0',
|
||||||
|
@ -10,10 +10,7 @@
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'author': 'XCG Consulting,Odoo Community Association (OCA)',
|
'author': 'XCG Consulting,Odoo Community Association (OCA)',
|
||||||
'website': 'http://odoo.consulting/',
|
'website': 'http://odoo.consulting/',
|
||||||
'depends': [
|
'depends': ['report'],
|
||||||
'base',
|
|
||||||
'report',
|
|
||||||
],
|
|
||||||
'external_dependencies': {
|
'external_dependencies': {
|
||||||
'python': ['py3o.template',
|
'python': ['py3o.template',
|
||||||
'py3o.formats']
|
'py3o.formats']
|
||||||
|
|
|
@ -2,15 +2,22 @@
|
||||||
# Copyright 2013 XCG Consulting (http://odoo.consulting)
|
# Copyright 2013 XCG Consulting (http://odoo.consulting)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
import os
|
import os
|
||||||
from py3o.formats import Formats
|
|
||||||
from openerp import api, fields, models, _
|
from openerp import api, fields, models, _
|
||||||
from openerp.report.interface import report_int
|
from openerp.report.interface import report_int
|
||||||
from openerp.exceptions import ValidationError
|
from openerp.exceptions import ValidationError
|
||||||
from openerp import addons
|
from openerp import addons
|
||||||
from ..py3o_parser import Py3oParser
|
from ..py3o_parser import Py3oParser
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from py3o.formats import Formats
|
||||||
|
except ImportError:
|
||||||
|
logger.debug('Cannot import py3o.formats')
|
||||||
|
|
||||||
|
|
||||||
class ReportXml(models.Model):
|
class IrActionsReportXml(models.Model):
|
||||||
""" Inherit from ir.actions.report.xml to allow customizing the template
|
""" Inherit from ir.actions.report.xml to allow customizing the template
|
||||||
file. The user cam chose a template from a list.
|
file. The user cam chose a template from a list.
|
||||||
The list is configurable in the configuration tab, see py3o_template.py
|
The list is configurable in the configuration tab, see py3o_template.py
|
||||||
|
@ -22,8 +29,8 @@ class ReportXml(models.Model):
|
||||||
@api.constrains("py3o_filetype", "report_type")
|
@api.constrains("py3o_filetype", "report_type")
|
||||||
def _check_py3o_filetype(self):
|
def _check_py3o_filetype(self):
|
||||||
if self.report_type == "py3o" and not self.py3o_filetype:
|
if self.report_type == "py3o" and not self.py3o_filetype:
|
||||||
raise ValidationError(
|
raise ValidationError(_(
|
||||||
"Field 'Output Format' is required for Py3O report")
|
"Field 'Output Format' is required for Py3O report"))
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
@api.constrains("py3o_is_local_fusion", "py3o_server_id",
|
@api.constrains("py3o_is_local_fusion", "py3o_server_id",
|
||||||
|
@ -32,9 +39,9 @@ class ReportXml(models.Model):
|
||||||
is_native = Formats().get_format(self.py3o_filetype)
|
is_native = Formats().get_format(self.py3o_filetype)
|
||||||
if ((not is_native or not self.py3o_is_local_fusion) and
|
if ((not is_native or not self.py3o_is_local_fusion) and
|
||||||
not self.py3o_server_id):
|
not self.py3o_server_id):
|
||||||
raise ValidationError(
|
raise ValidationError(_(
|
||||||
"Can not use not native format in local fusion. "
|
"Can not use not native format in local fusion. "
|
||||||
"Please specify a Fusion Server")
|
"Please specify a Fusion Server"))
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_py3o_filetypes(self):
|
def _get_py3o_filetypes(self):
|
||||||
|
@ -116,4 +123,4 @@ class ReportXml(models.Model):
|
||||||
if new_report:
|
if new_report:
|
||||||
return new_report
|
return new_report
|
||||||
else:
|
else:
|
||||||
return super(ReportXml, self)._lookup_report(cr, name)
|
return super(IrActionsReportXml, self)._lookup_report(cr, name)
|
||||||
|
|
|
@ -9,14 +9,23 @@ import sys
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
import requests
|
import requests
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
from py3o.template.helpers import Py3oConvertor
|
|
||||||
from py3o.template import Template
|
|
||||||
from py3o.formats import Formats
|
|
||||||
|
|
||||||
from openerp import _
|
from openerp import _
|
||||||
from openerp import exceptions
|
from openerp import exceptions
|
||||||
from openerp.report.report_sxw import report_sxw
|
from openerp.report.report_sxw import report_sxw
|
||||||
from openerp import registry
|
from openerp import registry
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from py3o.template.helpers import Py3oConvertor
|
||||||
|
from py3o.template import Template
|
||||||
|
except ImportError:
|
||||||
|
logger.debug('Cannot import py3o.template')
|
||||||
|
try:
|
||||||
|
from py3o.formats import Formats
|
||||||
|
except ImportError:
|
||||||
|
logger.debug('Cannot import py3o.formats')
|
||||||
|
|
||||||
|
|
||||||
_extender_functions = {}
|
_extender_functions = {}
|
||||||
|
|
|
@ -1,32 +1,31 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
<!-- Inherit from base.act_report_xml_view to add py3o-related settings. -->
|
<!-- Inherit from base.act_report_xml_view to add py3o-related settings. -->
|
||||||
|
|
||||||
<record id="py3o_report_view" model="ir.ui.view">
|
<record id="py3o_report_view" model="ir.ui.view">
|
||||||
<field name="name">py3o_report_view</field>
|
<field name="name">py3o_report_view</field>
|
||||||
<field name="model">ir.actions.report.xml</field>
|
<field name="model">ir.actions.report.xml</field>
|
||||||
<field name="inherit_id" ref="base.act_report_xml_view" />
|
<field name="inherit_id" ref="base.act_report_xml_view" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
|
||||||
<xpath expr="//page[@name='security']" position="before">
|
<xpath expr="//page[@name='security']" position="before">
|
||||||
<page string="LibreOffice Template"
|
<page string="LibreOffice Template" name="py3o_tab"
|
||||||
attrs="{'invisible': [('report_type', '!=', 'py3o')]}">
|
attrs="{'invisible': [('report_type', '!=', 'py3o')]}">
|
||||||
|
|
||||||
<group>
|
<group name="py3o_params">
|
||||||
<field name="py3o_filetype" />
|
<field name="py3o_filetype" />
|
||||||
<field name="py3o_is_local_fusion"/>
|
<field name="py3o_is_local_fusion"/>
|
||||||
<field name="py3o_server_id" />
|
<field name="py3o_server_id" />
|
||||||
<field name="py3o_template_id" />
|
<field name="py3o_template_id" />
|
||||||
<field name="module" />
|
<field name="module" />
|
||||||
<field name="py3o_template_fallback" />
|
<field name="py3o_template_fallback" />
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
<menuitem id="py3o_config_menu"
|
<menuitem id="py3o_config_menu"
|
||||||
name="Py3o"
|
name="Py3o"
|
||||||
parent="report.reporting_menuitem" />
|
parent="report.reporting_menuitem" />
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
<record id="py3o_server_configuration_form_view" model="ir.ui.view">
|
|
||||||
<field name="name">py3o.server.configuration.form.view</field>
|
|
||||||
<field name="model">py3o.server</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<form string="Py3o Server Configuration">
|
|
||||||
<group>
|
|
||||||
<field name="url" widget="url"/>
|
|
||||||
<field name="is_active" />
|
|
||||||
</group>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="py3o_server_configuration_tree_view" model="ir.ui.view">
|
<record id="py3o_server_configuration_form_view" model="ir.ui.view">
|
||||||
<field name="name">py3o.server.configuration.tree.view</field>
|
<field name="name">py3o.server.configuration.form.view</field>
|
||||||
<field name="model">py3o.server</field>
|
<field name="model">py3o.server</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Py3o Servers Configuration">
|
<form string="Py3o Server Configuration">
|
||||||
<field name="url" />
|
<group name="main">
|
||||||
|
<field name="url" widget="url"/>
|
||||||
<field name="is_active" />
|
<field name="is_active" />
|
||||||
</tree>
|
</group>
|
||||||
</field>
|
</form>
|
||||||
</record>
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="py3o_server_configuration_action" model="ir.actions.act_window">
|
<record id="py3o_server_configuration_tree_view" model="ir.ui.view">
|
||||||
<field name="name">Py3o Servers</field>
|
<field name="name">py3o.server.configuration.tree.view</field>
|
||||||
<field name="res_model">py3o.server</field>
|
<field name="model">py3o.server</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="arch" type="xml">
|
||||||
</record>
|
<tree string="Py3o Servers Configuration">
|
||||||
|
<field name="url" />
|
||||||
|
<field name="is_active" />
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="py3o_server_configuration_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Py3o Servers</field>
|
||||||
|
<field name="res_model">py3o.server</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem id="py3o_server_configuration_menu"
|
||||||
|
parent="py3o_config_menu"
|
||||||
|
action="py3o_server_configuration_action" />
|
||||||
|
|
||||||
<menuitem id="py3o_server_configuration_menu"
|
|
||||||
parent="py3o_config_menu"
|
|
||||||
action="py3o_server_configuration_action" />
|
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
<record id="py3o_template_configuration_search_view" model="ir.ui.view">
|
<record id="py3o_template_configuration_search_view" model="ir.ui.view">
|
||||||
<field name="name">py3o.template.configuration.search.view</field>
|
<field name="name">py3o.template.configuration.search.view</field>
|
||||||
<field name="model">py3o.template</field>
|
<field name="model">py3o.template</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search string="Py3o Templates Configuration">
|
<search string="Py3o Templates">
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="filetype" />
|
<field name="filetype" />
|
||||||
<group string="Group By" name="groupby">
|
<group string="Group By" name="groupby">
|
||||||
<filter name="filetype_groupby" string="File Type"
|
<filter name="filetype_groupby" string="File Type"
|
||||||
context="{'group_by': 'filetype'}"/>
|
context="{'group_by': 'filetype'}"/>
|
||||||
</group>
|
</group>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="py3o_template_configuration_form_view" model="ir.ui.view">
|
<record id="py3o_template_configuration_form_view" model="ir.ui.view">
|
||||||
<field name="name">py3o.template.configuration.form.view</field>
|
<field name="name">py3o.template.configuration.form.view</field>
|
||||||
<field name="model">py3o.template</field>
|
<field name="model">py3o.template</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Py3o Templates Configuration">
|
<form string="Py3o Templates">
|
||||||
<group>
|
<group name="main">
|
||||||
<field name="name" />
|
|
||||||
<field name="filetype" />
|
|
||||||
<field name="py3o_template_data" />
|
|
||||||
</group>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="py3o_template_configuration_tree_view" model="ir.ui.view">
|
|
||||||
<field name="name">py3o.template.configuration.tree.view</field>
|
|
||||||
<field name="model">py3o.template</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<tree string="Py3o Templates Configuration">
|
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="filetype" />
|
<field name="filetype" />
|
||||||
</tree>
|
<field name="py3o_template_data" />
|
||||||
</field>
|
</group>
|
||||||
</record>
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="py3o_template_configuration_action" model="ir.actions.act_window">
|
<record id="py3o_template_configuration_tree_view" model="ir.ui.view">
|
||||||
<field name="name">Py3o Templates</field>
|
<field name="name">py3o.template.configuration.tree.view</field>
|
||||||
<field name="res_model">py3o.template</field>
|
<field name="model">py3o.template</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="arch" type="xml">
|
||||||
</record>
|
<tree string="Py3o Templates">
|
||||||
|
<field name="name" />
|
||||||
|
<field name="filetype" />
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="py3o_template_configuration_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Py3o Templates</field>
|
||||||
|
<field name="res_model">py3o.template</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem id="py3o_template_configuration_menu"
|
||||||
|
parent="py3o_config_menu"
|
||||||
|
action="py3o_template_configuration_action" />
|
||||||
|
|
||||||
<menuitem id="py3o_template_configuration_menu"
|
|
||||||
parent="py3o_config_menu"
|
|
||||||
action="py3o_template_configuration_action" />
|
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
Loading…
Reference in New Issue