diff --git a/bi_sql_editor/__manifest__.py b/bi_sql_editor/__manifest__.py index 1680e65a4..6b50c0cc8 100644 --- a/bi_sql_editor/__manifest__.py +++ b/bi_sql_editor/__manifest__.py @@ -5,17 +5,18 @@ { "name": "BI SQL Editor", "summary": "BI Views builder, based on Materialized or Normal SQL Views", - "version": "15.0.1.0.2", + "version": "16.0.1.0.2", "license": "AGPL-3", "category": "Reporting", "author": "GRAP,Odoo Community Association (OCA)", "website": "https://github.com/OCA/reporting-engine", - "depends": ["base", "sql_request_abstract"], + "depends": [ + "spreadsheet_dashboard", + "sql_request_abstract", + ], "data": [ "security/ir.model.access.csv", "views/view_bi_sql_view.xml", - "views/action.xml", - "views/menu.xml", ], "demo": ["demo/res_groups_demo.xml", "demo/bi_sql_view_demo.xml"], "installable": True, diff --git a/bi_sql_editor/demo/bi_sql_view_demo.xml b/bi_sql_editor/demo/bi_sql_view_demo.xml index f5a2efe41..d9cc095b6 100644 --- a/bi_sql_editor/demo/bi_sql_view_demo.xml +++ b/bi_sql_editor/demo/bi_sql_view_demo.xml @@ -11,10 +11,10 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +SELECT * +FROM unexisting_table +ORDER BY unexisting_field +]]> @@ -23,13 +23,13 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +SELECT + name as x_name, + street as x_street, + company_id as x_company_id +FROM res_partner +ORDER BY name +]]> @@ -39,14 +39,14 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +SELECT + name as x_name, + case + when author ilike '%OpenERP SA%' THEN 'Odoo SA' + when author ilike '%Odoo Community Association (OCA)%' THEN 'OCA' + else 'Undefined Author' END as x_author_type +FROM ir_module_module +]]> , 2017 msgid "" msgstr "" -"Project-Id-Version: Odoo Server 9.0c\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-31 11:56+0000\n" -"PO-Revision-Date: 2017-08-31 11:56+0000\n" -"Last-Translator: OCA Transbot , 2017\n" -"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" -"Language: fr\n" +"POT-Creation-Date: 2022-10-26 11:45+0000\n" +"PO-Revision-Date: 2022-10-26 11:45+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" -"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:0 #, python-format -msgid "%m/%d/%Y %H:%M:%S UTC" -msgstr "%d/%m/%Y %H:%M:%S UTC" +msgid "%(model_name)s Access %(full_name)s" +msgstr "" #. module: bi_sql_editor #: code:addons/bi_sql_editor/models/bi_sql_view.py:0 @@ -30,12 +27,6 @@ msgstr "%d/%m/%Y %H:%M:%S UTC" msgid "%s (Copy)" msgstr "%s (Copie)" -#. module: bi_sql_editor -#: code:addons/bi_sql_editor/models/bi_sql_view.py:0 -#, python-format -msgid "%s Access %s" -msgstr "%s Accès %s" - #. module: bi_sql_editor #: code:addons/bi_sql_editor/models/bi_sql_view.py:0 #, python-format @@ -45,17 +36,15 @@ msgstr "Accès %s" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__action_context msgid "Action Context" -msgstr "" +msgstr "Contexte de l'action" #. module: bi_sql_editor #: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form -#, fuzzy msgid "Action Settings" msgstr "Options de Sélection" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__group_ids -#: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form msgid "Allowed Groups" msgstr "Groupes autorisés" @@ -79,24 +68,35 @@ msgstr "" msgid "Available" msgstr "Disponible" +#. module: bi_sql_editor +#: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__group_operator__avg +msgid "Average" +msgstr "Moyenne" + #. module: bi_sql_editor #: model:ir.model,name:bi_sql_editor.model_bi_sql_view -#, fuzzy msgid "BI SQL View" msgstr "Vue SQL" #. module: bi_sql_editor #: model:ir.model,name:bi_sql_editor.model_bi_sql_view_field -#, fuzzy msgid "Bi SQL View Field" msgstr "Champs SQL" +#. module: bi_sql_editor +#: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view_field__group_operator +msgid "" +"By default, Odoo will sum the values when grouping. If you wish to alter the" +" behaviour, choose an alternate Group Operator" +msgstr "" + #. module: bi_sql_editor #: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view_field__is_group_by 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" +"Cochez cette case pour créer une option 'Grouper Par' sur la vue de " +"recherche" #. module: bi_sql_editor #: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view_field__is_index @@ -121,14 +121,19 @@ msgstr "" "\"tree\"" #. module: bi_sql_editor -#: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form -msgid "Context" -msgstr "" +#: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__computed_action_context +msgid "Computed Action Context" +msgstr "Contexte calculé de l'action" #. module: bi_sql_editor #: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form -msgid "Create SQL View, Indexes and Models" -msgstr "Créer la vue SQL, les index et les modèles" +msgid "Computed Context" +msgstr "Contexte calculé" + +#. module: bi_sql_editor +#: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form +msgid "Create SQL Elements" +msgstr "Créer les éléments SQL" #. module: bi_sql_editor #: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form @@ -152,6 +157,11 @@ msgstr "Créé le" msgid "Cron Task that will refresh the materialized view" msgstr "Tâche CRON qui va rafraichir la vue matérialisée" +#. module: bi_sql_editor +#: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form +msgid "Custom Context" +msgstr "Contexte personnalisé" + #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__size msgid "Database Size" @@ -160,24 +170,21 @@ msgstr "Taille de la base de données" #. module: bi_sql_editor #: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view__action_context msgid "" -"Define here a context that will be used by default, when creating the action." +"Define here a context that will be used by default, when creating the " +"action." msgstr "" +"Definir ici un contexte qui sera utillisé par défault, lors de la création de l'action." #. module: bi_sql_editor #: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view__domain_force 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)]." +" 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 "" "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)]." +" 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 #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__display_name @@ -205,6 +212,11 @@ msgstr "Description du champ" msgid "Field Type" msgstr "Type de champ" +#. module: bi_sql_editor +#: model:ir.model,name:bi_sql_editor.model_ir_model_fields +msgid "Fields" +msgstr "Champs" + #. module: bi_sql_editor #: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view_field__many2one_model_id msgid "" @@ -218,13 +230,10 @@ msgstr "" #: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view_field__selection 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')]" +" List of options, specified as a Python expression defining a list of (key, label) pairs. For example: [('blue','Blue'), ('yellow','Yellow')]" 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')]" +" 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 #: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view__model_name @@ -242,27 +251,31 @@ msgid "Graph Type" msgstr "Type de Graphe" #. module: bi_sql_editor -#: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__has_group_changed -#, fuzzy -msgid "Has Group Changed" -msgstr "A un changement de groupe" +#: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view_field__group_operator +msgid "Group Operator" +msgstr "Opérateur de groupe" #. module: bi_sql_editor -#: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__tree_visibility__hidden -msgid "Hidden" -msgstr "Caché" +#: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__has_group_changed +msgid "Has Group Changed" +msgstr "A un changement de groupe" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__id #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view_field__id msgid "ID" -msgstr "ID" +msgstr "" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view_field__index_name msgid "Index Name" msgstr "Nom de l'index" +#. module: bi_sql_editor +#: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__tree_visibility__invisible +msgid "Invisible" +msgstr "" + #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view_field__is_group_by msgid "Is Group by" @@ -298,15 +311,24 @@ msgstr "Dernière mise à jour le" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__materialized_text -#, fuzzy msgid "Materialized Text" -msgstr "Materialized text" +msgstr "Texte materialisé" + +#. module: bi_sql_editor +#: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__group_operator__max +msgid "Maximum" +msgstr "" #. module: bi_sql_editor #: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__graph_type__measure msgid "Measure" msgstr "Mesure" +#. module: bi_sql_editor +#: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__group_operator__min +msgid "Minimum" +msgstr "" + #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view_field__many2one_model_id #: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form @@ -367,7 +389,7 @@ msgstr "Vue Pivot de Odoo" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__rule_id msgid "Odoo Rule" -msgstr "Odoo Rule" +msgstr "Règle Odoo" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__search_view_id @@ -391,16 +413,25 @@ msgid "Open View" msgstr "Ouvrir la vue" #. module: bi_sql_editor -#: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form -#, fuzzy -msgid "Preview SQL Expression" -msgstr "Valider l'expression SQL" +#: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__tree_visibility__optional_hide +msgid "Optional (hidden)" +msgstr "Optionelle (cachée)" + +#. module: bi_sql_editor +#: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__tree_visibility__optional_show +msgid "Optional (shown)" +msgstr "Optionelle (affiché)" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__query msgid "Query" msgstr "Requête" +#. module: bi_sql_editor +#: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form +msgid "Refresh" +msgstr "Rafraichir" + #. module: bi_sql_editor #: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form msgid "Refresh Materialized View" @@ -426,11 +457,11 @@ msgstr "Définition de règle" #: code:addons/bi_sql_editor/models/bi_sql_view.py:0 #, python-format msgid "" -"SQL Error while creating %s VIEW %s :\n" -" %s" -msgstr "" -"Erreur SQL lors de la création de %s VIEW %s :\n" -" %s" +"SQL Error while creating %(materialized_text)s VIEW %(view_name)s :\n" +" %(error)s" +msgstr "" +"Erreur SQL lors de la création de la vue matérialisée %(materialized_text)s VIEW %(view_name)s :\n" +" %(error)s" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__bi_sql_view_field_ids @@ -438,28 +469,21 @@ msgstr "" msgid "SQL Fields" msgstr "Champs SQL" -#. module: bi_sql_editor -#: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form -msgid "SQL Query" -msgstr "Requête SQL" - #. module: bi_sql_editor #: model:ir.ui.menu,name:bi_sql_editor.menu_bi_sql_editor msgid "SQL Reports" -msgstr "SQL Reports" +msgstr "Rapports SQL" #. module: bi_sql_editor #: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view__query 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" +" * 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 "" "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" +" * 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_';" @@ -489,11 +513,6 @@ msgstr "Vue SQL et Modèle créés" msgid "SQL Views" msgstr "Vues SQL" -#. module: bi_sql_editor -#: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form -msgid "Security" -msgstr "Sécurité" - #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view_field__selection msgid "Selection Options" @@ -529,12 +548,19 @@ msgstr "" #: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view__technical_name msgid "" "Suffix of the SQL view. SQL full name will be computed and prefixed by " -"'x_bi_sql_view_'. Syntax should follow: https://www.postgresql.org/docs/" -"current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS" +"'x_bi_sql_view_'. Syntax should follow: " +"https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-" +"SYNTAX-IDENTIFIERS" msgstr "" "Suffixe de la vue SQL. Le nom SQL complet sera calculé et préfixé par " -"'x_bi_sql_view_'. La syntaxe doit suivre : https://www.postgresql.org/docs/" -"current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS" +"'x_bi_sql_view_'. La syntaxe doit suivre : " +"https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-" +"SYNTAX-IDENTIFIERS" + +#. module: bi_sql_editor +#: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__group_operator__sum +msgid "Sum" +msgstr "Somme" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__technical_name @@ -570,13 +596,13 @@ msgstr "Visibilité dans la liste" #. module: bi_sql_editor #: model:ir.model.fields,help:bi_sql_editor.field_bi_sql_view_field__ttype msgid "" -"Type of the 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 " +"Type of the 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" msgstr "" "Type du champs Odoo qui sera créé. Garder vide si vous ne souhaitez pas " -"créer un nouveau champ. Si vide, ce champ ne sera pas affiché et ne sera pas " -"disponible pour les fonctions de recherche et de regroupement" +"créer un nouveau champ. Si vide, ce champ ne sera pas affiché et ne sera pas" +" disponible pour les fonctions de recherche et de regroupement" #. module: bi_sql_editor #: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__tree_visibility__unavailable @@ -585,7 +611,6 @@ msgstr "Indisponible" #. module: bi_sql_editor #: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form -#, fuzzy msgid "Update Model Access" msgstr "Mettre à jour les accès au modèle" @@ -595,19 +620,14 @@ 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" +"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 #: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form msgid "User Interface" msgstr "Interface utilisateur" -#. module: bi_sql_editor -#: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form -msgid "Validate SQL Expression" -msgstr "Valider l'expression SQL" - #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__view_name msgid "View Name" @@ -626,86 +646,60 @@ msgstr "Vues, Actions et menus créés" #. module: bi_sql_editor #: code:addons/bi_sql_editor/models/bi_sql_view.py:0 #: code:addons/bi_sql_editor/models/bi_sql_view_field.py:0 -#, fuzzy, python-format +#, python-format msgid "You can not create indexes on non materialized views" msgstr "Tâche CRON qui va rafraichir la vue matérialisée" -#. module: bi_sql_editor -#: code:addons/bi_sql_editor/models/bi_sql_view.py:0 -#, python-format -msgid "You can only process this action on SQL Valid items" -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:0 #, python-format msgid "" "You can only unlink draft views.If you want to delete them, first set them " "to draft." -msgstr "" +msgstr "Vous pouvez seulement supprimer des vues en brouillon. Si vous voulez les supprimer, veuillez le repasser à l'état de brouillon auparavant" #. module: bi_sql_editor #: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__ttype__boolean msgid "boolean" -msgstr "boolean" +msgstr "" #. module: bi_sql_editor #: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__ttype__char msgid "char" -msgstr "char" +msgstr "" #. module: bi_sql_editor #: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__ttype__date msgid "date" -msgstr "date" +msgstr "" #. module: bi_sql_editor #: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__ttype__datetime msgid "datetime" -msgstr "datetime" +msgstr "" #. module: bi_sql_editor #: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__ttype__float msgid "float" -msgstr "float" +msgstr "" #. module: bi_sql_editor #: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__ttype__integer msgid "integer" -msgstr "integer" +msgstr "" #. module: bi_sql_editor #: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__ttype__many2one msgid "many2one" -msgstr "many2one" +msgstr "" #. module: bi_sql_editor #: model:ir.model.fields.selection,name:bi_sql_editor.selection__bi_sql_view_field__ttype__selection msgid "selection" -msgstr "selection" +msgstr "" #. module: bi_sql_editor #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view__sequence #: model:ir.model.fields,field_description:bi_sql_editor.field_bi_sql_view_field__sequence msgid "sequence" -msgstr "sequence" - -#. module: bi_sql_editor -#: model_terms:ir.ui.view,arch_db:bi_sql_editor.view_bi_sql_view_form -msgid "this will refresh the materialized view" -msgstr "Cela va rafraichir la vue matérialisée" - -#~ msgid "Draft" -#~ msgstr "Brouillon" - -#~ msgid "SQL Valid" -#~ msgstr "SQL Validé" - -#~ msgid "bi.sql.view" -#~ msgstr "bi.sql.view" - -#~ msgid "bi.sql.view.field" -#~ msgstr "bi.sql.view.field" - -#~ msgid "You can only unlink draft views" -#~ msgstr "Vous pouvez seulement supprimer des vues en brouillon" +msgstr "Séquence" diff --git a/bi_sql_editor/models/bi_sql_view.py b/bi_sql_editor/models/bi_sql_view.py index a09f6ff83..9343815c7 100644 --- a/bi_sql_editor/models/bi_sql_view.py +++ b/bi_sql_editor/models/bi_sql_view.py @@ -117,8 +117,6 @@ class BiSQLView(models.Model): }, ) - has_group_changed = fields.Boolean(copy=False) - bi_sql_view_field_ids = fields.One2many( string="SQL Fields", comodel_name="bi.sql.view.field", @@ -203,6 +201,11 @@ class BiSQLView(models.Model): ): action["pivot_measures"].append(field.name) + # If no measure are defined, we display by default the count + # of the element, to avoid an empty view + if not action["pivot_measures"]: + action["pivot_measures"] = ["__count__"] + for field in rec.bi_sql_view_field_ids.filtered( lambda x: x.graph_type == "row" ): @@ -238,14 +241,9 @@ class BiSQLView(models.Model): sql_view.technical_name, ) - @api.onchange("group_ids") - def onchange_group_ids(self): - if self.state not in ("draft", "sql_valid"): - self.has_group_changed = True - # Overload Section def write(self, vals): - res = super(BiSQLView, self).write(vals) + res = super().write(vals) if vals.get("sequence", False): for rec in self.filtered(lambda x: x.menu_id): rec.menu_id.sequence = rec.sequence @@ -260,7 +258,7 @@ class BiSQLView(models.Model): ) ) self.cron_id.unlink() - return super(BiSQLView, self).unlink() + return super().unlink() def copy(self, default=None): self.ensure_one() @@ -271,7 +269,7 @@ class BiSQLView(models.Model): "technical_name": "%s_copy" % self.technical_name, } ) - return super(BiSQLView, self).copy(default=default) + return super().copy(default=default) # Action Section def button_create_sql_view_and_model(self): @@ -313,7 +311,6 @@ class BiSQLView(models.Model): # Drop ORM sql_view._drop_model_and_fields() - sql_view.has_group_changed = False super(BiSQLView, sql_view).button_set_draft() return True @@ -636,7 +633,7 @@ class BiSQLView(models.Model): the database structure is done, to know fields type.""" self.ensure_one() sql_view_field_obj = self.env["bi.sql.view.field"] - columns = super(BiSQLView, self)._check_execution() + columns = super()._check_execution() field_ids = [] for column in columns: existing_field = self.bi_sql_view_field_ids.filtered( diff --git a/bi_sql_editor/models/bi_sql_view_field.py b/bi_sql_editor/models/bi_sql_view_field.py index 785fc0cd4..d37e04cc6 100644 --- a/bi_sql_editor/models/bi_sql_view_field.py +++ b/bi_sql_editor/models/bi_sql_view_field.py @@ -32,7 +32,9 @@ class BiSQLViewField(models.Model): _TREE_VISIBILITY_SELECTION = [ ("unavailable", "Unavailable"), - ("hidden", "Hidden"), + ("invisible", "Invisible"), + ("optional_hide", "Optional (hidden)"), + ("optional_show", "Optional (shown)"), ("available", "Available"), ] @@ -91,7 +93,8 @@ class BiSQLViewField(models.Model): ) field_description = fields.Char( - help="This will be used as the name" " of the Odoo field, displayed for users", + help="This will be used as the name of the Odoo field, displayed for users", + required=True, ) ttype = fields.Selection( @@ -142,41 +145,42 @@ class BiSQLViewField(models.Model): ) # Overload Section - @api.model - def create(self, vals): - field_without_prefix = vals["name"][2:] - # guess field description - field_description = re.sub( - r"\w+", - lambda m: m.group(0).capitalize(), - field_without_prefix.replace("_id", "").replace("_", " "), - ) - - # Guess ttype - # Don't execute as simple .get() in the dict to manage - # correctly the type 'character varying(x)' - ttype = False - for k, v in self._SQL_MAPPING.items(): - if k in vals["sql_type"]: - ttype = v - - # Guess many2one_model_id - many2one_model_id = False - if vals["sql_type"] == "integer" and (vals["name"][-3:] == "_id"): - ttype = "many2one" - model_name = self._model_mapping().get(field_without_prefix, "") - many2one_model_id = ( - self.env["ir.model"].search([("model", "=", model_name)]).id + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + field_without_prefix = vals["name"][2:] + # guess field description + field_description = re.sub( + r"\w+", + lambda m: m.group(0).capitalize(), + field_without_prefix.replace("_id", "").replace("_", " "), ) - vals.update( - { - "ttype": ttype, - "field_description": field_description, - "many2one_model_id": many2one_model_id, - } - ) - return super(BiSQLViewField, self).create(vals) + # Guess ttype + # Don't execute as simple .get() in the dict to manage + # correctly the type 'character varying(x)' + ttype = False + for k, v in self._SQL_MAPPING.items(): + if k in vals["sql_type"]: + ttype = v + + # Guess many2one_model_id + many2one_model_id = False + if vals["sql_type"] == "integer" and (vals["name"][-3:] == "_id"): + ttype = "many2one" + model_name = self._model_mapping().get(field_without_prefix, "") + many2one_model_id = ( + self.env["ir.model"].search([("model", "=", model_name)]).id + ) + + vals.update( + { + "ttype": ttype, + "field_description": field_description, + "many2one_model_id": many2one_model_id, + } + ) + return super().create(vals) # Custom Section @api.model @@ -217,45 +221,39 @@ class BiSQLViewField(models.Model): def _prepare_tree_field(self): self.ensure_one() - res = "" - if self.field_description and self.tree_visibility != "unavailable": - res = """""".format( - self.name, self.tree_visibility == "hidden" and 'invisible="1"' or "" - ) - return res + if self.tree_visibility == "unavailable": + return "" + visibility_text = "" + if self.tree_visibility == "invisible": + visibility_text = 'invisible="1"' + elif self.tree_visibility == "optional_hide": + visibility_text = 'option="hide"' + elif self.tree_visibility == "optional_show": + visibility_text = 'option="show"' + + return f"""\n""" def _prepare_graph_field(self): self.ensure_one() - res = "" - if self.graph_type and self.field_description: - res = """\n""".format( - self.name, self.graph_type - ) - return res + if not self.graph_type: + return "" + return f"""\n""" def _prepare_pivot_field(self): self.ensure_one() - res = "" - if self.field_description: - graph_type_text = self.graph_type and 'type="%s"' % (self.graph_type) or "" - res = """\n""".format(self.name, graph_type_text) - return res + graph_type_text = self.graph_type and f'type="{self.graph_type}"' or "" + return f"""\n""" def _prepare_search_field(self): self.ensure_one() - res = "" - if self.field_description: - res = """\n""".format(self.name) - return res + return """\n""".format(self.name) def _prepare_search_filter_field(self): self.ensure_one() - res = "" - if self.field_description and self.is_group_by: - res = """\n""" % ( - self.name, - self.field_description, - self.name, - ) - return res + if not self.is_group_by: + return "" + return ( + f"""\n""" + ) diff --git a/bi_sql_editor/readme/CONFIGURE.rst b/bi_sql_editor/readme/CONFIGURE.rst index fee3c6740..8d4492eaa 100644 --- a/bi_sql_editor/readme/CONFIGURE.rst +++ b/bi_sql_editor/readme/CONFIGURE.rst @@ -1,6 +1,4 @@ -To configure this module, you need to: - -* Go to Settings / Technical / Database Structure / SQL Views +* Go to Dashboard / Configuration / SQL Views * tip your SQL request @@ -12,7 +10,13 @@ To configure this module, you need to: .. figure:: ../static/description/02_security_access.png :width: 800 px -* Click on the button 'Clean and Check Request' +Optionnaly, you can add a domain. + +A tipical domain in a multi company context is to write +``['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]`` +to make reporting depending on the current companies of the user. + +* Click on the button 'Validate SQL Expression' * 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 @@ -22,7 +26,7 @@ To configure this module, you need to: .. figure:: ../static/description/03_field_mapping.png :width: 800 px -* Click on the button 'Create SQL View, Indexes and Models'. (this step could +* Click on the button 'Create SQL elements'. (this step could take a while, if view is materialized) * If it's a MATERIALIZED view: diff --git a/bi_sql_editor/readme/DESCRIPTION.rst b/bi_sql_editor/readme/DESCRIPTION.rst index 33d6b20e8..d232d115a 100644 --- a/bi_sql_editor/readme/DESCRIPTION.rst +++ b/bi_sql_editor/readme/DESCRIPTION.rst @@ -16,6 +16,7 @@ You can specify extra groups that have the right to access to a specific view. Warning ------- + This module is intended for technician people in a company and for Odoo integrators. It requires the user to know SQL syntax and Odoo models. diff --git a/bi_sql_editor/readme/INSTALL.rst b/bi_sql_editor/readme/INSTALL.rst deleted file mode 100644 index 6ccbf3b4c..000000000 --- a/bi_sql_editor/readme/INSTALL.rst +++ /dev/null @@ -1,2 +0,0 @@ -* You must put this module as `server_wide_modules` in your odoo configuration file - or add '--load=bi_sql_editor' if you start odoo in command line. diff --git a/bi_sql_editor/readme/USAGE.rst b/bi_sql_editor/readme/USAGE.rst index d3ce1491e..7e19c0efc 100644 --- a/bi_sql_editor/readme/USAGE.rst +++ b/bi_sql_editor/readme/USAGE.rst @@ -1,13 +1,10 @@ To use this module, you need to: -#. Go to 'Reporting' / 'Custom Reports' +#. Go to 'Dashboards > SQL Reports' #. Select the desired report .. figure:: ../static/description/05_reporting_pivot.png :width: 800 px -* You can switch to 'Pie' chart or 'Line Chart' as any report, - - .. figure:: ../static/description/05_reporting_pie.png - :width: 800 px +* You can switch to 'Graph' or 'tree' views as any report. diff --git a/bi_sql_editor/static/description/01_sql_request.png b/bi_sql_editor/static/description/01_sql_request.png index 118150e32..bd631c601 100644 Binary files a/bi_sql_editor/static/description/01_sql_request.png and b/bi_sql_editor/static/description/01_sql_request.png differ diff --git a/bi_sql_editor/static/description/02_security_access.png b/bi_sql_editor/static/description/02_security_access.png index fb717b91f..975e677a8 100644 Binary files a/bi_sql_editor/static/description/02_security_access.png and b/bi_sql_editor/static/description/02_security_access.png differ diff --git a/bi_sql_editor/static/description/03_field_mapping.png b/bi_sql_editor/static/description/03_field_mapping.png index 08a8770f6..74c2e8acd 100644 Binary files a/bi_sql_editor/static/description/03_field_mapping.png and b/bi_sql_editor/static/description/03_field_mapping.png differ diff --git a/bi_sql_editor/static/description/04_materialized_view_setting.png b/bi_sql_editor/static/description/04_materialized_view_setting.png index bcb25c013..d751a0a98 100644 Binary files a/bi_sql_editor/static/description/04_materialized_view_setting.png and b/bi_sql_editor/static/description/04_materialized_view_setting.png differ diff --git a/bi_sql_editor/static/description/05_reporting_pie.png b/bi_sql_editor/static/description/05_reporting_pie.png deleted file mode 100644 index 1ec4ac0c1..000000000 Binary files a/bi_sql_editor/static/description/05_reporting_pie.png and /dev/null differ diff --git a/bi_sql_editor/static/description/05_reporting_pivot.png b/bi_sql_editor/static/description/05_reporting_pivot.png index c4c0a36cd..5b131585b 100644 Binary files a/bi_sql_editor/static/description/05_reporting_pivot.png and b/bi_sql_editor/static/description/05_reporting_pivot.png differ diff --git a/bi_sql_editor/static/description/06_action_datetime_name.png b/bi_sql_editor/static/description/06_action_datetime_name.png deleted file mode 100644 index 354994e52..000000000 Binary files a/bi_sql_editor/static/description/06_action_datetime_name.png and /dev/null differ diff --git a/bi_sql_editor/static/description/main_screenshot.png b/bi_sql_editor/static/description/main_screenshot.png deleted file mode 100644 index 71c2984fe..000000000 Binary files a/bi_sql_editor/static/description/main_screenshot.png and /dev/null differ diff --git a/bi_sql_editor/views/action.xml b/bi_sql_editor/views/action.xml deleted file mode 100644 index 852770767..000000000 --- a/bi_sql_editor/views/action.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - SQL Views - ir.actions.act_window - bi.sql.view - tree,form - - diff --git a/bi_sql_editor/views/menu.xml b/bi_sql_editor/views/menu.xml deleted file mode 100644 index 00c540f0e..000000000 --- a/bi_sql_editor/views/menu.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/bi_sql_editor/views/view_bi_sql_view.xml b/bi_sql_editor/views/view_bi_sql_view.xml index 5da5235f4..f2dfc9d0e 100644 --- a/bi_sql_editor/views/view_bi_sql_view.xml +++ b/bi_sql_editor/views/view_bi_sql_view.xml @@ -5,215 +5,201 @@ Copyright (C) 2017 - Today: GRAP (http://www.grap.coop) License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> + bi.sql.view + + primary - + - + + - - + + bi.sql.view + + primary -
-
-
- -

- -

- - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + name="many2one_model_id" + attrs="{ + 'invisible': [('ttype', '!=', 'many2one')], + 'required': [('ttype', '=', 'many2one')], + }" + /> + + + + + + + + + + + + + + + + + + 1 + + + 1 + + + + name="computed_action_context" + nolabel="1" + colspan="2" + /> - + @@ -221,9 +207,9 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + name="model_id" + attrs="{'invisible': [('state', '=', 'draft')]}" + /> @@ -235,9 +221,32 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -
-
+ +
+ + + SQL Views + ir.actions.act_window + bi.sql.view + tree,form + + + + + + +