[MIG] bi_sql_editor: Migration to 17.0

This commit is contained in:
chien
2023-12-21 10:15:33 +07:00
committed by thien
parent b7d0201fcd
commit e51ac73986
8 changed files with 134 additions and 161 deletions

View File

@@ -135,11 +135,11 @@ To use this module, you need to:
..
|image1|
|usage-image1|
- You can switch to 'Graph' or 'tree' views as any report.
.. |image1| image:: https://raw.githubusercontent.com/OCA/reporting-engine/17.0/bi_sql_editor/static/description/05_reporting_pivot.png
.. |usage-image1| image:: https://raw.githubusercontent.com/OCA/reporting-engine/17.0/bi_sql_editor/static/description/05_reporting_pivot.png
Bug Tracker
===========

View File

@@ -5,7 +5,7 @@
{
"name": "BI SQL Editor",
"summary": "BI Views builder, based on Materialized or Normal SQL Views",
"version": "16.0.1.0.5",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"category": "Reporting",
"author": "GRAP,Odoo Community Association (OCA)",

View File

@@ -1,11 +1,8 @@
# Copyright 2015-2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import SUPERUSER_ID
from odoo.api import Environment
def uninstall_hook(cr, registry):
env = Environment(cr, SUPERUSER_ID, {})
def uninstall_hook(env):
recs = env["bi.sql.view"].search([])
for rec in recs:
rec.button_set_draft()

View File

@@ -59,8 +59,6 @@ class BiSQLView(models.Model):
is_materialized = fields.Boolean(
string="Is Materialized View",
default=True,
readonly=True,
states={"draft": [("readonly", False)], "sql_valid": [("readonly", False)]},
)
materialized_text = fields.Char(compute="_compute_materialized_text", store=True)
@@ -75,8 +73,6 @@ class BiSQLView(models.Model):
view_order = fields.Char(
required=True,
readonly=False,
states={"ui_valid": [("readonly", True)]},
default="pivot,graph,tree",
help="Comma-separated text. Possible values:" ' "graph", "pivot" or "tree"',
)
@@ -93,28 +89,20 @@ class BiSQLView(models.Model):
domain_force = fields.Text(
string="Extra Rule Definition",
default="[]",
readonly=True,
help="Define here access restriction to data.\n"
" Take care to use field name prefixed by 'x_'."
" A global 'ir.rule' will be created."
" A typical Multi Company rule is for exemple \n"
" ['|', ('x_company_id','child_of', [user.company_id.id]),"
"('x_company_id','=',False)].",
states={"draft": [("readonly", False)], "sql_valid": [("readonly", False)]},
)
computed_action_context = fields.Text(compute="_compute_computed_action_context")
action_context = fields.Text(
default="{}",
readonly=True,
help="Define here a context that will be used"
" by default, when creating the action.",
states={
"draft": [("readonly", False)],
"sql_valid": [("readonly", False)],
"model_valid": [("readonly", False)],
},
)
bi_sql_view_field_ids = fields.One2many(
@@ -161,12 +149,6 @@ class BiSQLView(models.Model):
rule_id = fields.Many2one(string="Odoo Rule", comodel_name="ir.rule", readonly=True)
group_ids = fields.Many2many(
comodel_name="res.groups",
readonly=True,
states={"draft": [("readonly", False)], "sql_valid": [("readonly", False)]},
)
sequence = fields.Integer(string="sequence")
# Constrains Section
@@ -522,8 +504,7 @@ class BiSQLView(models.Model):
def _drop_view(self):
for sql_view in self:
self._log_execute(
"DROP %s VIEW IF EXISTS %s"
% (sql_view.materialized_text, sql_view.view_name)
f"DROP {sql_view.materialized_text} VIEW IF EXISTS {sql_view.view_name}"
)
sql_view.size = False
@@ -552,12 +533,7 @@ class BiSQLView(models.Model):
lambda x: x.is_index is True
):
self._log_execute(
"CREATE INDEX %(index_name)s ON %(view_name)s (%(field_name)s);"
% {
"index_name": sql_field.index_name,
"view_name": sql_view.view_name,
"field_name": sql_field.name,
}
f"CREATE INDEX {sql_field.index_name} ON {sql_view.view_name} ({sql_field.name});"
)
def _create_model_and_fields(self):
@@ -639,7 +615,7 @@ class BiSQLView(models.Model):
field_ids = []
for column in columns:
existing_field = self.bi_sql_view_field_ids.filtered(
lambda x: x.name == column[1]
lambda x, c=column: x.name == c[1]
)
if existing_field:
# Update existing field

View File

@@ -76,34 +76,29 @@ class BiSQLViewField(models.Model):
help="Check this box if you want to create"
" an index on that field. This is recommended for searchable and"
" groupable fields, to reduce duration",
states={"model_valid": [("readonly", True)], "ui_valid": [("readonly", True)]},
)
is_group_by = fields.Boolean(
string="Is Group by",
help="Check this box if you want to create"
" a 'group by' option in the search view",
states={"ui_valid": [("readonly", True)]},
)
index_name = fields.Char(compute="_compute_index_name")
graph_type = fields.Selection(
selection=_GRAPH_TYPE_SELECTION,
states={"ui_valid": [("readonly", True)]},
)
tree_visibility = fields.Selection(
selection=_TREE_VISIBILITY_SELECTION,
default="available",
required=True,
states={"ui_valid": [("readonly", True)]},
)
field_description = fields.Char(
help="This will be used as the name of the Odoo field, displayed for users",
required=True,
states={"model_valid": [("readonly", True)], "ui_valid": [("readonly", True)]},
)
ttype = fields.Selection(
@@ -113,7 +108,6 @@ class BiSQLViewField(models.Model):
" Odoo field that will be created. Keep empty if you don't want to"
" create a new field. If empty, this field will not be displayed"
" neither available for search or group by function",
states={"model_valid": [("readonly", True)], "ui_valid": [("readonly", True)]},
)
selection = fields.Text(
@@ -123,28 +117,24 @@ class BiSQLViewField(models.Model):
" List of options, specified as a Python expression defining a list of"
" (key, label) pairs. For example:"
" [('blue','Blue'), ('yellow','Yellow')]",
states={"model_valid": [("readonly", True)], "ui_valid": [("readonly", True)]},
)
many2one_model_id = fields.Many2one(
comodel_name="ir.model",
string="Model",
help="For 'Many2one' Odoo field.\n" " Comodel of the field.",
states={"model_valid": [("readonly", True)], "ui_valid": [("readonly", True)]},
)
group_operator = fields.Selection(
selection=_GROUP_OPERATOR_SELECTION,
help="By default, Odoo will sum the values when grouping. If you wish "
"to alter the behaviour, choose an alternate Group Operator",
states={"model_valid": [("readonly", True)], "ui_valid": [("readonly", True)]},
)
field_context = fields.Char(
default="{}",
help="Context value that will be inserted for this field in all the views."
" Important note : please write a context with single quote.",
states={"ui_valid": [("readonly", True)]},
)
# Constrains Section
@@ -255,7 +245,7 @@ class BiSQLViewField(models.Model):
return ""
visibility_text = ""
if self.tree_visibility == "invisible":
visibility_text = 'invisible="1"'
visibility_text = 'column_invisible="1"'
elif self.tree_visibility == "optional_hide":
visibility_text = 'optional="hide"'
elif self.tree_visibility == "optional_show":

View File

@@ -3,6 +3,6 @@ To use this module, you need to:
1. Go to 'Dashboards \> SQL Reports'
2. Select the desired report
> ![](../static/description/05_reporting_pivot.png)
> ![usage-image1](../static/description/05_reporting_pivot.png)
- You can switch to 'Graph' or 'tree' views as any report.

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@@ -369,38 +368,43 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2cd8ab59abe1f67505f360059541525311a4e5f9d41ecf7e5713ea9bedb55540
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/16.0/bi_sql_editor"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-bi_sql_editor"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/17.0/bi_sql_editor"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-bi_sql_editor"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of reporting, to support creation
of extra custom reports.
It allows user to write a custom SQL request. (Generally, admin users)</p>
<p>Once written, a new model is generated, and user can map the selected field
with odoo fields.
Then user ends the process, creating new menu, action and graph view.</p>
<p>Technically, the module create SQL View (or materialized view, if option is
checked). Materialized view duplicates datas, but request are fastest. If
materialized view is enabled, this module will create a cron task to refresh
the data).</p>
of extra custom reports. It allows user to write a custom SQL request.
(Generally, admin users)</p>
<p>Once written, a new model is generated, and user can map the selected
field with odoo fields. Then user ends the process, creating new menu,
action and graph view.</p>
<p>Technically, the module create SQL View (or materialized view, if option
is checked). Materialized view duplicates datas, but request are
fastest. If materialized view is enabled, this module will create a cron
task to refresh the data).</p>
<p>By default, users member of SQL Request / User can see all the views.
You can specify extra groups that have the right to access to a specific view.</p>
You can specify extra groups that have the right to access to a specific
view.</p>
<div class="section" id="warning">
<h1>Warning</h1>
<p>This module is intended for technician people in a company and for Odoo integrators.</p>
<p>This module is intended for technician people in a company and for Odoo
integrators.</p>
<p>It requires the user to know SQL syntax and Odoo models.</p>
<p>If you dont have such skills, do not try to use this module specially on a production
environment.</p>
<p>If you dont have such skills, do not try to use this module specially
on a production environment.</p>
</div>
<div class="section" id="use-cases">
<h1>Use Cases</h1>
<p>this module is interesting for the following use cases</p>
<ul class="simple">
<li>You want to realize technical SQL requests, that Odoo framework doesnt allow
(For exemple, UNION with many SELECT) A typical use case is if you want to have
Sale Orders and PoS Orders datas in a same table</li>
<li>You want to customize an Odoo report, removing some useless fields and adding
some custom ones. In that case, you can simply select the fields of the original
report (sale.report model for exemple), and add your custom fields</li>
<li>You have a lot of data, and classical SQL Views have very bad performance.
In that case, MATERIALIZED VIEW will be a good solution to reduce display duration</li>
<li>You want to realize technical SQL requests, that Odoo framework
doesnt allow (For exemple, UNION with many SELECT) A typical use
case is if you want to have Sale Orders and PoS Orders datas in a
same table</li>
<li>You want to customize an Odoo report, removing some useless fields
and adding some custom ones. In that case, you can simply select the
fields of the original report (sale.report model for exemple), and
add your custom fields</li>
<li>You have a lot of data, and classical SQL Views have very bad
performance. In that case, MATERIALIZED VIEW will be a good solution
to reduce display duration</li>
</ul>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
@@ -408,12 +412,7 @@ In that case, MATERIALIZED VIEW will be a good solution to reduce display durati
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a></li>
</ul>
</div>
<div class="section" id="configuration">
@@ -422,14 +421,10 @@ In that case, MATERIALIZED VIEW will be a good solution to reduce display durati
<li><p class="first">Go to Dashboard / Configuration / SQL Views</p>
</li>
<li><p class="first">tip your SQL request</p>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/reporting-engine/16.0/bi_sql_editor/static/description/01_sql_request.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/16.0/bi_sql_editor/static/description/01_sql_request.png" style="width: 800px;" />
</div>
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/reporting-engine/17.0/bi_sql_editor/static/description/01_sql_request.png" /></p>
</li>
<li><p class="first">Select the group(s) that could have access to the view</p>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/reporting-engine/16.0/bi_sql_editor/static/description/02_security_access.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/16.0/bi_sql_editor/static/description/02_security_access.png" style="width: 800px;" />
</div>
<p><img alt="image2" src="https://raw.githubusercontent.com/OCA/reporting-engine/17.0/bi_sql_editor/static/description/02_security_access.png" /></p>
</li>
</ul>
<p>Optionnaly, you can add a domain.</p>
@@ -439,31 +434,27 @@ to make reporting depending on the current companies of the user.</p>
<ul>
<li><p class="first">Click on the button Validate SQL Expression</p>
</li>
<li><p class="first">Once the sql request checked, the module analyses the column of the view,
and propose field mapping. For each field, you can decide to create an index
and set if it will be displayed on the pivot graph as a column, a row or a
measure.</p>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/reporting-engine/16.0/bi_sql_editor/static/description/03_field_mapping.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/16.0/bi_sql_editor/static/description/03_field_mapping.png" style="width: 800px;" />
</div>
<li><p class="first">Once the sql request checked, the module analyses the column of the
view, and propose field mapping. For each field, you can decide to
create an index and set if it will be displayed on the pivot graph as
a column, a row or a measure.</p>
<p><img alt="image3" src="https://raw.githubusercontent.com/OCA/reporting-engine/17.0/bi_sql_editor/static/description/03_field_mapping.png" /></p>
</li>
<li><p class="first">Click on the button Create SQL elements. (this step could
take a while, if view is materialized)</p>
<li><p class="first">Click on the button Create SQL elements. (this step could take a
while, if view is materialized)</p>
</li>
<li><p class="first">If its a MATERIALIZED view:</p>
<blockquote>
<ul class="simple">
<li>a cron task is created to refresh
the view. You can so define the frequency of the refresh.</li>
<li>a cron task is created to refresh the view. You can so define
the frequency of the refresh.</li>
<li>the size of view (and the indexes is displayed)</li>
</ul>
</blockquote>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/reporting-engine/16.0/bi_sql_editor/static/description/04_materialized_view_setting.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/16.0/bi_sql_editor/static/description/04_materialized_view_setting.png" style="width: 800px;" />
</div>
<p><img alt="image4" src="https://raw.githubusercontent.com/OCA/reporting-engine/17.0/bi_sql_editor/static/description/04_materialized_view_setting.png" /></p>
</li>
<li><p class="first">Finally, click on Create UI, to create new menu, action, graph view and
search view.</p>
<li><p class="first">Finally, click on Create UI, to create new menu, action, graph view
and search view.</p>
</li>
</ul>
</div>
@@ -474,11 +465,9 @@ search view.</p>
<li>Go to Dashboards &gt; SQL Reports</li>
<li>Select the desired report</li>
</ol>
<!-- -->
<blockquote>
<div class="figure">
<img alt="https://raw.githubusercontent.com/OCA/reporting-engine/16.0/bi_sql_editor/static/description/05_reporting_pivot.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/16.0/bi_sql_editor/static/description/05_reporting_pivot.png" style="width: 800px;" />
</div>
</blockquote>
<img alt="usage-image1" src="https://raw.githubusercontent.com/OCA/reporting-engine/17.0/bi_sql_editor/static/description/05_reporting_pivot.png" /></blockquote>
<ul class="simple">
<li>You can switch to Graph or tree views as any report.</li>
</ul>
@@ -488,43 +477,42 @@ search view.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20bi_sql_editor%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20bi_sql_editor%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
</div>
</div>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
<h1>Authors</h1>
<ul class="simple">
<li>GRAP</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<h1>Contributors</h1>
<ul class="simple">
<li>Sylvain LE GAL (<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>)</li>
<li>Richard deMeester, WilldooIT (<a class="reference external" href="http://www.willdooit.com/">http://www.willdooit.com/</a>)</li>
<li>David James, WilldooIT (<a class="reference external" href="http://www.willdooit.com/">http://www.willdooit.com/</a>)</li>
<li><dl class="first docutils">
<dt>This module is highly inspired by the work of</dt>
<dd><ul class="first last">
<li>Onestein: (<a class="reference external" href="http://www.onestein.nl/">http://www.onestein.nl/</a>)
Module: OCA/server-tools/bi_view_editor.
Link: <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/9.0/bi_view_editor">https://github.com/OCA/reporting-engine/tree/9.0/bi_view_editor</a></li>
<li>Anybox: (<a class="reference external" href="https://anybox.fr/">https://anybox.fr/</a>)
Module : OCA/server-tools/materialized_sql_view
link: <a class="reference external" href="https://github.com/OCA/server-tools/pull/110">https://github.com/OCA/server-tools/pull/110</a></li>
<li>GRAP, Groupement Régional Alimentaire de Proximité: (<a class="reference external" href="http://www.grap.coop/">http://www.grap.coop/</a>)
Module: grap/odoo-addons-misc/pos_sale_reporting
link: <a class="reference external" href="https://github.com/grap/odoo-addons-misc/tree/7.0/pos_sale_reporting">https://github.com/grap/odoo-addons-misc/tree/7.0/pos_sale_reporting</a></li>
<li>This module is highly inspired by the work of<ul>
<li>Onestein: (<a class="reference external" href="http://www.onestein.nl/">http://www.onestein.nl/</a>) Module:
OCA/server-tools/bi_view_editor. Link:
<a class="reference external" href="https://github.com/OCA/reporting-engine/tree/9.0/bi_view_editor">https://github.com/OCA/reporting-engine/tree/9.0/bi_view_editor</a></li>
<li>Anybox: (<a class="reference external" href="https://anybox.fr/">https://anybox.fr/</a>) Module :
OCA/server-tools/materialized_sql_view link:
<a class="reference external" href="https://github.com/OCA/server-tools/pull/110">https://github.com/OCA/server-tools/pull/110</a></li>
<li>GRAP, Groupement Régional Alimentaire de Proximité:
(<a class="reference external" href="http://www.grap.coop/">http://www.grap.coop/</a>) Module:
grap/odoo-addons-misc/pos_sale_reporting link:
<a class="reference external" href="https://github.com/grap/odoo-addons-misc/tree/7.0/pos_sale_reporting">https://github.com/grap/odoo-addons-misc/tree/7.0/pos_sale_reporting</a></li>
</ul>
</dd>
</dl>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
<h1>Maintainers</h1>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
@@ -532,11 +520,9 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/legalsylvain"><img alt="legalsylvain" src="https://github.com/legalsylvain.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/16.0/bi_sql_editor">OCA/reporting-engine</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/17.0/bi_sql_editor">OCA/reporting-engine</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@@ -36,7 +36,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<button
name="button_reset_to_sql_valid"
type="object"
states="model_valid"
invisible="state != 'model_valid'"
string="Delete SQL Elements"
groups="sql_request_abstract.group_sql_request_manager"
confirm="It will delete the materialized view, and all the previous mapping realized with the columns"
@@ -44,14 +44,14 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<button
name="button_reset_to_model_valid"
type="object"
states="ui_valid"
invisible="state != 'ui_valid'"
string="Delete UI"
groups="sql_request_abstract.group_sql_request_manager"
/>
<button
name="button_create_sql_view_and_model"
type="object"
states="sql_valid"
invisible="state != 'sql_valid'"
string="Create SQL Elements"
class="oe_highlight"
help="This will try to create an SQL View, based on the SQL request and the according Transient Model and fields, based on settings"
@@ -61,13 +61,13 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
type="object"
string="Update Model Access"
class="oe_highlight"
attrs="{'invisible': ['|', ('state', 'in', ('draft', 'sql_valid')), ('has_group_changed', '=', False)]}"
invisible="state in ('draft', 'sql_valid') or not has_group_changed"
help="Update Model Access. Required if you changed groups list after having created the model"
/>
<button
name="button_create_ui"
type="object"
states="model_valid"
invisible="state != 'model_valid'"
string="Create UI"
class="oe_highlight"
help="This will create Odoo View, Action and Menu"
@@ -76,7 +76,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
name="button_open_view"
type="object"
string="Open View"
states="ui_valid"
invisible="state != 'ui_valid'"
class="oe_highlight"
/>
<button
@@ -84,66 +84,82 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
type="object"
string="Refresh"
help="Refresh Materialized View"
attrs="{'invisible': ['|', ('state', 'in', ('draft', 'sql_valid')), ('is_materialized', '=', False)]}"
invisible="state in ('draft', 'sql_valid') or not is_materialized"
/>
</xpath>
<group name="group_main_info" position="inside">
<group>
<field
name="technical_name"
attrs="{'readonly': [('state', '!=', 'draft')]}"
/>
<field name="technical_name" readonly="state != 'draft'" />
<field name="view_name" />
<field name="view_order" />
<field name="is_materialized" />
<field name="view_order" readonly="state == 'ui_valid'" />
<field
name="is_materialized"
readonly="state not in ('draft', 'sql_valid')"
/>
<field
name="size"
attrs="{'invisible': ['|', ('state', '=', 'draft'), ('is_materialized', '=', False)]}"
invisible="state == 'draft' or not is_materialized"
/>
<field
name="cron_id"
attrs="{'invisible': ['|', ('state', 'in', ('draft', 'sql_valid')), ('is_materialized', '=', False)]}"
invisible="state in ('draft', 'sql_valid') or not is_materialized"
/>
</group>
</group>
<page name="page_sql" position="after">
<page
string="SQL Fields"
attrs="{'invisible': [('state', '=', 'draft')]}"
>
<page string="SQL Fields" invisible="state == 'draft'">
<field name="bi_sql_view_field_ids" nolabel="1" colspan="4">
<tree editable="bottom" create="false">
<tree editable="bottom">
<field name="sequence" widget="handle" />
<field name="name" />
<field name="sql_type" />
<field name="field_description" />
<field name="ttype" />
<field
name="field_description"
readonly="state in ('model_valid', 'ui_valid')"
/>
<field
name="ttype"
readonly="state in ('model_valid', 'ui_valid')"
/>
<field
name="many2one_model_id"
attrs="{
'invisible': [('ttype', '!=', 'many2one')],
'required': [('ttype', '=', 'many2one')],
}"
invisible="ttype != 'many2one'"
required="ttype == 'many2one'"
readonly="state in ('model_valid', 'ui_valid')"
/>
<field
name="selection"
attrs="{
'invisible': [('ttype', '!=', 'selection')],
'required': [('ttype', '=', 'selection')],
}"
invisible="ttype != 'selection'"
required="ttype == 'selection'"
readonly="state in ('model_valid', 'ui_valid')"
/>
<field
name='group_operator'
optional="hide"
attrs="{
'invisible': [('ttype', 'not in', ('float', 'integer'))]}"
invisible="ttype not in ('float', 'integer')"
readonly="state in ('model_valid', 'ui_valid')"
/>
<field name="is_index" optional="hide" />
<field name="graph_type" />
<field name="is_group_by" optional="hide" />
<field name="tree_visibility" optional="hide" />
<field name="field_context" optional="hide" />
<field name="state" invisible="1" />
<field
name="is_index"
optional="hide"
readonly="state in ('model_valid', 'ui_valid')"
/>
<field name="graph_type" readonly="state == 'ui_valid'" />
<field
name="is_group_by"
optional="hide"
readonly="state == 'ui_valid'"
/>
<field
name="tree_visibility"
optional="hide"
readonly="state == 'ui_valid'"
/>
<field
name="field_context"
readonly="state == 'ui_valid'"
/>
<field name="state" column_invisible="1" />
</tree>
</field>
</page>
@@ -156,6 +172,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
colspan="2"
widget="ace"
options="{'mode': 'python'}"
readonly="state not in ('draft', 'sql_valid')"
/>
</group>
</page>
@@ -179,6 +196,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<group string="Custom Context">
<field
name="action_context"
readonly="state not in ('draft', 'sql_valid', 'model_valid')"
nolabel="1"
colspan="2"
widget="ace"
@@ -192,7 +210,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<field name="model_name" />
<field
name="model_id"
attrs="{'invisible': [('state', '=', 'draft')]}"
invisible="state == 'draft'"
/>
</group>
<group string="User Interface">
@@ -207,6 +225,12 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
</page>
</page>
<field name="group_ids" position="attributes">
<attribute
name="invisible"
>state not in ('draft', 'sql_valid')</attribute>
</field>
</field>
</record>