From 4ee6138b4cd4607cc293ab1e5d5a651c60e43ca1 Mon Sep 17 00:00:00 2001 From: Carlos Roca Date: Wed, 17 Jul 2024 12:19:14 +0200 Subject: [PATCH 1/6] [IMP] spreadsheet*_oca: Add field to define name of table and restructure order of fields --- .../wizards/spreadsheet_spreadsheet_import.py | 2 +- .../static/src/spreadsheet/bundle/spreadsheet_action.esm.js | 1 + .../static/src/spreadsheet/pivot_controller.esm.js | 1 + spreadsheet_oca/wizards/spreadsheet_spreadsheet_import.py | 6 ++++-- spreadsheet_oca/wizards/spreadsheet_spreadsheet_import.xml | 6 +++++- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.py b/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.py index 6f90adf..9ba332e 100644 --- a/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.py +++ b/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.py @@ -12,7 +12,7 @@ class SpreadsheetSpreadsheetImport(models.TransientModel): def _insert_pivot_dashboard(self, new_sheet=False): import_data = self.import_data - import_data["name"] = self.name + import_data["name"] = self.name_data import_data["new_sheet"] = new_sheet return { "type": "ir.actions.client", diff --git a/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js b/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js index 0f3417e..45ebce8 100644 --- a/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js +++ b/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js @@ -187,6 +187,7 @@ export class ActionSpreadsheetOca extends Component { sortedColumn: this.import_data.metaData.sortedColumn, }, searchParams: this.import_data.searchParams, + name: this.import_data.name, }; const dataSource = spreadsheet_model.config.dataSources.add( dataSourceId, diff --git a/spreadsheet_oca/static/src/spreadsheet/pivot_controller.esm.js b/spreadsheet_oca/static/src/spreadsheet/pivot_controller.esm.js index f52040a..f0425b1 100644 --- a/spreadsheet_oca/static/src/spreadsheet/pivot_controller.esm.js +++ b/spreadsheet_oca/static/src/spreadsheet/pivot_controller.esm.js @@ -48,6 +48,7 @@ patch( { additionalContext: { default_name: this.model.metaData.title, + default_name_data: this.model.metaData.title, default_import_data: { mode: "pivot", metaData: JSON.parse(JSON.stringify(this.model.metaData)), diff --git a/spreadsheet_oca/wizards/spreadsheet_spreadsheet_import.py b/spreadsheet_oca/wizards/spreadsheet_spreadsheet_import.py index ca2f0dc..00dcda5 100644 --- a/spreadsheet_oca/wizards/spreadsheet_spreadsheet_import.py +++ b/spreadsheet_oca/wizards/spreadsheet_spreadsheet_import.py @@ -13,7 +13,8 @@ class SpreadsheetSpreadsheetImport(models.TransientModel): def _default_mode_id(self): return self.env["spreadsheet.spreadsheet.import.mode"].search([], limit=1).id - name = fields.Char(required=True) + name = fields.Char() + name_data = fields.Char() mode_id = fields.Many2one( "spreadsheet.spreadsheet.import.mode", required=True, @@ -35,6 +36,7 @@ def _insert_pivot_new(self): self._create_spreadsheet_vals() ) import_data = self.import_data + import_data["name"] = self.name_data import_data["new"] = 1 return { "type": "ir.actions.client", @@ -48,7 +50,7 @@ def _insert_pivot_new(self): def _insert_pivot_add(self, new_sheet=False): import_data = self.import_data - import_data["name"] = self.name + import_data["name"] = self.name_data import_data["new_sheet"] = new_sheet return { "type": "ir.actions.client", diff --git a/spreadsheet_oca/wizards/spreadsheet_spreadsheet_import.xml b/spreadsheet_oca/wizards/spreadsheet_spreadsheet_import.xml index 4d0e5db..e38ed06 100644 --- a/spreadsheet_oca/wizards/spreadsheet_spreadsheet_import.xml +++ b/spreadsheet_oca/wizards/spreadsheet_spreadsheet_import.xml @@ -12,8 +12,12 @@
- + + Date: Wed, 17 Jul 2024 12:20:58 +0200 Subject: [PATCH 2/6] [FIX] spreadsheet_dashboard_oca: Error with dashboard_sheet selected The error is happening because the dashboard where the data has to be added is not being showed. With this changes the field to define the dashboard is required and is showed. Added a way to limit the search to the dashboards that can be edited --- .../models/spreadsheet_dashboard.py | 26 +++++++++++++++++-- .../spreadsheet_spreadsheet_import.xml | 3 ++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py b/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py index 8752405..10cdfa8 100644 --- a/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py +++ b/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py @@ -4,7 +4,8 @@ import base64 import json -from odoo import api, fields, models +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError class SpreadsheetDashboard(models.Model): @@ -15,7 +16,7 @@ class SpreadsheetDashboard(models.Model): spreadsheet_raw = fields.Serialized( inverse="_inverse_spreadsheet_raw", compute="_compute_spreadsheet_raw" ) - can_edit = fields.Boolean(compute="_compute_can_edit") + can_edit = fields.Boolean(compute="_compute_can_edit", search="_search_can_edit") @api.depends("data") def _compute_spreadsheet_raw(self): @@ -42,3 +43,24 @@ def _compute_can_edit(self): ) if imd and imd.module != "__export__": record.can_edit = imd.noupdate + + @api.model + def _search_can_edit(self, operator, value): + if operator != "=": + raise NotImplementedError(_("Search operation not supported")) + if not isinstance(value, bool): + raise ValidationError(_("The value has to be a boolean")) + no_edit_ids = ( + self.env["ir.model.data"] + .search( + [ + ("model", "=", self._name), + ("module", "!=", "__export__"), + ("noupdate", "=", 0), + ] + ) + .mapped("res_id") + ) + if value: + return [("id", "not in", no_edit_ids)] + return [("id", "in", no_edit_ids)] diff --git a/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.xml b/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.xml index 0d036e1..b2486a6 100644 --- a/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.xml +++ b/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.xml @@ -16,7 +16,8 @@ From 8cef2fdcff4c386f225ce5430e648b2905e08e81 Mon Sep 17 00:00:00 2001 From: Carlos Roca Date: Thu, 18 Jul 2024 12:58:44 +0200 Subject: [PATCH 3/6] [IMP] spreadsheet_oca: Allow generate dynamic tables On dashboards exists tables that are updated dynamically, with this changes we have the option to generate this dynamic tables using the pivot inserter. Added a button to duplicate and change to dynamic table the selected table on spreadsheet editor. If a table with multiple row goups generated, the way to generate the dynamic table will be set the number of rows for each level of indentation. Example: 2 rowGroupBys 3 number of rows - val1 - subval1.1 - subval1.2 - subval1.3 - val2 - subval2.1 - subval2.2 - subval2.3 - val3 - subval3.1 - subval3.2 - subval3.3 --- .../wizards/spreadsheet_spreadsheet_import.py | 2 +- spreadsheet_oca/README.rst | 31 ++++++++ spreadsheet_oca/__manifest__.py | 2 + spreadsheet_oca/i18n/es.po | 57 ++++++++++++++- spreadsheet_oca/i18n/spreadsheet_oca.pot | 53 +++++++++++++- spreadsheet_oca/readme/USAGE.rst | 31 ++++++++ spreadsheet_oca/security/ir.model.access.csv | 1 + spreadsheet_oca/static/description/index.html | 66 +++++++++++++----- .../description/spreadsheet_dynamic_table.gif | Bin 0 -> 805120 bytes .../bundle/filter_panel_datasources.esm.js | 47 +++++++++++++ .../src/spreadsheet/bundle/spreadsheet.xml | 4 ++ .../bundle/spreadsheet_action.esm.js | 13 +++- .../src/spreadsheet/pivot_controller.esm.js | 2 +- .../utils/dynamic_row_generator.esm.js | 62 ++++++++++++++++ spreadsheet_oca/wizards/__init__.py | 1 + .../wizards/spreadsheet_select_row_number.py | 11 +++ .../wizards/spreadsheet_select_row_number.xml | 18 +++++ .../wizards/spreadsheet_spreadsheet_import.py | 15 +++- .../spreadsheet_spreadsheet_import.xml | 7 +- 19 files changed, 396 insertions(+), 27 deletions(-) create mode 100644 spreadsheet_oca/static/description/spreadsheet_dynamic_table.gif create mode 100644 spreadsheet_oca/static/src/spreadsheet/utils/dynamic_row_generator.esm.js create mode 100644 spreadsheet_oca/wizards/spreadsheet_select_row_number.py create mode 100644 spreadsheet_oca/wizards/spreadsheet_select_row_number.xml diff --git a/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.py b/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.py index 9ba332e..8c6aad6 100644 --- a/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.py +++ b/spreadsheet_dashboard_oca/wizards/spreadsheet_spreadsheet_import.py @@ -12,7 +12,7 @@ class SpreadsheetSpreadsheetImport(models.TransientModel): def _insert_pivot_dashboard(self, new_sheet=False): import_data = self.import_data - import_data["name"] = self.name_data + import_data["name"] = self.datasource_name import_data["new_sheet"] = new_sheet return { "type": "ir.actions.client", diff --git a/spreadsheet_oca/README.rst b/spreadsheet_oca/README.rst index a4d0886..0b9174c 100644 --- a/spreadsheet_oca/README.rst +++ b/spreadsheet_oca/README.rst @@ -73,6 +73,37 @@ Usage * ``ODOO.ACCOUNT.GROUP(type)``: Returns the account ids of a given group where type should be a value of the ``account_type`` field of ``account.account`` model. (``income``, ``asset_receivable``, etc.) +**Create a new dynamic spreadsheet from pivot** +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Go to any pivot +* Press on insert button +* Select the dynamic option and set a number of rows + +A new table that will be updated with the actual or filtered values will be added. + +* Note: When a pivot has multiple levels of aggrupations in the rows, the number of rows + selected will be transfered to each level. + + Example: + number of groups -> 2 + number of rows -> 3 + + * val1 + * subval1.1 + * subval1.2 + * subval1.3 + * val2 + * subval2.1 + * subval2.2 + * subval2.3 + * val3 + * subval3.1 + * subval3.2 + * subval3.3 + +Here is a visual exaple of use: +.. figure:: https://raw.githubusercontent.com/OCA/spreadsheet/16.0/spreadsheet_oca/static/description/spreadsheet_dynamic_table.gif + Development =========== diff --git a/spreadsheet_oca/__manifest__.py b/spreadsheet_oca/__manifest__.py index ebf3085..2bf65bd 100644 --- a/spreadsheet_oca/__manifest__.py +++ b/spreadsheet_oca/__manifest__.py @@ -15,6 +15,7 @@ "security/ir.model.access.csv", "views/spreadsheet_spreadsheet.xml", "data/spreadsheet_spreadsheet_import_mode.xml", + "wizards/spreadsheet_select_row_number.xml", "wizards/spreadsheet_spreadsheet_import.xml", ], "demo": ["demo/spreadsheet_spreadsheet.xml"], @@ -38,6 +39,7 @@ "spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js", "spreadsheet_oca/static/src/spreadsheet/bundle/chart_panels.esm.js", "spreadsheet_oca/static/src/spreadsheet/bundle/chart_panel.esm.js", + "spreadsheet_oca/static/src/spreadsheet/utils/dynamic_row_generator.esm.js", ], }, } diff --git a/spreadsheet_oca/i18n/es.po b/spreadsheet_oca/i18n/es.po index 8860850..691451c 100644 --- a/spreadsheet_oca/i18n/es.po +++ b/spreadsheet_oca/i18n/es.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-19 11:45+0000\n" -"PO-Revision-Date: 2024-06-19 14:07+0200\n" +"POT-Creation-Date: 2024-07-18 13:04+0000\n" +"PO-Revision-Date: 2024-07-18 15:06+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: es\n" @@ -137,6 +137,7 @@ msgstr "Crear hoja de cálculo" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__create_uid +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__create_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__create_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__create_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__create_uid @@ -145,6 +146,7 @@ msgstr "Creado por" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__create_date +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__create_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__create_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__create_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__create_date @@ -156,6 +158,11 @@ msgstr "Creado el" msgid "Data" msgstr "Datos" +#. module: spreadsheet_oca +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__datasource_name +msgid "Datasource Name" +msgstr "Nombre de datos" + #. module: spreadsheet_oca #. odoo-javascript #: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml:0 @@ -172,6 +179,7 @@ msgstr "Dimensiones" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__display_name +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__display_name #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__display_name #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__display_name #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__display_name @@ -192,6 +200,11 @@ msgstr "Dominio" msgid "Duplicated groupbys in pivot are not supprted" msgstr "Las agrupaciones duplicadas en la vista pivot no están soportadas" +#. module: spreadsheet_oca +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__dynamic +msgid "Dynamic" +msgstr "Dinámico" + #. module: spreadsheet_oca #: model_terms:ir.ui.view,arch_db:spreadsheet_oca.spreadsheet_spreadsheet_form_view #: model_terms:ir.ui.view,arch_db:spreadsheet_oca.spreadsheet_spreadsheet_tree_view @@ -231,6 +244,7 @@ msgstr "Agrupado por" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__id +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__id #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__id #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__id #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__id @@ -257,6 +271,13 @@ msgstr "Importar Pivot" msgid "Import data to spreadsheet" msgstr "Importar datos a hoja de cálculo" +#. module: spreadsheet_oca +#. odoo-javascript +#: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml:0 +#, python-format +msgid "Insert dynamic pivot" +msgstr "Insertar pivot dinámica" + #. module: spreadsheet_oca #. odoo-javascript #: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml:0 @@ -273,6 +294,7 @@ msgstr "Etiqueta" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision____last_update +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number____last_update #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet____last_update #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import____last_update #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode____last_update @@ -281,6 +303,7 @@ msgstr "Última modificación el" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__write_uid +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__write_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__write_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__write_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__write_uid @@ -289,6 +312,7 @@ msgstr "Última modificación por" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__write_date +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__write_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__write_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__write_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__write_date @@ -369,6 +393,12 @@ msgstr "Siguiente" msgid "Next Revision" msgstr "Siguiente revisión" +#. module: spreadsheet_oca +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__number_of_rows +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__number_of_rows +msgid "Number Of Rows" +msgstr "Número de filas" + #. module: spreadsheet_oca #: model_terms:ir.ui.view,arch_db:spreadsheet_oca.spreadsheet_spreadsheet_import_form_view msgid "OK" @@ -446,6 +476,18 @@ msgstr "Res" msgid "Save" msgstr "Guardar" +#. module: spreadsheet_oca +#: model:ir.model,name:spreadsheet_oca.model_spreadsheet_select_row_number +msgid "Select number of rows to duplicate row" +msgstr "Seleccione el número de filas a duplicar" + +#. module: spreadsheet_oca +#. odoo-javascript +#: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/filter_panel_datasources.esm.js:0 +#, python-format +msgid "Select the quantity of rows" +msgstr "Seleccione la cantidad de filas" + #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__sequence msgid "Sequence" @@ -505,6 +547,15 @@ msgstr "Hojas de cálculo" msgid "Stacked" msgstr "Apilados" +#. module: spreadsheet_oca +#: model:ir.model.fields,help:spreadsheet_oca.field_spreadsheet_spreadsheet_import__dynamic +msgid "" +"This field allows you to generate tables that are updated with the filters " +"set in the spreadsheets." +msgstr "" +"Este campo permite generar tablas que se actualizan con los filtros " +"establecidos en las hojas de cálculo." + #. module: spreadsheet_oca #. odoo-javascript #: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml:0 @@ -518,8 +569,8 @@ msgid "Type" msgstr "Tipo" #. module: spreadsheet_oca -#. odoo-python #. odoo-javascript +#. odoo-python #: code:addons/spreadsheet_oca/models/spreadsheet_spreadsheet.py:0 #: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml:0 #, python-format diff --git a/spreadsheet_oca/i18n/spreadsheet_oca.pot b/spreadsheet_oca/i18n/spreadsheet_oca.pot index c9cdf97..120bbc2 100644 --- a/spreadsheet_oca/i18n/spreadsheet_oca.pot +++ b/spreadsheet_oca/i18n/spreadsheet_oca.pot @@ -6,6 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-07-18 13:04+0000\n" +"PO-Revision-Date: 2024-07-18 13:04+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -137,6 +139,7 @@ msgstr "" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__create_uid +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__create_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__create_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__create_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__create_uid @@ -145,6 +148,7 @@ msgstr "" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__create_date +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__create_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__create_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__create_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__create_date @@ -156,6 +160,11 @@ msgstr "" msgid "Data" msgstr "" +#. module: spreadsheet_oca +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__datasource_name +msgid "Datasource Name" +msgstr "" + #. module: spreadsheet_oca #. odoo-javascript #: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml:0 @@ -172,6 +181,7 @@ msgstr "" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__display_name +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__display_name #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__display_name #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__display_name #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__display_name @@ -193,6 +203,11 @@ msgstr "" msgid "Duplicated groupbys in pivot are not supprted" msgstr "" +#. module: spreadsheet_oca +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__dynamic +msgid "Dynamic" +msgstr "" + #. module: spreadsheet_oca #: model_terms:ir.ui.view,arch_db:spreadsheet_oca.spreadsheet_spreadsheet_form_view #: model_terms:ir.ui.view,arch_db:spreadsheet_oca.spreadsheet_spreadsheet_tree_view @@ -233,6 +248,7 @@ msgstr "" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__id +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__id #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__id #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__id #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__id @@ -259,6 +275,13 @@ msgstr "" msgid "Import data to spreadsheet" msgstr "" +#. module: spreadsheet_oca +#. odoo-javascript +#: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml:0 +#, python-format +msgid "Insert dynamic pivot" +msgstr "" + #. module: spreadsheet_oca #. odoo-javascript #: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml:0 @@ -275,6 +298,7 @@ msgstr "" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision____last_update +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number____last_update #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet____last_update #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import____last_update #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode____last_update @@ -283,6 +307,7 @@ msgstr "" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__write_uid +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__write_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__write_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__write_uid #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__write_uid @@ -291,6 +316,7 @@ msgstr "" #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_oca_revision__write_date +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__write_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet__write_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__write_date #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__write_date @@ -378,6 +404,12 @@ msgstr "" msgid "Next Revision" msgstr "" +#. module: spreadsheet_oca +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_select_row_number__number_of_rows +#: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import__number_of_rows +msgid "Number Of Rows" +msgstr "" + #. module: spreadsheet_oca #: model_terms:ir.ui.view,arch_db:spreadsheet_oca.spreadsheet_spreadsheet_import_form_view msgid "OK" @@ -455,6 +487,18 @@ msgstr "" msgid "Save" msgstr "" +#. module: spreadsheet_oca +#: model:ir.model,name:spreadsheet_oca.model_spreadsheet_select_row_number +msgid "Select number of rows to duplicate row" +msgstr "" + +#. module: spreadsheet_oca +#. odoo-javascript +#: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/filter_panel_datasources.esm.js:0 +#, python-format +msgid "Select the quantity of rows" +msgstr "" + #. module: spreadsheet_oca #: model:ir.model.fields,field_description:spreadsheet_oca.field_spreadsheet_spreadsheet_import_mode__sequence msgid "Sequence" @@ -514,6 +558,13 @@ msgstr "" msgid "Stacked" msgstr "" +#. module: spreadsheet_oca +#: model:ir.model.fields,help:spreadsheet_oca.field_spreadsheet_spreadsheet_import__dynamic +msgid "" +"This field allows you to generate tables that are updated with the filters " +"set in the spreadsheets." +msgstr "" + #. module: spreadsheet_oca #. odoo-javascript #: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml:0 @@ -527,8 +578,8 @@ msgid "Type" msgstr "" #. module: spreadsheet_oca -#. odoo-python #. odoo-javascript +#. odoo-python #: code:addons/spreadsheet_oca/models/spreadsheet_spreadsheet.py:0 #: code:addons/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml:0 #, python-format diff --git a/spreadsheet_oca/readme/USAGE.rst b/spreadsheet_oca/readme/USAGE.rst index e890502..39d851a 100644 --- a/spreadsheet_oca/readme/USAGE.rst +++ b/spreadsheet_oca/readme/USAGE.rst @@ -30,3 +30,34 @@ * ``ODOO.FISCALYEAR.END(day)``: Returns the ending date of the fiscal year encompassing the provided date. * ``ODOO.ACCOUNT.GROUP(type)``: Returns the account ids of a given group where type should be a value of the ``account_type`` field of ``account.account`` model. (``income``, ``asset_receivable``, etc.) + +**Create a new dynamic spreadsheet from pivot** +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Go to any pivot +* Press on insert button +* Select the dynamic option and set a number of rows + +A new table that will be updated with the actual or filtered values will be added. + +* Note: When a pivot has multiple levels of aggrupations in the rows, the number of rows + selected will be transfered to each level. + + Example: + number of groups -> 2 + number of rows -> 3 + + * val1 + * subval1.1 + * subval1.2 + * subval1.3 + * val2 + * subval2.1 + * subval2.2 + * subval2.3 + * val3 + * subval3.1 + * subval3.2 + * subval3.3 + +Here is a visual exaple of use: +.. figure:: ../static/description/spreadsheet_dynamic_table.gif \ No newline at end of file diff --git a/spreadsheet_oca/security/ir.model.access.csv b/spreadsheet_oca/security/ir.model.access.csv index e056d3c..f25d2e1 100644 --- a/spreadsheet_oca/security/ir.model.access.csv +++ b/spreadsheet_oca/security/ir.model.access.csv @@ -3,3 +3,4 @@ access_spreadsheet_spreadsheet,access_spreadsheet_spreadsheet,model_spreadsheet_ access_spreadsheet_oca_revision,access_spreadsheet_oca_revision,model_spreadsheet_oca_revision,base.group_user,1,1,1,1 spreadsheet_oca.access_spreadsheet_spreadsheet_import,access_spreadsheet_spreadsheet_import,spreadsheet_oca.model_spreadsheet_spreadsheet_import,base.group_user,1,1,1,1 access_spreadsheet_import_mode,access_spreadsheet_oca_revision,model_spreadsheet_spreadsheet_import_mode,base.group_user,1,0,0,0 +access_spreadsheet_select_row_number,access_spreadsheet_select_row_number,model_spreadsheet_select_row_number,base.group_user,1,1,1,1 diff --git a/spreadsheet_oca/static/description/index.html b/spreadsheet_oca/static/description/index.html index 09e5068..9129a02 100644 --- a/spreadsheet_oca/static/description/index.html +++ b/spreadsheet_oca/static/description/index.html @@ -377,18 +377,19 @@

Spreadsheet Oca