Laurent Mignon (ACSONE)
5 years ago
committed by
default
6 changed files with 72 additions and 73 deletions
-
27report_py3o/demo/report_py3o.xml
-
29report_py3o/static/src/js/py3oactionmanager.js
-
45report_py3o/views/ir_actions_report.xml
-
8report_py3o/views/menu.xml
-
21report_py3o/views/py3o_template.xml
-
15report_py3o/views/report_py3o.xml
@ -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> |
@ -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; |
|||
}, |
|||
}); |
|||
|
|||
}); |
@ -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> |
@ -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> |
@ -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> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue