Browse Source

[ADD] create ui now create tree view

[IMP] fr translation
[IMP] add last refresh date time on the action name of each sql materialized view
pull/148/head
Sylvain LE GAL 7 years ago
committed by Nicolas Mac Rouillon
parent
commit
669168dd83
  1. 14
      bi_sql_editor/README.rst
  2. 303
      bi_sql_editor/i18n/fr.po
  3. 36
      bi_sql_editor/models/bi_sql_view.py
  4. 22
      bi_sql_editor/models/bi_sql_view_field.py
  5. BIN
      bi_sql_editor/static/description/06_action_datetime_name.png
  6. 7
      bi_sql_editor/views/view_bi_sql_view.xml

14
bi_sql_editor/README.rst

@ -114,17 +114,17 @@ Known issues / Roadmap
* Add 'interval', after type (row/col/measure) field for date(time) fields.
* Dynamically change displayed action name to mention the last refresh of the
materialized view.
* Create ir.rule to limit access. (for company_id for exemple)
Note
====
The syntax of the sql request has the following constrains:
* If the view is materialized, the name of the action will contain the date
and the time of it last refresh:
.. figure:: /bi_sql_editor/static/description/06_action_datetime_name.png
:width: 800 px
* the name of the selectable columns should be prefixed by `x_`
* The syntax of the sql request has the following constrains: the name of the
selectable columns should be prefixed by `x_`
Sample:

303
bi_sql_editor/i18n/fr.po

@ -1,42 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * bi_sql_editor
# * bi_sql_editor
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# Sébastien Alix <seb@usr-src.org>, 2017
# leemannd <denis.leemann@camptocamp.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-03 01:19+0000\n"
"PO-Revision-Date: 2017-06-03 01:19+0000\n"
"Last-Translator: leemannd <denis.leemann@camptocamp.com>, 2017\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"POT-Creation-Date: 2017-07-14 14:00+0000\n"
"PO-Revision-Date: 2017-07-14 14:00+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Plural-Forms: \n"
#. module: bi_sql_editor
#: code:addons/bi_sql_editor/models/bi_sql_view.py:151
#: code:addons/bi_sql_editor/models/bi_sql_view.py:515
#, python-format
msgid "%m/%d/%Y %H:%M:%S UTC"
msgstr "%d/%m/%Y %H:%M:%S UTC"
#. module: bi_sql_editor
#: code:addons/bi_sql_editor/models/bi_sql_view.py:155
#, python-format
msgid "%s (Copy)"
msgstr ""
msgstr "%s (Copie)"
#. module: bi_sql_editor
#: code:addons/bi_sql_editor/models/bi_sql_view.py:248
#: code:addons/bi_sql_editor/models/bi_sql_view.py:255
#, python-format
msgid "%s Access %s"
msgstr ""
msgstr "%s Accès %s"
#. module: bi_sql_editor
#: code:addons/bi_sql_editor/models/bi_sql_view.py:274
#: code:addons/bi_sql_editor/models/bi_sql_view.py:281
#, python-format
msgid "Access %s"
msgstr ""
msgstr "Accès %s"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
@ -51,70 +52,73 @@ msgstr "Utilisateurs Autorisés"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid ""
"Are you sure you want to set to draft this SQL View. It will delete"
" the materialized view, and all the previous"
" mapping realized with the columns"
msgstr ""
msgid "Are you sure you want to set to draft this SQL View. It will delete the materialized view, and all the previous mapping realized with the columns"
msgstr "Etes vous sur de vouloir remettre la Vue SQL en brouillon. Cela supprimera la vue (matérialisée), et tout le mapping préalablement réalisé sur les colonnes"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,tree_visibility:0
msgid "Available"
msgstr "Disponible"
#. module: bi_sql_editor
#: help:bi.sql.view.field,is_group_by:0
msgid ""
"Check this box if you want to create a 'group by' option in the search view"
msgstr ""
msgid "Check this box if you want to create a 'group by' option in the search view"
msgstr "Cochez cette case pour créer une option 'Grouper Par' sur la vue de recherche"
#. module: bi_sql_editor
#: help:bi.sql.view.field,is_index:0
msgid ""
"Check this box if you want to create an index on that field. This is "
"recommended for searchable and groupable fields, to reduce duration"
msgstr ""
msgid "Check this box if you want to create an index on that field. This is recommended for searchable and groupable fields, to reduce duration"
msgstr "Cochez cette case pour créer un index SQL sur ce champ. Cela est recommandé pour les champs de recherche et de regroupement pour réduire le temps d'affichage."
#. module: bi_sql_editor
#: selection:bi.sql.view.field,graph_type:0
msgid "Column"
msgstr ""
msgstr "Colonne"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "Create SQL View, Indexes and Models"
msgstr ""
msgstr "Créer la vue SQL, les index et les modèles"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "Create UI"
msgstr ""
msgstr "Créer IU"
#. module: bi_sql_editor
#: field:bi.sql.view,create_uid:0 field:bi.sql.view.field,create_uid:0
#: field:bi.sql.view,create_uid:0
#: field:bi.sql.view.field,create_uid:0
msgid "Created by"
msgstr "Créé par"
#. module: bi_sql_editor
#: field:bi.sql.view,create_date:0 field:bi.sql.view.field,create_date:0
#: field:bi.sql.view,create_date:0
#: field:bi.sql.view.field,create_date:0
msgid "Created on"
msgstr "Créé le"
#. module: bi_sql_editor
#: help:bi.sql.view,cron_id:0
msgid "Cron Task that will refresh the materialized view"
msgstr ""
msgstr "Tâche CRON qui va rafraichir la vue matérialisée"
#. module: bi_sql_editor
#: field:bi.sql.view,size:0
msgid "Database Size"
msgstr ""
msgstr "Taille de la base de données"
#. module: bi_sql_editor
#: help:bi.sql.view,domain_force:0
msgid ""
"Define here access restriction to data.\n"
msgid "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)]."
msgstr ""
msgstr "Définir ici les règles de restrictions d'accès aux données.\n"
" Faite attention à utilliser des noms de champs préfixés par 'x_'. Un 'ir.rule' global sera créé. Une règle classique en multi-companie est, par exemple : \n"
" ['|', ('x_company_id','child_of', [user.company_id.id]),('x_company_id','=',False)]."
#. module: bi_sql_editor
#: field:bi.sql.view,display_name:0 field:bi.sql.view.field,display_name:0
#: field:bi.sql.view,display_name:0
#: field:bi.sql.view.field,display_name:0
msgid "Display Name"
msgstr "Nom à afficher"
@ -126,17 +130,17 @@ msgstr "Brouillon"
#. module: bi_sql_editor
#: field:bi.sql.view,domain_force:0
msgid "Extra Rule Definition"
msgstr ""
msgstr "Définition de règle complémentaire"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "Extras Information"
msgstr ""
msgstr "Information complémentaire"
#. module: bi_sql_editor
#: field:bi.sql.view.field,field_description:0
msgid "Field Description"
msgstr ""
msgstr "Description du champ"
#. module: bi_sql_editor
#: field:bi.sql.view.field,ttype:0
@ -145,45 +149,51 @@ msgstr "Type de champ"
#. module: bi_sql_editor
#: help:bi.sql.view.field,many2one_model_id:0
msgid ""
"For 'Many2one' Odoo field.\n"
msgid "For 'Many2one' Odoo field.\n"
" Co Model of the field."
msgstr ""
msgstr "Pour les champs Odoo 'Many2one'.\n"
" Modèle associé à ce champ."
#. module: bi_sql_editor
#: help:bi.sql.view.field,selection:0
msgid ""
"For 'Selection' Odoo field.\n"
msgid "For 'Selection' Odoo field.\n"
" List of options, specified as a Python expression defining a list of (key, label) pairs. For example: [('blue','Blue'), ('yellow','Yellow')]"
msgstr ""
msgstr "Pour les champs Odoo 'Selection'.\n"
" Liste des options, spécifié par une expression python, définition une liste de paires de (clé, valeur). Par exemple : [('blue','Blue'), ('yellow','Yellow')]"
#. module: bi_sql_editor
#: help:bi.sql.view,model_name:0
msgid "Full Qualified Name of the transient model that will be created."
msgstr ""
msgstr "Nom complet du modèle transiant qui sera créé."
#. module: bi_sql_editor
#: help:bi.sql.view,view_name:0
msgid "Full name of the SQL view"
msgstr ""
msgstr "Nom complet de la vue SQL"
#. module: bi_sql_editor
#: field:bi.sql.view.field,graph_type:0
msgid "Graph Type"
msgstr ""
msgstr "Type de Graphe"
#. module: bi_sql_editor
#: selection:bi.sql.view,state:0
msgid "Graph, action and Menu Created"
msgstr ""
msgstr "Graphique, Action et Menu créés"
#. module: bi_sql_editor
#: field:bi.sql.view,has_group_changed:0
msgid "Has group changed"
msgstr ""
msgstr "A un changement de groupe"
#. module: bi_sql_editor
#: field:bi.sql.view,id:0 field:bi.sql.view.field,id:0
#: selection:bi.sql.view.field,tree_visibility:0
msgid "Hidden"
msgstr "Caché"
#. module: bi_sql_editor
#: field:bi.sql.view,id:0
#: field:bi.sql.view.field,id:0
msgid "ID"
msgstr "ID"
@ -195,42 +205,45 @@ msgstr "Nom de l'index"
#. module: bi_sql_editor
#: field:bi.sql.view.field,is_group_by:0
msgid "Is Group by"
msgstr ""
msgstr "Est 'Grouper Par'"
#. module: bi_sql_editor
#: field:bi.sql.view.field,is_index:0
msgid "Is Index"
msgstr ""
msgstr "Est un index"
#. module: bi_sql_editor
#: field:bi.sql.view,is_materialized:0
msgid "Is Materialized View"
msgstr ""
msgstr "Est une vue matérialisée"
#. module: bi_sql_editor
#: field:bi.sql.view,__last_update:0 field:bi.sql.view.field,__last_update:0
#: field:bi.sql.view,__last_update:0
#: field:bi.sql.view.field,__last_update:0
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: bi_sql_editor
#: field:bi.sql.view,write_uid:0 field:bi.sql.view.field,write_uid:0
#: field:bi.sql.view,write_uid:0
#: field:bi.sql.view.field,write_uid:0
msgid "Last Updated by"
msgstr "Dernière mise à jour par"
#. module: bi_sql_editor
#: field:bi.sql.view,write_date:0 field:bi.sql.view.field,write_date:0
#: field:bi.sql.view,write_date:0
#: field:bi.sql.view.field,write_date:0
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
#. module: bi_sql_editor
#: field:bi.sql.view,materialized_text:0
msgid "Materialized text"
msgstr ""
msgstr "Materialized text"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,graph_type:0
msgid "Measure"
msgstr ""
msgstr "Mesure"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
@ -244,57 +257,63 @@ msgid "Model Name"
msgstr "Nom du modèle"
#. module: bi_sql_editor
#: field:bi.sql.view,name:0 field:bi.sql.view.field,name:0
#: field:bi.sql.view,name:0
#: field:bi.sql.view.field,name:0
msgid "Name"
msgstr "Nom"
#. module: bi_sql_editor
#: code:addons/bi_sql_editor/models/bi_sql_view.py:475
#: code:addons/bi_sql_editor/models/bi_sql_view.py:497
#, python-format
msgid ""
"No Column was found.\n"
msgid "No Column was found.\n"
"Columns name should be prefixed by 'x_'."
msgstr ""
msgstr "Aucune colonne n'a été trouvée.\n"
"Les noms de colonnes doivent être préfixés par 'x_'."
#. module: bi_sql_editor
#: field:bi.sql.view,action_id:0
msgid "Odoo Action"
msgstr ""
msgstr "Action Odoo"
#. module: bi_sql_editor
#: field:bi.sql.view,cron_id:0
msgid "Odoo Cron"
msgstr ""
msgstr "Cron Odoo"
#. module: bi_sql_editor
#: field:bi.sql.view,graph_view_id:0
msgid "Odoo Graph View"
msgstr ""
msgstr "Vue graphique Odoo"
#. module: bi_sql_editor
#: field:bi.sql.view,menu_id:0
msgid "Odoo Menu"
msgstr ""
msgstr "Menu Odoo"
#. module: bi_sql_editor
#: field:bi.sql.view,model_id:0
msgid "Odoo Model"
msgstr ""
msgstr "Modèle Odoo"
#. module: bi_sql_editor
#: field:bi.sql.view,rule_id:0
msgid "Odoo Rule"
msgstr ""
msgstr "Odoo Rule"
#. module: bi_sql_editor
#: field:bi.sql.view,search_view_id:0
msgid "Odoo Search View"
msgstr ""
msgstr "Vue de recherche Odoo"
#. module: bi_sql_editor
#: field:bi.sql.view,tree_view_id:0
msgid "Odoo Tree View"
msgstr "Vue Liste Odoo"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "Open View"
msgstr ""
msgstr "Ouvrir la vue"
#. module: bi_sql_editor
#: field:bi.sql.view,query:0
@ -304,66 +323,68 @@ msgstr "Requête"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "Refresh Materialized View"
msgstr ""
msgstr "Rafraichir la vue matérialisée"
#. module: bi_sql_editor
#: code:addons/bi_sql_editor/models/bi_sql_view.py:263
#: code:addons/bi_sql_editor/models/bi_sql_view.py:270
#, python-format
msgid "Refresh Materialized View %s"
msgstr ""
msgstr "Rafraichir la vue matérialisée %s"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,graph_type:0
msgid "Row"
msgstr ""
msgstr "Ligne"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "Rule Definition"
msgstr ""
msgstr "Définition de règle"
#. module: bi_sql_editor
#: code:addons/bi_sql_editor/models/bi_sql_view.py:358
#: code:addons/bi_sql_editor/models/bi_sql_view.py:380
#, python-format
msgid ""
"SQL Error while creating %s VIEW %s :\n"
msgid "SQL Error while creating %s VIEW %s :\n"
" %s"
msgstr "Erreur SQL lors de la création de %s VIEW %s :\n"
" %s"
msgstr ""
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
#: field:bi.sql.view,bi_sql_view_field_ids:0
msgid "SQL Fields"
msgstr ""
msgstr "Champs SQL"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "SQL Query"
msgstr ""
msgstr "Requête SQL"
#. module: bi_sql_editor
#: model:ir.ui.menu,name:bi_sql_editor.menu_bi_sql_editor
msgid "SQL Reports"
msgstr ""
msgstr "SQL Reports"
#. module: bi_sql_editor
#: help:bi.sql.view,query:0
msgid ""
"SQL Request that will be inserted as the view. Take care to :\n"
msgid "SQL Request that will be inserted as the view. Take care to :\n"
" * set a name for all your selected fields, specially if you use SQL function (like EXTRACT, ...);\n"
" * Do not use 'SELECT *' or 'SELECT table.*';\n"
" * prefix the name of the selectable columns by 'x_';"
msgstr ""
msgstr "Requête SQL qui sera insérée dans la vue SQL. Faire attention à :\n"
" * Mettre un nom (AS) pour tous les champs à afficher, spécialement si vous utilisez des fonctions SQL (comme EXTRACT, ...);\n"
" * Ne pas utiliser 'SELECT *' ou 'SELECT table.*';\n"
" * Préfixer le nom des colonnes à afficher par 'x_';"
#. module: bi_sql_editor
#: field:bi.sql.view.field,sql_type:0
msgid "SQL Type"
msgstr ""
msgstr "Type SQL"
#. module: bi_sql_editor
#: help:bi.sql.view.field,sql_type:0
msgid "SQL Type in the database"
msgstr ""
msgstr "Type SQL dans la base de données"
#. module: bi_sql_editor
#: selection:bi.sql.view,state:0
@ -373,18 +394,18 @@ msgstr "SQL Validé"
#. module: bi_sql_editor
#: field:bi.sql.view.field,bi_sql_view_id:0
msgid "SQL View"
msgstr ""
msgstr "Vue SQL"
#. module: bi_sql_editor
#: selection:bi.sql.view,state:0
msgid "SQL View and Model Created"
msgstr ""
msgstr "Vue SQL et Modèle créés"
#. module: bi_sql_editor
#: model:ir.actions.act_window,name:bi_sql_editor.action_bi_sql_view
#: model:ir.ui.menu,name:bi_sql_editor.menu_bi_sql_view
msgid "SQL Views"
msgstr ""
msgstr "Vues SQL"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
@ -394,7 +415,7 @@ msgstr "Sécurité"
#. module: bi_sql_editor
#: field:bi.sql.view.field,selection:0
msgid "Selection Options"
msgstr ""
msgstr "Options de Sélection"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
@ -404,32 +425,26 @@ msgstr "Remettre en brouillon"
#. module: bi_sql_editor
#: help:bi.sql.view,size:0
msgid "Size of the materialized view and its indexes"
msgstr ""
msgstr "Taille de la vue matérialisée et de ses index"
#. module: bi_sql_editor
#: field:bi.sql.view,state:0
msgid "State"
msgstr "Status"
msgstr "Statut"
#. module: bi_sql_editor
#: help:bi.sql.view,state:0
msgid ""
"State of the Request:\n"
msgid "State of the Request:\n"
" * 'Draft': Not tested\n"
" * 'SQL Valid': SQL Request has been checked and is valid"
msgstr ""
"Etat de la requête:\n"
msgstr "Etat de la requête:\n"
" * 'En brouillon': non testée\n"
" * 'SQL Validé': La requête SQL a été vérifiée et est valide"
#. module: bi_sql_editor
#: help:bi.sql.view,technical_name:0
msgid ""
"Suffix of the SQL view. (SQL full name will be computed and prefixed by "
"'x_bi_sql_view_'. Should have correctsyntax. For more information, see "
"https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-"
"SYNTAX-IDENTIFIERS"
msgstr ""
msgid "Suffix of the SQL view. (SQL full name will be computed and prefixed by 'x_bi_sql_view_'. Should have correctsyntax. For more information, see https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS"
msgstr "Suffixe de la requête SQL. (Le nom complet de la requête SQL sera calculé et préfixé par 'x_bi_sql_view_'. Should have correctsyntax. Pour plus d'information voir, https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS"
#. module: bi_sql_editor
#: field:bi.sql.view,technical_name:0
@ -439,113 +454,117 @@ msgstr "Nom technique"
#. module: bi_sql_editor
#: help:bi.sql.view.field,field_description:0
msgid "This will be used as the name of the Odoo field, displayed for users"
msgstr ""
msgstr "Cette valeur sera utilisée comme nom du champ odoo et sera affichée aux utilisateurs"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "This will create Odoo View, Action and Menu"
msgstr ""
msgstr "Cela va créer une vue Odoo, une action et un menu"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid ""
"This will try to create an SQL View, based on the SQL request and the "
"according Transient Model and fields, based on settings"
msgstr ""
msgid "This will try to create an SQL View, based on the SQL request and the according Transient Model and fields, based on settings"
msgstr "Cela va créer une vue SQL, basée sur la requête SQL et va créer le modèle transiant correspondant et les champs, basés sur le paramétrage"
#. module: bi_sql_editor
#: field:bi.sql.view.field,tree_visibility:0
msgid "Tree Visibility"
msgstr "Visibilité dans la liste"
#. module: bi_sql_editor
#: help:bi.sql.view.field,ttype:0
msgid ""
"Type of the Odoo field that will be created. Let 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"
msgstr ""
msgid "Type of the Odoo field that will be created. Let 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"
msgstr "Type du champ odoo qui sera créé. laisser vide si vous ne voulez pas créer un nouveau champ. Si la valeur est vide, le champ ne sera ni affiché, ni disponible pour les fonctions de rechercher ou de regroupement"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,tree_visibility:0
msgid "Unavailable"
msgstr "Indisponible"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid ""
"Update Model Access. Required if you changed groups list after having "
"created the model"
msgstr ""
msgid "Update Model Access. Required if you changed groups list after having created the model"
msgstr "Mettre à jour l'accès au modèle. Requis si vous changez la liste de groupes, après avoir créer le modèle"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "Update Model Acess"
msgstr ""
msgstr "Mettre à jour les accès au modèle"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "User Interface"
msgstr ""
msgstr "Interface utilisateur"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "Validate SQL Expression"
msgstr ""
msgstr "Valider l'expression SQL"
#. module: bi_sql_editor
#: field:bi.sql.view,view_name:0
msgid "View Name"
msgstr ""
msgstr "Nom de la vue"
#. module: bi_sql_editor
#: code:addons/bi_sql_editor/models/bi_sql_view.py:161
#: code:addons/bi_sql_editor/models/bi_sql_view.py:165
#, python-format
msgid "You can only process this action on SQL Valid items"
msgstr ""
msgstr "Vous pouvez seulement réaliser cette action sur des items SQL valides"
#. module: bi_sql_editor
#: code:addons/bi_sql_editor/models/bi_sql_view.py:143
#: code:addons/bi_sql_editor/models/bi_sql_view.py:147
#, python-format
msgid "You can only unlink draft views"
msgstr ""
msgstr "Vous pouvez seulement supprimer des vues en brouillon"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,ttype:0
msgid "boolean"
msgstr ""
msgstr "boolean"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,ttype:0
msgid "char"
msgstr ""
msgstr "char"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,ttype:0
msgid "date"
msgstr ""
msgstr "date"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,ttype:0
msgid "datetime"
msgstr ""
msgstr "datetime"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,ttype:0
msgid "float"
msgstr ""
msgstr "float"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,ttype:0
msgid "integer"
msgstr ""
msgstr "integer"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,ttype:0
msgid "many2one"
msgstr ""
msgstr "many2one"
#. module: bi_sql_editor
#: selection:bi.sql.view.field,ttype:0
msgid "selection"
msgstr ""
msgstr "selection"
#. module: bi_sql_editor
#: field:bi.sql.view.field,sequence:0
msgid "sequence"
msgstr ""
msgstr "sequence"
#. module: bi_sql_editor
#: view:bi.sql.view:bi_sql_editor.view_bi_sql_view_form
msgid "this will refresh the materialized view"
msgstr ""
msgstr "Cela va rafraichir la vue matérialisée"

36
bi_sql_editor/models/bi_sql_view.py

@ -4,6 +4,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from datetime import datetime
from psycopg2 import ProgrammingError
from openerp import _, api, fields, models, SUPERUSER_ID
@ -86,6 +87,9 @@ class BiSQLView(models.Model):
model_id = fields.Many2one(
string='Odoo Model', comodel_name='ir.model', readonly=True)
tree_view_id = fields.Many2one(
string='Odoo Tree View', comodel_name='ir.ui.view', readonly=True)
graph_view_id = fields.Many2one(
string='Odoo Graph View', comodel_name='ir.ui.view', readonly=True)
@ -186,8 +190,10 @@ class BiSQLView(models.Model):
# Drop ORM
sql_view._drop_model_and_fields()
sql_view.tree_view_id.unlink()
sql_view.graph_view_id.unlink()
sql_view.pivot_view_id.unlink()
sql_view.search_view_id.unlink()
sql_view.action_id.unlink()
sql_view.menu_id.unlink()
sql_view.rule_id.unlink()
@ -197,6 +203,8 @@ class BiSQLView(models.Model):
@api.multi
def button_create_ui(self):
self.tree_view_id = self.env['ir.ui.view'].create(
self._prepare_tree_view()).id
self.graph_view_id = self.env['ir.ui.view'].create(
self._prepare_graph_view()).id
self.pivot_view_id = self.env['ir.ui.view'].create(
@ -225,8 +233,7 @@ class BiSQLView(models.Model):
'type': 'ir.actions.act_window',
'res_model': self.model_id.model,
'search_view_id': self.search_view_id.id,
'view_type': 'form',
'view_mode': 'graph,pivot',
'view_mode': 'graph,pivot,tree',
}
# Prepare Function
@ -282,6 +289,21 @@ class BiSQLView(models.Model):
'global': True,
}
@api.multi
def _prepare_tree_view(self):
self.ensure_one()
return {
'name': self.name,
'type': 'tree',
'model': self.model_id.model,
'arch':
"""<?xml version="1.0"?>"""
"""<tree string="Analysis">{}"""
"""</tree>""".format("".join(
[x._prepare_tree_field()
for x in self.bi_sql_view_field_ids]))
}
@api.multi
def _prepare_graph_view(self):
self.ensure_one()
@ -339,8 +361,8 @@ class BiSQLView(models.Model):
'name': self.name,
'res_model': self.model_id.model,
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'graph,pivot',
'view_mode': 'graph,pivot,tree',
'view_id': self.graph_view_id.id,
'search_view_id': self.search_view_id.id,
}
@ -504,6 +526,12 @@ class BiSQLView(models.Model):
sql_view.materialized_text, sql_view.view_name)
self._log_execute(req)
sql_view._refresh_size()
if sql_view.action_id:
# Alter name of the action, to display last refresh datetime
# of the materialized view
sql_view.action_id.name = "%s (%s)" % (
self.name,
datetime.utcnow().strftime(_("%m/%d/%Y %H:%M:%S UTC")))
@api.multi
def _refresh_size(self):

22
bi_sql_editor/models/bi_sql_view_field.py

@ -29,6 +29,12 @@ class BiSQLViewField(models.Model):
('measure', 'Measure'),
]
_TREE_VISIBILITY_SELECTION = [
('unavailable', 'Unavailable'),
('hidden', 'Hidden'),
('available', 'Available'),
]
# Mapping to guess Odoo field type, from SQL column type
_SQL_MAPPING = {
'boolean': 'boolean',
@ -68,6 +74,10 @@ class BiSQLViewField(models.Model):
graph_type = fields.Selection(
string='Graph Type', selection=_GRAPH_TYPE_SELECTION)
tree_visibility = fields.Selection(
string='Tree Visibility', selection=_TREE_VISIBILITY_SELECTION,
default='available', required=True)
field_description = fields.Char(
string='Field Description', help="This will be used as the name"
" of the Odoo field, displayed for users")
@ -164,8 +174,20 @@ class BiSQLViewField(models.Model):
'selection': self.ttype == 'selection' and self.selection or False,
'relation': self.ttype == 'many2one' and
self.many2one_model_id.model or False,
'tree_visibility': self.field_description and
'available' or 'unavailable',
}
@api.multi
def _prepare_tree_field(self):
self.ensure_one()
res = ''
if self.field_description and self.tree_visibility != 'unavailable':
res = """<field name="{}" {}/>""".format(
self.name,
self.tree_visibility == 'hidden' and 'invisible="1"' or '')
return res
@api.multi
def _prepare_graph_field(self):
self.ensure_one()

BIN
bi_sql_editor/static/description/06_action_datetime_name.png

After

Width: 907  |  Height: 90  |  Size: 13 KiB

7
bi_sql_editor/views/view_bi_sql_view.xml

@ -10,7 +10,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<record id="view_bi_sql_view_tree" model="ir.ui.view">
<field name="model">bi.sql.view</field>
<field name="arch" type="xml">
<tree>
<tree colors="blue:state=='draft'; brown:state in ('sql_valid', 'model_valid')">
<field name="name"/>
<field name="technical_name"/>
<field name="size"/>
@ -28,8 +28,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
string="Validate SQL Expression" class="oe_highlight"/>
<button name="button_set_draft" type="object" states="sql_valid,model_valid,ui_valid"
string="Set to Draft" groups="sql_request_abstract.group_sql_request_manager"
confirm="Are you sure you want to set to draft this SQL View. It will delete
the materialized view, and all the previous mapping realized with the columns"/>
confirm="Are you sure you want to set to draft this SQL View. It will delete the materialized view, and all the previous mapping realized with the columns"/>
<button name="button_create_sql_view_and_model" type="object" states="sql_valid"
string="Create SQL View, Indexes and Models" 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"/>
@ -89,6 +88,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<field name="is_index" attrs="{'invisible': [('field_description', '=', False)]}"/>
<field name="is_group_by" attrs="{'invisible': [('field_description', '=', False)]}"/>
<field name="graph_type" attrs="{'invisible': [('field_description', '=', False)]}"/>
<field name="tree_visibility" attrs="{'invisible': [('field_description', '=', False)]}"/>
</tree>
</field>
</page>
@ -110,6 +110,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<field name="model_id" attrs="{'invisible': [('state', '=', 'draft')]}"/>
</group>
<group string="User Interface">
<field name="tree_view_id"/>
<field name="graph_view_id"/>
<field name="pivot_view_id"/>
<field name="search_view_id"/>

Loading…
Cancel
Save