Skip to content

Commit

Permalink
Merge PR #38 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jul 25, 2024
2 parents 690a258 + 5a3292d commit 4c76272
Show file tree
Hide file tree
Showing 35 changed files with 717 additions and 36 deletions.
3 changes: 3 additions & 0 deletions spreadsheet_dashboard_oca/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ Contributors
~~~~~~~~~~~~

* Enric Tobella
* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Roca

Maintainers
~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions spreadsheet_dashboard_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"depends": [
"spreadsheet_dashboard",
"spreadsheet_oca",
"base_view_inheritance_extension",
],
"data": [
"wizards/spreadsheet_spreadsheet_import.xml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@
<field name="sequence" eval="21" />
<field name="group_ids" eval="[(4, ref('base.group_system'))]" />
</record>
<record
id="spreadsheet_import_mode_dashboard_new_spreadsheet"
model="spreadsheet.spreadsheet.import.mode"
>
<field name="code">dashboard_spreadsheet</field>
<field name="name">New dashboard</field>
<field name="sequence" eval="19" />
<field name="group_ids" eval="[(4, ref('base.group_system'))]" />
</record>
</odoo>
102 changes: 102 additions & 0 deletions spreadsheet_dashboard_oca/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * spreadsheet_dashboard_oca
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-19 10:02+0000\n"
"PO-Revision-Date: 2024-07-19 12:03+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.0.1\n"

#. module: spreadsheet_dashboard_oca
#: model:ir.model.fields,field_description:spreadsheet_dashboard_oca.field_spreadsheet_dashboard__active
msgid "Active"
msgstr "Activo"

#. module: spreadsheet_dashboard_oca
#: model:ir.model.fields,field_description:spreadsheet_dashboard_oca.field_spreadsheet_dashboard__can_edit
msgid "Can Edit"
msgstr "Se puede editar"

#. module: spreadsheet_dashboard_oca
#: model_terms:ir.ui.view,arch_db:spreadsheet_dashboard_oca.spreadsheet_dashboard_tree_view
msgid "Copy"
msgstr "Copiar"

#. module: spreadsheet_dashboard_oca
#: model:ir.model.fields,field_description:spreadsheet_dashboard_oca.field_spreadsheet_spreadsheet_import__dashboard_id
msgid "Dashboard"
msgstr "Tablero"

#. module: spreadsheet_dashboard_oca
#: model:ir.model.fields,field_description:spreadsheet_dashboard_oca.field_spreadsheet_spreadsheet_import__dashboard_group_id
msgid "Dashboard Group"
msgstr "Tablero grupal"

#. module: spreadsheet_dashboard_oca
#: model_terms:ir.ui.view,arch_db:spreadsheet_dashboard_oca.spreadsheet_dashboard_tree_view
msgid "Edit"
msgstr "Editar"

#. module: spreadsheet_dashboard_oca
#: model:ir.model,name:spreadsheet_dashboard_oca.model_spreadsheet_spreadsheet_import
msgid "Import data to spreadsheet"
msgstr "Importar datos a hoja de cálculo"

#. module: spreadsheet_dashboard_oca
#: model:ir.model.fields,field_description:spreadsheet_dashboard_oca.field_spreadsheet_dashboard__name
msgid "Name"
msgstr "Nombre"

#. module: spreadsheet_dashboard_oca
#: model:spreadsheet.spreadsheet.import.mode,name:spreadsheet_dashboard_oca.spreadsheet_import_mode_dashboard_new_spreadsheet
msgid "New dashboard"
msgstr "Nuevo tablero"

#. module: spreadsheet_dashboard_oca
#. odoo-python
#: code:addons/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py:0
#, python-format
msgid "Search operation not supported"
msgstr "Operación de búsqueda no soportada"

#. module: spreadsheet_dashboard_oca
#: model:ir.model,name:spreadsheet_dashboard_oca.model_spreadsheet_dashboard
msgid "Spreadsheet Dashboard"
msgstr "Hoja de cálculo de tablero"

#. module: spreadsheet_dashboard_oca
#: model:ir.model.fields,field_description:spreadsheet_dashboard_oca.field_spreadsheet_dashboard__spreadsheet_raw
msgid "Spreadsheet Raw"
msgstr "Hoja de cálculo Raw"

#. module: spreadsheet_dashboard_oca
#: model:ir.model.fields,field_description:spreadsheet_dashboard_oca.field_spreadsheet_dashboard__spreadsheet_revision_ids
msgid "Spreadsheet Revision"
msgstr "Revisión de hoja de cálculo"

#. module: spreadsheet_dashboard_oca
#. odoo-python
#: code:addons/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py:0
#, python-format
msgid "The value has to be a boolean"
msgstr "El valor tiene que ser un booleano"

#. module: spreadsheet_dashboard_oca
#: model:spreadsheet.spreadsheet.import.mode,name:spreadsheet_dashboard_oca.spreadsheet_import_mode_dashboard
msgid "To dashboard"
msgstr "A tablero"

#. module: spreadsheet_dashboard_oca
#: model:spreadsheet.spreadsheet.import.mode,name:spreadsheet_dashboard_oca.spreadsheet_import_mode_dashboard_sheet
msgid "To dashboard new sheet"
msgstr "A tablero en nueva hoja"
26 changes: 26 additions & 0 deletions spreadsheet_dashboard_oca/i18n/spreadsheet_dashboard_oca.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-19 10:02+0000\n"
"PO-Revision-Date: 2024-07-19 10:02+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -33,6 +35,11 @@ msgstr ""
msgid "Dashboard"
msgstr ""

#. module: spreadsheet_dashboard_oca
#: model:ir.model.fields,field_description:spreadsheet_dashboard_oca.field_spreadsheet_spreadsheet_import__dashboard_group_id
msgid "Dashboard Group"
msgstr ""

#. module: spreadsheet_dashboard_oca
#: model_terms:ir.ui.view,arch_db:spreadsheet_dashboard_oca.spreadsheet_dashboard_tree_view
msgid "Edit"
Expand All @@ -48,6 +55,18 @@ msgstr ""
msgid "Name"
msgstr ""

#. module: spreadsheet_dashboard_oca
#: model:spreadsheet.spreadsheet.import.mode,name:spreadsheet_dashboard_oca.spreadsheet_import_mode_dashboard_new_spreadsheet
msgid "New dashboard"
msgstr ""

#. module: spreadsheet_dashboard_oca
#. odoo-python
#: code:addons/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py:0
#, python-format
msgid "Search operation not supported"
msgstr ""

#. module: spreadsheet_dashboard_oca
#: model:ir.model,name:spreadsheet_dashboard_oca.model_spreadsheet_dashboard
msgid "Spreadsheet Dashboard"
Expand All @@ -63,6 +82,13 @@ msgstr ""
msgid "Spreadsheet Revision"
msgstr ""

#. module: spreadsheet_dashboard_oca
#. odoo-python
#: code:addons/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py:0
#, python-format
msgid "The value has to be a boolean"
msgstr ""

#. module: spreadsheet_dashboard_oca
#: model:spreadsheet.spreadsheet.import.mode,name:spreadsheet_dashboard_oca.spreadsheet_import_mode_dashboard
msgid "To dashboard"
Expand Down
26 changes: 24 additions & 2 deletions spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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)]
3 changes: 3 additions & 0 deletions spreadsheet_dashboard_oca/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
* Enric Tobella
* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Roca
15 changes: 11 additions & 4 deletions spreadsheet_dashboard_oca/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -402,12 +403,18 @@ <h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li>Enric Tobella</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Carlos Roca</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<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>
<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
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,39 @@ class SpreadsheetSpreadsheetImport(models.TransientModel):
_inherit = "spreadsheet.spreadsheet.import"

dashboard_id = fields.Many2one("spreadsheet.dashboard")
dashboard_group_id = fields.Many2one("spreadsheet.dashboard.group")

def _create_spreadsheet_dashboard_vals(self):
return {
"name": self.name,
"dashboard_group_id": self.dashboard_group_id.id,
}

def _insert_pivot_dashboard_spreadsheet(self):
dashboard = self.env["spreadsheet.dashboard"].create(
self._create_spreadsheet_dashboard_vals()
)
import_data = self.import_data
import_data["name"] = self.datasource_name
import_data["new"] = 1
if self.dynamic:
import_data["dyn_number_of_rows"] = self.number_of_rows
return {
"type": "ir.actions.client",
"tag": "action_spreadsheet_oca",
"params": {
"model": dashboard._name,
"spreadsheet_id": dashboard.id,
"import_data": import_data,
},
}

def _insert_pivot_dashboard(self, new_sheet=False):
import_data = self.import_data
import_data["name"] = self.name
import_data["name"] = self.datasource_name
import_data["new_sheet"] = new_sheet
if self.dynamic:
import_data["dyn_number_of_rows"] = self.number_of_rows
return {
"type": "ir.actions.client",
"tag": "action_spreadsheet_oca",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,34 @@
ref="spreadsheet_oca.spreadsheet_spreadsheet_import_form_view"
/>
<field name="arch" type="xml">
<field name="name" position="attributes">
<attribute
name="attrs"
operation="attrs_domain_add"
key="invisible"
join_operator="AND"
>
[['mode', '!=', 'dashboard_spreadsheet']]
</attribute>
<attribute
name="attrs"
operation="attrs_domain_add"
key="required"
join_operator="OR"
>
[['mode', '=', 'dashboard_spreadsheet']]
</attribute>
</field>
<field name="spreadsheet_id" position="after">
<field
name="dashboard_id"
attrs="{'invisible': [('mode', '!=', 'dashboard')], 'required': [('mode', '=', 'dashboard')]}"
attrs="{'invisible': [('mode', 'not in', ['dashboard', 'dashboard_sheet'])], 'required': [('mode', 'in', ['dashboard', 'dashboard_sheet'])]}"
domain="[('can_edit', '=', True)]"
options="{'no_create': True}"
/>
<field
name="dashboard_group_id"
attrs="{'invisible': [('mode', '!=', 'dashboard_spreadsheet')], 'required': [('mode', '=', 'dashboard_spreadsheet')]}"
options="{'no_create': True}"
/>
</field>
Expand Down
Loading

0 comments on commit 4c76272

Please sign in to comment.