[FIX] report_py3o: prettier xml after merge with master

This commit is contained in:
Laurent Mignon (ACSONE)
2020-05-12 17:02:14 +02:00
parent 992e5675cd
commit a853c6fe95
15 changed files with 313 additions and 265 deletions

View File

@@ -11,7 +11,7 @@ addons:
postgresql: "9.6"
apt:
packages:
- expect-dev # provides unbuffer utility
- expect-dev # provides unbuffer utility
- libreoffice
stages:

View File

@@ -1,6 +1,6 @@
// © 2019 Creu Blanca
// License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
odoo.define("report_csv.report", function(require) {
odoo.define("report_csv.report", function (require) {
"use strict";
var core = require("web.core");
@@ -10,7 +10,7 @@ odoo.define("report_csv.report", function(require) {
var _t = core._t;
ActionManager.include({
_downloadReportCSV: function(url, actions) {
_downloadReportCSV: function (url, actions) {
var self = this;
framework.blockUI();
var type = "csv";
@@ -19,7 +19,7 @@ odoo.define("report_csv.report", function(require) {
if (
_.isUndefined(cloned_action.data) ||
_.isNull(cloned_action.data) ||
(_.isObject(cloned_action.data) && _.isEmpty(cloned_action.data))
_.isObject(cloned_action.data) && _.isEmpty(cloned_action.data)
) {
if (cloned_action.context.active_ids) {
url += "/" + cloned_action.context.active_ids.join(",");
@@ -33,14 +33,14 @@ odoo.define("report_csv.report", function(require) {
encodeURIComponent(JSON.stringify(cloned_action.context));
}
return new Promise(function(resolve, reject) {
return new Promise(function (resolve, reject) {
var blocked = !session.get_file({
url: url,
data: {
data: JSON.stringify([url, type]),
},
success: resolve,
error: error => {
error: (error) => {
self.call("crash_manager", "rpc_error", error);
reject();
},
@@ -53,40 +53,40 @@ odoo.define("report_csv.report", function(require) {
var message = _t(
"A popup window with your report was blocked. You " +
"may need to change your browser settings to allow " +
"popup windows for this page."
"popup windows for this page.",
);
this.do_warn(_t("Warning"), message, true);
}
});
},
_triggerDownload: function(action, options, type) {
_triggerDownload: function (action, options, type) {
var self = this;
var reportUrls = this._makeReportUrls(action);
if (type === "csv") {
return this._downloadReportCSV(reportUrls[type], action).then(
function() {
function () {
if (action.close_on_report_download) {
var closeAction = {type: "ir.actions.act_window_close"};
return self.doAction(
closeAction,
_.pick(options, "on_close")
_.pick(options, "on_close"),
);
}
return options.on_close();
}
},
);
}
return this._super.apply(this, arguments);
},
_makeReportUrls: function(action) {
_makeReportUrls: function (action) {
var reportUrls = this._super.apply(this, arguments);
reportUrls.csv = "/report/csv/" + action.report_name;
return reportUrls;
},
_executeReportAction: function(action, options) {
_executeReportAction: function (action, options) {
var self = this;
if (action.report_type === "csv") {
return self._triggerDownload(action, options, "csv");

View File

@@ -1,20 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2016 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="res_users_report_py3o" model="ir.actions.report">
<field name="name">Py3o Demo Report</field>
<field name="type">ir.actions.report</field>
<field name="model">res.users</field>
<field name="report_name">py3o_user_info</field>
<field name="report_type">py3o</field>
<field name="py3o_filetype">odt</field>
<field name="module">report_py3o</field>
<field name="py3o_template_fallback">demo/res_user.odt</field>
<field name="binding_model_id" ref="base.model_res_users" />
<field name="binding_type">report</field>
<field name="name">Py3o Demo Report</field>
<field name="type">ir.actions.report</field>
<field name="model">res.users</field>
<field name="report_name">py3o_user_info</field>
<field name="report_type">py3o</field>
<field name="py3o_filetype">odt</field>
<field name="module">report_py3o</field>
<field name="py3o_template_fallback">demo/res_user.odt</field>
<field name="binding_model_id" ref="base.model_res_users" />
<field name="binding_type">report</field>
</record>
</odoo>
</odoo>

View File

@@ -1,39 +1,42 @@
/* Copyright 2017-2018 ACSONE SA/NV
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
odoo.define('report_py3o.report', function (require) {
odoo.define("report_py3o.report", function (require) {
"use strict";
var ActionManager = require('web.ActionManager');
var ActionManager = require("web.ActionManager");
ActionManager.include({
_executeReportAction: function (action, options) {
// Py3o reports
if ('report_type' in action && action.report_type === 'py3o' ) {
return this._triggerDownload(action, options, 'py3o');
// Py3o reports
if ("report_type" in action && action.report_type === "py3o") {
return this._triggerDownload(action, options, "py3o");
}
return this._super.apply(this, arguments);
},
_makeReportUrls: function (action) {
var reportUrls = this._super.apply(this, arguments);
reportUrls.py3o = '/report/py3o/' + action.report_name;
reportUrls.py3o = "/report/py3o/" + action.report_name;
// We may have to build a query string with `action.data`. It's the place
// were report's using a wizard to customize the output traditionally put
// their options.
if (_.isUndefined(action.data) || _.isNull(action.data) ||
_.isObject(action.data) && _.isEmpty(action.data)) {
if (
_.isUndefined(action.data) ||
_.isNull(action.data) ||
_.isObject(action.data) && _.isEmpty(action.data)
) {
if (action.context.active_ids) {
var activeIDsPath = '/' + action.context.active_ids.join(',');
var activeIDsPath = "/" + action.context.active_ids.join(",");
reportUrls.py3o += activeIDsPath;
}
} else {
var serializedOptionsPath = '?options=' + encodeURIComponent(JSON.stringify(action.data));
serializedOptionsPath += '&context=' + encodeURIComponent(JSON.stringify(action.context));
var serializedOptionsPath =
"?options=" + encodeURIComponent(JSON.stringify(action.data));
serializedOptionsPath +=
"&context=" + encodeURIComponent(JSON.stringify(action.context));
reportUrls.py3o += serializedOptionsPath;
}
return reportUrls;
},
});
});

View File

@@ -1,51 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Inherit from base.act_report_xml_view to add py3o-related settings. -->
<record id="py3o_report_view" model="ir.ui.view">
<field name="name">py3o_report_view</field>
<field name="model">ir.actions.report</field>
<field name="inherit_id" ref="base.act_report_xml_view" />
<field name="arch" type="xml">
<xpath expr="/form/field[1]" position="before">
<field name="is_py3o_report_not_available" invisible="1"/>
<div class="alert alert-danger"
role="alert"
style="margin-bottom:0px;"
attrs="{'invisible': [('is_py3o_report_not_available','=',False)]}">
<field name="msg_py3o_report_not_available"/>
</div>
<field name="is_py3o_report_not_available" invisible="1" />
<div
class="alert alert-danger"
role="alert"
style="margin-bottom:0px;"
attrs="{'invisible': [('is_py3o_report_not_available','=',False)]}"
>
<field name="msg_py3o_report_not_available" />
</div>
</xpath>
<xpath expr="//page[@name='security']" position="before">
<page string="LibreOffice Template" name="py3o_tab"
attrs="{'invisible': [('report_type', '!=', 'py3o')]}">
<page
string="LibreOffice Template"
name="py3o_tab"
attrs="{'invisible': [('report_type', '!=', 'py3o')]}"
>
<group name="py3o_params">
<field name="lo_bin_path"/>
<field name="lo_bin_path" />
<field name="py3o_filetype" />
<field name="py3o_multi_in_one"/>
<field name="py3o_multi_in_one" />
<field name="py3o_template_id" />
<field name="module" />
<field name="py3o_template_fallback" />
</group>
</page>
</xpath>
</field>
</record>
<record id="act_report_xml_search_view" model="ir.ui.view">
<field name="name">py3o_report_search_view</field>
<field name="model">ir.actions.report</field>
<field name="inherit_id" ref="base.act_report_xml_search_view"/>
<field name="inherit_id" ref="base.act_report_xml_search_view" />
<field name="arch" type="xml">
<field name="model" position="after">
<filter name="py3o" string="Py3o Reports"
domain="[('report_type', '=', 'py3o')]"/>
<filter
name="py3o"
string="Py3o Reports"
domain="[('report_type', '=', 'py3o')]"
/>
</field>
</field>
</record>
</odoo>

View File

@@ -1,8 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<menuitem id="py3o_config_menu"
name="Py3o"
parent="base.reporting_menuitem" />
<menuitem id="py3o_config_menu" name="Py3o" parent="base.reporting_menuitem" />
</odoo>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="py3o_template_configuration_search_view" model="ir.ui.view">
<field name="name">py3o.template.configuration.search.view</field>
<field name="model">py3o.template</field>
@@ -9,13 +8,15 @@
<field name="name" />
<field name="filetype" />
<group string="Group By" name="groupby">
<filter name="filetype_groupby" string="File Type"
context="{'group_by': 'filetype'}"/>
<filter
name="filetype_groupby"
string="File Type"
context="{'group_by': 'filetype'}"
/>
</group>
</search>
</field>
</record>
<record id="py3o_template_configuration_form_view" model="ir.ui.view">
<field name="name">py3o.template.configuration.form.view</field>
<field name="model">py3o.template</field>
@@ -29,7 +30,6 @@
</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>
@@ -40,15 +40,14 @@
</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"
<menuitem
id="py3o_template_configuration_menu"
parent="py3o_config_menu"
action="py3o_template_configuration_action" />
action="py3o_template_configuration_action"
/>
</odoo>

View File

@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="assets_backend" name="report assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/report_py3o/static/src/js/py3oactionmanager.js"></script>
</xpath>
</template>
<template id="assets_backend" name="report assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script
type="text/javascript"
src="/report_py3o/static/src/js/py3oactionmanager.js"
/>
</xpath>
</template>
</odoo>

View File

@@ -1,11 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="py3o_pdf_options_pdfa" model="py3o.pdf.options">
<field name="name">PDF/A (for Factur-X invoices)</field>
<field name="pdfa" eval="True"/>
</record>
<record id="py3o_pdf_options_pdfa" model="py3o.pdf.options">
<field name="name">PDF/A (for Factur-X invoices)</field>
<field name="pdfa" eval="True" />
</record>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="report_py3o.res_users_report_py3o" model="ir.actions.report">
<field name="py3o_is_local_fusion" eval="1"/>
<field name="py3o_is_local_fusion" eval="1" />
</record>
</odoo>

View File

@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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</field>
<field name="inherit_id" ref="report_py3o.py3o_report_view" />
<field name="arch" type="xml">
<field name="py3o_multi_in_one" position="after">
<field name="py3o_is_local_fusion"/>
<field name="py3o_is_local_fusion" />
<field name="py3o_server_id" />
<field name="pdf_options_id" attrs="{'invisible': [('py3o_filetype', '!=', 'pdf')]}"/>
<field
name="pdf_options_id"
attrs="{'invisible': [('py3o_filetype', '!=', 'pdf')]}"
/>
</field>
</field>
</record>

View File

@@ -1,148 +1,201 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2018 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="py3o_pdf_options_form" model="ir.ui.view">
<field name="name">py3o.pdf.options.form</field>
<field name="model">py3o.pdf.options</field>
<field name="arch" type="xml">
<form string="Py3o PDF Export Options">
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" placeholder="Give a name to the set of PDF export options"/>
</h1>
</div>
<notebook>
<page name="general" string="General">
<group name="general">
<group name="general-left" col="1">
<group name="general-image" string="Image">
<field name="image_compression" widget="radio"/>
<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"/>
<record id="py3o_pdf_options_form" model="ir.ui.view">
<field name="name">py3o.pdf.options.form</field>
<field name="model">py3o.pdf.options</field>
<field name="arch" type="xml">
<form string="Py3o PDF Export Options">
<div class="oe_title">
<label for="name" />
<h1>
<field
name="name"
placeholder="Give a name to the set of PDF export options"
/>
</h1>
</div>
<notebook>
<page name="general" string="General">
<group name="general">
<group name="general-left" col="1">
<group name="general-image" string="Image">
<field name="image_compression" widget="radio" />
<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"
/>
</div>
<field name="image_reduce_resolution" />
</group>
<group name="general-watermark" string="Watermark">
<field name="watermark" />
<field
name="watermark_text"
attrs="{'invisible': [('watermark', '!=', True)], 'required': [('watermark', '=', True)]}"
/>
</group>
</group>
<group name="general-right" string="General">
<field name="pdfa" />
<field
name="tagged_pdf"
attrs="{'invisible': [('pdfa', '=', True)]}"
/>
<field
name="pdf_form"
attrs="{'invisible': [('pdfa', '=', True)]}"
/>
<field
name="pdf_form_format"
attrs="{'invisible': [('pdf_form', '!=', True)], 'required': [('pdf_form', '=', True)]}"
/>
<field
name="pdf_form_allow_duplicate"
attrs="{'invisible': [('pdf_form', '!=', True)]}"
/>
<field name="export_bookmarks" />
<field name="export_placeholders" />
<field name="export_comments" />
<field name="export_hidden_slides" />
</group>
</group>
</page>
<page name="initial_view" string="Initial View">
<group name="initial_view">
<group name="initial_view-left" col="1">
<group name="panes" string="Panes">
<field name="initial_view" widget="radio" />
<field name="initial_page" />
</group>
<group name="magnification" string="Magnification">
<field name="magnification" widget="radio" />
<field
name="zoom"
attrs="{'invisible': [('magnification', '!=', '4')]}"
/>
</group>
</group>
<group name="initial_view-right">
<field name="page_layout" widget="radio" />
</group>
</group>
</page>
<page name="user_intf" string="User Interface">
<group name="user_intf">
<group name="user_intf-left" col="1">
<group
name="user_intf-window-options"
string="Window Options"
>
<field name="resize_windows_initial_page" />
<field name="center_window" />
<field name="open_fullscreen" />
<field name="display_document_title" />
</group>
</group>
<group name="user_intf-right" col="1">
<group
name="user_intf-options"
string="User Interface Options"
>
<field name="hide_menubar" />
<field name="hide_toolbar" />
<field name="hide_window_controls" />
</group>
<group string="Bookmarks" name="bookmarks">
<field name="open_bookmark_levels" />
</group>
</group>
</group>
</page>
<page string="Links" name="links">
<group name="links" col="1">
<group name="links-general" string="General">
<field name="export_bookmarks_named_dest" />
<field name="convert_doc_ref_to_pdf_target" />
<field name="export_filesystem_urls" />
</group>
<group name="links-cross-doc" string="Cross-document Links">
<field name="cross_doc_link_action" widget="radio" />
</group>
</group>
</page>
<page string="Security" name="security">
<group name="security">
<group
name="security-left"
attrs="{'invisible': [('pdfa', '=', True)]}"
>
<field name="encrypt" />
<field
name="document_password"
password="True"
attrs="{'invisible': [('encrypt', '!=', True)], 'required': [('encrypt', '=', True)]}"
/>
<field name="restrict_permissions" />
<field
name="permission_password"
password="True"
attrs="{'invisible': [('restrict_permissions', '!=', True)], 'required': [('restrict_permissions', '=', True)]}"
/>
</group>
<group
name="security-right"
attrs="{'invisible': ['|', ('pdfa', '=', True), ('restrict_permissions', '=', False)]}"
>
<field name="printing" widget="radio" />
<field name="changes" widget="radio" />
<field name="content_copying_allowed" />
<field name="text_access_accessibility_tools_allowed" />
</group>
<group
name="security-pdfa"
attrs="{'invisible': [('pdfa', '=', False)]}"
colspan="2"
>
<div>
<p
>The security settings are incompatible with the <b
>PDF/A-1a</b> option in the <em
>General</em> tab.</p>
</div>
<field name="image_reduce_resolution"/>
</group>
<group name="general-watermark" string="Watermark">
<field name="watermark"/>
<field name="watermark_text" attrs="{'invisible': [('watermark', '!=', True)], 'required': [('watermark', '=', True)]}"/>
</group>
</group>
<group name="general-right" string="General">
<field name="pdfa"/>
<field name="tagged_pdf" attrs="{'invisible': [('pdfa', '=', True)]}"/>
<field name="pdf_form" attrs="{'invisible': [('pdfa', '=', True)]}"/>
<field name="pdf_form_format" attrs="{'invisible': [('pdf_form', '!=', True)], 'required': [('pdf_form', '=', True)]}"/>
<field name="pdf_form_allow_duplicate" attrs="{'invisible': [('pdf_form', '!=', True)]}"/>
<field name="export_bookmarks"/>
<field name="export_placeholders"/>
<field name="export_comments"/>
<field name="export_hidden_slides"/>
</group>
</group>
</page>
<page name="initial_view" string="Initial View">
<group name="initial_view">
<group name="initial_view-left" col="1">
<group name="panes" string="Panes">
<field name="initial_view" widget="radio"/>
<field name="initial_page"/>
</group>
<group name="magnification" string="Magnification">
<field name="magnification" widget="radio"/>
<field name="zoom" attrs="{'invisible': [('magnification', '!=', '4')]}"/>
</group>
</group>
<group name="initial_view-right">
<field name="page_layout" widget="radio"/>
</group>
</group>
</page>
<page name="user_intf" string="User Interface">
<group name="user_intf">
<group name="user_intf-left" col="1">
<group name="user_intf-window-options" string="Window Options">
<field name="resize_windows_initial_page"/>
<field name="center_window"/>
<field name="open_fullscreen"/>
<field name="display_document_title"/>
</group>
</group>
<group name="user_intf-right" col="1">
<group name="user_intf-options" string="User Interface Options">
<field name="hide_menubar"/>
<field name="hide_toolbar"/>
<field name="hide_window_controls"/>
</group>
<group string="Bookmarks" name="bookmarks">
<field name="open_bookmark_levels"/>
</group>
</group>
</group>
</page>
<page string="Links" name="links">
<group name="links" col="1">
<group name="links-general" string="General">
<field name="export_bookmarks_named_dest"/>
<field name="convert_doc_ref_to_pdf_target"/>
<field name="export_filesystem_urls"/>
</group>
<group name="links-cross-doc" string="Cross-document Links">
<field name="cross_doc_link_action" widget="radio"/>
</group>
</group>
</page>
<page string="Security" name="security">
<group name="security">
<group name="security-left" attrs="{'invisible': [('pdfa', '=', True)]}">
<field name="encrypt"/>
<field name="document_password" password="True" attrs="{'invisible': [('encrypt', '!=', True)], 'required': [('encrypt', '=', True)]}"/>
<field name="restrict_permissions"/>
<field name="permission_password" password="True" attrs="{'invisible': [('restrict_permissions', '!=', True)], 'required': [('restrict_permissions', '=', True)]}"/>
</group>
<group name="security-right" attrs="{'invisible': ['|', ('pdfa', '=', True), ('restrict_permissions', '=', False)]}">
<field name="printing" widget="radio"/>
<field name="changes" widget="radio"/>
<field name="content_copying_allowed"/>
<field name="text_access_accessibility_tools_allowed"/>
</group>
<group name="security-pdfa" attrs="{'invisible': [('pdfa', '=', False)]}" colspan="2">
<div><p>The security settings are incompatible with the <b>PDF/A-1a</b> option in the <em>General</em> tab.</p></div>
</group>
</group>
</page>
</notebook>
</form>
</field>
</record>
<record id="py3o_pdf_options_tree" model="ir.ui.view">
<field name="name">py3o.pdf.options.tree</field>
<field name="model">py3o.pdf.options</field>
<field name="arch" type="xml">
<tree string="Py3o PDF Export Options">
<field name="name"/>
</tree>
</field>
</record>
<record id="py3o_pdf_options_action" model="ir.actions.act_window">
<field name="name">Py3o PDF Export Options</field>
<field name="res_model">py3o.pdf.options</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="py3o_pdf_options_menu"
parent="report_py3o.py3o_config_menu"
action="py3o_pdf_options_action"
sequence="40" />
</page>
</notebook>
</form>
</field>
</record>
<record id="py3o_pdf_options_tree" model="ir.ui.view">
<field name="name">py3o.pdf.options.tree</field>
<field name="model">py3o.pdf.options</field>
<field name="arch" type="xml">
<tree string="Py3o PDF Export Options">
<field name="name" />
</tree>
</field>
</record>
<record id="py3o_pdf_options_action" model="ir.actions.act_window">
<field name="name">Py3o PDF Export Options</field>
<field name="res_model">py3o.pdf.options</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
id="py3o_pdf_options_menu"
parent="report_py3o.py3o_config_menu"
action="py3o_pdf_options_action"
sequence="40"
/>
</odoo>

View File

@@ -1,40 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<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 name="main">
<field name="url" widget="url"/>
<field name="pdf_options_id"/>
<field name="url" widget="url" />
<field name="pdf_options_id" />
<field name="is_active" />
</group>
</form>
</field>
</record>
<record id="py3o_server_configuration_tree_view" model="ir.ui.view">
<field name="name">py3o.server.configuration.tree.view</field>
<field name="model">py3o.server</field>
<field name="arch" type="xml">
<tree string="Py3o Servers Configuration">
<field name="url" />
<field name="pdf_options_id"/>
<field name="pdf_options_id" />
<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"
<menuitem
id="py3o_server_configuration_menu"
parent="report_py3o.py3o_config_menu"
action="py3o_server_configuration_action" />
action="py3o_server_configuration_action"
/>
</odoo>

View File

@@ -1,6 +1,6 @@
// © 2017 Creu Blanca
// License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
odoo.define("report_xlsx.report", function(require) {
odoo.define("report_xlsx.report", function (require) {
"use strict";
var core = require("web.core");
@@ -10,7 +10,7 @@ odoo.define("report_xlsx.report", function(require) {
var _t = core._t;
ActionManager.include({
_downloadReportXLSX: function(url, actions) {
_downloadReportXLSX: function (url, actions) {
var self = this;
framework.blockUI();
var type = "xlsx";
@@ -20,7 +20,7 @@ odoo.define("report_xlsx.report", function(require) {
if (
_.isUndefined(cloned_action.data) ||
_.isNull(cloned_action.data) ||
(_.isObject(cloned_action.data) && _.isEmpty(cloned_action.data))
_.isObject(cloned_action.data) && _.isEmpty(cloned_action.data)
) {
if (cloned_action.context.active_ids) {
new_url += "/" + cloned_action.context.active_ids.join(",");
@@ -34,14 +34,14 @@ odoo.define("report_xlsx.report", function(require) {
encodeURIComponent(JSON.stringify(cloned_action.context));
}
return new Promise(function(resolve, reject) {
return new Promise(function (resolve, reject) {
var blocked = !session.get_file({
url: new_url,
data: {
data: JSON.stringify([new_url, type]),
},
success: resolve,
error: error => {
error: (error) => {
self.call("crash_manager", "rpc_error", error);
reject();
},
@@ -54,40 +54,40 @@ odoo.define("report_xlsx.report", function(require) {
var message = _t(
"A popup window with your report was blocked. You " +
"may need to change your browser settings to allow " +
"popup windows for this page."
"popup windows for this page.",
);
this.do_warn(_t("Warning"), message, true);
}
});
},
_triggerDownload: function(action, options, type) {
_triggerDownload: function (action, options, type) {
var self = this;
var reportUrls = this._makeReportUrls(action);
if (type === "xlsx") {
return this._downloadReportXLSX(reportUrls[type], action).then(
function() {
function () {
if (action.close_on_report_download) {
var closeAction = {type: "ir.actions.act_window_close"};
return self.doAction(
closeAction,
_.pick(options, "on_close")
_.pick(options, "on_close"),
);
}
return options.on_close();
}
},
);
}
return this._super.apply(this, arguments);
},
_makeReportUrls: function(action) {
_makeReportUrls: function (action) {
var reportUrls = this._super.apply(this, arguments);
reportUrls.xlsx = "/report/xlsx/" + action.report_name;
return reportUrls;
},
_executeReportAction: function(action, options) {
_executeReportAction: function (action, options) {
var self = this;
if (action.report_type === "xlsx") {
return self._triggerDownload(action, options, "xlsx");

View File

@@ -1,16 +1,16 @@
odoo.define("report_xml.ReportActionManager", function(require) {
odoo.define("report_xml.ReportActionManager", function (require) {
"use strict";
var ActionManager = require("web.ActionManager");
ActionManager.include({
_executeReportAction: function(action, options) {
_executeReportAction: function (action, options) {
if (action.report_type === "qweb-xml") {
return this._triggerDownload(action, options, "xml");
}
return this._super(action, options);
},
_makeReportUrls: function(action) {
_makeReportUrls: function (action) {
var reportUrls = this._super(action);
reportUrls.xml = reportUrls.text.replace("/report/text/", "/report/xml/");
return reportUrls;