diff --git a/.copier-answers.yml b/.copier-answers.yml index 5e88de85..368755b1 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.29 +_commit: v1.35 _src_path: git+https://github.com/OCA/oca-addons-repo-template additional_ruff_rules: [] ci: GitHub @@ -14,7 +14,7 @@ github_enable_stale_action: true github_enforce_dev_status_compatibility: true include_wkhtmltopdf: false odoo_test_flavor: Both -odoo_version: 18.0 +odoo_version: 19.0 org_name: Odoo Community Association (OCA) org_slug: OCA rebel_module_groups: [] diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..e0d56685 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +test-requirements.txt merge=union diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 5eb021ef..d61380e4 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -3,11 +3,11 @@ name: pre-commit on: pull_request: branches: - - "18.0*" + - "19.0*" push: branches: - - "18.0" - - "18.0-ocabot-*" + - "19.0" + - "19.0-ocabot-*" jobs: pre-commit: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a0648807..6101a2b0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,11 +3,11 @@ name: tests on: pull_request: branches: - - "18.0*" + - "19.0*" push: branches: - - "18.0" - - "18.0-ocabot-*" + - "19.0" + - "19.0-ocabot-*" jobs: unreleased-deps: @@ -35,14 +35,14 @@ jobs: fail-fast: false matrix: include: - - container: ghcr.io/oca/oca-ci/py3.10-odoo18.0:latest + - container: ghcr.io/oca/oca-ci/py3.10-odoo19.0:latest name: test with Odoo - - container: ghcr.io/oca/oca-ci/py3.10-ocb18.0:latest + - container: ghcr.io/oca/oca-ci/py3.10-ocb19.0:latest name: test with OCB makepot: "true" services: postgres: - image: postgres:12.0 + image: postgres:13 env: POSTGRES_USER: odoo POSTGRES_PASSWORD: odoo diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ddab3973..ba1ea6b1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,11 +39,11 @@ repos: language: fail files: '[a-zA-Z0-9_]*/i18n/en\.po$' - repo: https://github.com/sbidoul/whool - rev: v1.2 + rev: v1.3 hooks: - id: whool-init - repo: https://github.com/oca/maintainer-tools - rev: bf9ecb9938b6a5deca0ff3d870fbd3f33341fded + rev: f9b919b9868143135a9c9cb03021089cabba8223 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons @@ -52,7 +52,7 @@ repos: - id: oca-gen-addon-readme args: - --addons-dir=. - - --branch=18.0 + - --branch=19.0 - --org-name=OCA - --repo-name=spreadsheet - --if-source-changed @@ -60,7 +60,7 @@ repos: - --convert-fragments-to-markdown - id: oca-gen-external-dependencies - repo: https://github.com/OCA/odoo-pre-commit-hooks - rev: v0.0.33 + rev: v0.1.6 hooks: - id: oca-checks-odoo-module - id: oca-checks-po @@ -79,8 +79,8 @@ repos: files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ language: node additional_dependencies: - - "prettier@3.3.3" - - "@prettier/plugin-xml@3.4.1" + - "prettier@3.6.2" + - "@prettier/plugin-xml@3.4.2" - repo: local hooks: - id: eslint @@ -93,10 +93,11 @@ repos: types: [javascript] language: node additional_dependencies: - - "eslint@9.12.0" - - "eslint-plugin-jsdoc@50.3.1" + - "eslint@9.35.0" + - "eslint-plugin-jsdoc@57.0.8" + - "globals@16.0.0" - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v6.0.0 hooks: - id: trailing-whitespace # exclude autogenerated files @@ -105,8 +106,6 @@ repos: # exclude autogenerated files exclude: /README\.rst$|\.pot?$ - id: debug-statements - - id: fix-encoding-pragma - args: ["--remove"] - id: check-case-conflict - id: check-docstring-first - id: check-executables-have-shebangs @@ -118,13 +117,13 @@ repos: - id: mixed-line-ending args: ["--fix=lf"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.8 + rev: v0.13.0 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - repo: https://github.com/OCA/pylint-odoo - rev: v9.1.3 + rev: v9.3.15 hooks: - id: pylint_odoo name: pylint with optional checks diff --git a/.pylintrc b/.pylintrc index 7c62b6d2..f3d017a8 100644 --- a/.pylintrc +++ b/.pylintrc @@ -10,7 +10,7 @@ manifest-required-authors=Odoo Community Association (OCA) manifest-required-keys=license manifest-deprecated-keys=description,active license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 -valid-odoo-versions=18.0 +valid-odoo-versions=19.0 [MESSAGES CONTROL] disable=all @@ -23,21 +23,12 @@ disable=all # config as a blocking check. enable=anomalous-backslash-in-string, - api-one-deprecated, - api-one-multi-together, assignment-from-none, attribute-deprecated, - class-camelcase, dangerous-default-value, - dangerous-view-replace-wo-priority, development-status-allowed, - duplicate-id-csv, duplicate-key, - duplicate-xml-fields, - duplicate-xml-record-id, - eval-referenced, eval-used, - incoherent-interpreter-exec-perm, license-allowed, manifest-author-string, manifest-deprecated-key, @@ -48,57 +39,57 @@ enable=anomalous-backslash-in-string, method-inverse, method-required-super, method-search, - openerp-exception-warning, pointless-statement, pointless-string-statement, print-used, redundant-keyword-arg, - redundant-modulename-xml, reimported, - relative-import, return-in-init, - rst-syntax-error, sql-injection, too-few-format-args, translation-field, translation-required, unreachable, use-vim-comment, - wrong-tabs-instead-of-spaces, - xml-syntax-error, attribute-string-redundant, - character-not-valid-in-resource-link, consider-merging-classes-inherited, context-overridden, - create-user-wo-reset-password, - dangerous-filter-wo-user, - dangerous-qweb-replace-wo-priority, - deprecated-data-xml-node, - deprecated-openerp-xml-node, - duplicate-po-message-definition, except-pass, - file-not-used, invalid-commit, manifest-maintainers-list, - missing-newline-extrafiles, missing-readme, missing-return, odoo-addons-relative-import, - old-api7-method-defined, - po-msgstr-variables, - po-syntax-error, renamed-field-parameter, resource-not-exist, - str-format-used, test-folder-imported, translation-contains-variable, translation-positional-used, - unnecessary-utf8-coding-comment, website-manifest-key-not-valid-uri, - xml-attribute-translatable, - xml-deprecated-qweb-directive, - xml-deprecated-tree-attribute, external-request-timeout, + bad-builtin-groupby, + category-allowed, + deprecated-name-get, + deprecated-odoo-model-method, + inheritable-method-lambda, + inheritable-method-string, + invalid-email, + manifest-behind-migrations, + manifest-data-duplicated, + missing-odoo-file, + no-raise-unlink, + no-search-all, + no-wizard-in-models, + prohibited-method-override, + prefer-env-translation, + translation-format-interpolation, + translation-format-truncated, + translation-fstring-interpolation, + translation-not-lazy, + translation-too-few-args, + translation-too-many-args, + translation-unsupported-format, + no-write-in-compute, # messages that do not cause the lint step to fail consider-merging-classes-inherited, create-user-wo-reset-password, @@ -114,7 +105,8 @@ enable=anomalous-backslash-in-string, old-api7-method-defined, redefined-builtin, too-complex, - unnecessary-utf8-coding-comment + unnecessary-utf8-coding-comment, + manifest-external-assets [REPORTS] diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index 018fd61c..80567de1 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -9,27 +9,18 @@ manifest-required-authors=Odoo Community Association (OCA) manifest-required-keys=license manifest-deprecated-keys=description,active license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 -valid-odoo-versions=18.0 +valid-odoo-versions=19.0 [MESSAGES CONTROL] disable=all enable=anomalous-backslash-in-string, - api-one-deprecated, - api-one-multi-together, assignment-from-none, attribute-deprecated, - class-camelcase, dangerous-default-value, - dangerous-view-replace-wo-priority, development-status-allowed, - duplicate-id-csv, duplicate-key, - duplicate-xml-fields, - duplicate-xml-record-id, - eval-referenced, eval-used, - incoherent-interpreter-exec-perm, license-allowed, manifest-author-string, manifest-deprecated-key, @@ -40,57 +31,57 @@ enable=anomalous-backslash-in-string, method-inverse, method-required-super, method-search, - openerp-exception-warning, pointless-statement, pointless-string-statement, print-used, redundant-keyword-arg, - redundant-modulename-xml, reimported, - relative-import, return-in-init, - rst-syntax-error, sql-injection, too-few-format-args, translation-field, translation-required, unreachable, use-vim-comment, - wrong-tabs-instead-of-spaces, - xml-syntax-error, attribute-string-redundant, - character-not-valid-in-resource-link, consider-merging-classes-inherited, context-overridden, - create-user-wo-reset-password, - dangerous-filter-wo-user, - dangerous-qweb-replace-wo-priority, - deprecated-data-xml-node, - deprecated-openerp-xml-node, - duplicate-po-message-definition, except-pass, - file-not-used, invalid-commit, manifest-maintainers-list, - missing-newline-extrafiles, missing-readme, missing-return, odoo-addons-relative-import, - old-api7-method-defined, - po-msgstr-variables, - po-syntax-error, renamed-field-parameter, resource-not-exist, - str-format-used, test-folder-imported, translation-contains-variable, translation-positional-used, - unnecessary-utf8-coding-comment, website-manifest-key-not-valid-uri, - xml-attribute-translatable, - xml-deprecated-qweb-directive, - xml-deprecated-tree-attribute, - external-request-timeout + external-request-timeout, + bad-builtin-groupby, + category-allowed, + deprecated-name-get, + deprecated-odoo-model-method, + inheritable-method-lambda, + inheritable-method-string, + invalid-email, + manifest-behind-migrations, + manifest-data-duplicated, + missing-odoo-file, + no-raise-unlink, + no-search-all, + no-wizard-in-models, + prohibited-method-override, + prefer-env-translation, + translation-format-interpolation, + translation-format-truncated, + translation-fstring-interpolation, + translation-not-lazy, + translation-too-few-args, + translation-too-many-args, + translation-unsupported-format, + no-write-in-compute [REPORTS] msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg} diff --git a/README.md b/README.md index ae12534b..317f909f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/spreadsheet&target_branch=18.0) -[![Pre-commit Status](https://github.com/OCA/spreadsheet/actions/workflows/pre-commit.yml/badge.svg?branch=18.0)](https://github.com/OCA/spreadsheet/actions/workflows/pre-commit.yml?query=branch%3A18.0) -[![Build Status](https://github.com/OCA/spreadsheet/actions/workflows/test.yml/badge.svg?branch=18.0)](https://github.com/OCA/spreadsheet/actions/workflows/test.yml?query=branch%3A18.0) -[![codecov](https://codecov.io/gh/OCA/spreadsheet/branch/18.0/graph/badge.svg)](https://codecov.io/gh/OCA/spreadsheet) -[![Translation Status](https://translation.odoo-community.org/widgets/spreadsheet-18-0/-/svg-badge.svg)](https://translation.odoo-community.org/engage/spreadsheet-18-0/?utm_source=widget) +[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/spreadsheet&target_branch=19.0) +[![Pre-commit Status](https://github.com/OCA/spreadsheet/actions/workflows/pre-commit.yml/badge.svg?branch=19.0)](https://github.com/OCA/spreadsheet/actions/workflows/pre-commit.yml?query=branch%3A19.0) +[![Build Status](https://github.com/OCA/spreadsheet/actions/workflows/test.yml/badge.svg?branch=19.0)](https://github.com/OCA/spreadsheet/actions/workflows/test.yml?query=branch%3A19.0) +[![codecov](https://codecov.io/gh/OCA/spreadsheet/branch/19.0/graph/badge.svg)](https://codecov.io/gh/OCA/spreadsheet) +[![Translation Status](https://translation.odoo-community.org/widgets/spreadsheet-19-0/-/svg-badge.svg)](https://translation.odoo-community.org/engage/spreadsheet-19-0/?utm_source=widget) @@ -17,14 +17,7 @@ spreadsheet [//]: # (addons) -Available addons ----------------- -addon | version | maintainers | summary ---- | --- | --- | --- -[spreadsheet_dashboard_oca](spreadsheet_dashboard_oca/) | 18.0.1.1.0 | | Use OCA Spreadsheets on dashboards configuration -[spreadsheet_dashboard_purchase_oca](spreadsheet_dashboard_purchase_oca/) | 18.0.1.0.0 | | Spreadsheet dashboard for vendors -[spreadsheet_dashboard_purchase_stock_oca](spreadsheet_dashboard_purchase_stock_oca/) | 18.0.1.0.0 | | Spreadsheet dashboard for purchases -[spreadsheet_oca](spreadsheet_oca/) | 18.0.1.3.0 | | Allow to edit spreadsheets +This part will be replaced when running the oca-gen-addons-table script from OCA/maintainer-tools. [//]: # (end addons) diff --git a/eslint.config.cjs b/eslint.config.cjs index 0d5731f8..dd0cbe0a 100644 --- a/eslint.config.cjs +++ b/eslint.config.cjs @@ -1,3 +1,4 @@ +var globals = require('globals'); jsdoc = require("eslint-plugin-jsdoc"); const config = [{ @@ -16,6 +17,8 @@ const config = [{ openerp: "readonly", owl: "readonly", luxon: "readonly", + QUnit: "readonly", + ...globals.browser, }, ecmaVersion: 2024, @@ -191,7 +194,7 @@ const config = [{ }, }, { - files: ["**/*.esm.js"], + files: ["**/*.esm.js", "**/*test.js"], languageOptions: { ecmaVersion: 2024, diff --git a/spreadsheet_dashboard_oca/__manifest__.py b/spreadsheet_dashboard_oca/__manifest__.py index f9ddc16d..0df5c2ee 100644 --- a/spreadsheet_dashboard_oca/__manifest__.py +++ b/spreadsheet_dashboard_oca/__manifest__.py @@ -5,7 +5,7 @@ "name": "Spreadsheet Dashboard Oca", "summary": """ Use OCA Spreadsheets on dashboards configuration""", - "version": "18.0.1.1.0", + "version": "saas~19.2.1.0.0", "license": "AGPL-3", "author": "CreuBlanca,Odoo Community Association (OCA)", "website": "https://github.com/OCA/spreadsheet", diff --git a/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py b/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py index fa1a492c..49e51bf8 100644 --- a/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py +++ b/spreadsheet_dashboard_oca/models/spreadsheet_dashboard.py @@ -1,7 +1,7 @@ # Copyright 2022 CreuBlanca # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import ValidationError @@ -25,9 +25,9 @@ def _compute_can_edit(self): @api.model def _search_can_edit(self, operator, value): if operator != "=": - raise NotImplementedError(_("Search operation not supported")) + raise NotImplementedError(self.env._("Search operation not supported")) if not isinstance(value, bool): - raise ValidationError(_("The value has to be a boolean")) + raise ValidationError(self.env._("The value has to be a boolean")) no_edit_ids = ( self.env["ir.model.data"] .search( diff --git a/spreadsheet_dashboard_purchase_oca/__manifest__.py b/spreadsheet_dashboard_purchase_oca/__manifest__.py index 39102ccd..b19180d9 100644 --- a/spreadsheet_dashboard_purchase_oca/__manifest__.py +++ b/spreadsheet_dashboard_purchase_oca/__manifest__.py @@ -2,7 +2,7 @@ "name": "Spreadsheet dashboard for vendors", "category": "Hidden", "depends": ["spreadsheet_dashboard", "purchase"], - "version": "18.0.1.0.0", + "version": "saas~19.2.1.0.0", "website": "https://github.com/OCA/spreadsheet", "author": "Odoo S.A., Tecnativa, Odoo Community Association (OCA)", "data": ["data/dashboards.xml"], diff --git a/spreadsheet_dashboard_purchase_stock_oca/__manifest__.py b/spreadsheet_dashboard_purchase_stock_oca/__manifest__.py index 4f7a1eaf..5816831a 100644 --- a/spreadsheet_dashboard_purchase_stock_oca/__manifest__.py +++ b/spreadsheet_dashboard_purchase_stock_oca/__manifest__.py @@ -2,7 +2,7 @@ "name": "Spreadsheet dashboard for purchases", "category": "Hidden", "depends": ["spreadsheet_dashboard", "purchase_stock"], - "version": "18.0.1.0.0", + "version": "saas~19.2.1.0.0", "website": "https://github.com/OCA/spreadsheet", "author": "Odoo S.A., Tecnativa, Odoo Community Association (OCA)", "data": ["data/dashboards.xml"], diff --git a/spreadsheet_dashboard_purchase_stock_oca/data/files/purchase_dashboard.json b/spreadsheet_dashboard_purchase_stock_oca/data/files/purchase_dashboard.json index a96345c9..a3836b2f 100644 --- a/spreadsheet_dashboard_purchase_stock_oca/data/files/purchase_dashboard.json +++ b/spreadsheet_dashboard_purchase_stock_oca/data/files/purchase_dashboard.json @@ -404,52 +404,52 @@ "B47": { "style": 9, "format": 1, - "content": "=ODOO.LIST(3,1,\"date\")" + "content": "=ODOO.LIST(3,1,\"scheduled_date\")" }, "B48": { "style": 10, "format": 1, - "content": "=ODOO.LIST(3,2,\"date\")" + "content": "=ODOO.LIST(3,2,\"scheduled_date\")" }, "B49": { "style": 9, "format": 1, - "content": "=ODOO.LIST(3,3,\"date\")" + "content": "=ODOO.LIST(3,3,\"scheduled_date\")" }, "B50": { "style": 10, "format": 1, - "content": "=ODOO.LIST(3,4,\"date\")" + "content": "=ODOO.LIST(3,4,\"scheduled_date\")" }, "B51": { "style": 9, "format": 1, - "content": "=ODOO.LIST(3,5,\"date\")" + "content": "=ODOO.LIST(3,5,\"scheduled_date\")" }, "B52": { "style": 10, "format": 1, - "content": "=ODOO.LIST(3,6,\"date\")" + "content": "=ODOO.LIST(3,6,\"scheduled_date\")" }, "B53": { "style": 9, "format": 1, - "content": "=ODOO.LIST(3,7,\"date\")" + "content": "=ODOO.LIST(3,7,\"scheduled_date\")" }, "B54": { "style": 10, "format": 1, - "content": "=ODOO.LIST(3,8,\"date\")" + "content": "=ODOO.LIST(3,8,\"scheduled_date\")" }, "B55": { "style": 9, "format": 1, - "content": "=ODOO.LIST(3,9,\"date\")" + "content": "=ODOO.LIST(3,9,\"scheduled_date\")" }, "B56": { "style": 10, "format": 1, - "content": "=ODOO.LIST(3,10,\"date\")" + "content": "=ODOO.LIST(3,10,\"scheduled_date\")" }, "B57": { "style": 10, @@ -2106,10 +2106,9 @@ "3": { "columns": [ "name", - "date", + "scheduled_date", "partner_id", "user_id", - "scheduled_date", "activity_exception_decoration", "json_popover" ], @@ -2128,7 +2127,7 @@ }, "orderBy": [ { - "name": "date", + "name": "scheduled_date", "asc": true } ], diff --git a/spreadsheet_oca/__manifest__.py b/spreadsheet_oca/__manifest__.py index 782aaeb7..1bcb9851 100644 --- a/spreadsheet_oca/__manifest__.py +++ b/spreadsheet_oca/__manifest__.py @@ -5,7 +5,7 @@ "name": "Spreadsheet Oca", "summary": """ Allow to edit spreadsheets""", - "version": "18.0.1.3.0", + "version": "saas~19.2.1.0.0", "license": "AGPL-3", "author": "CreuBlanca,Odoo Community Association (OCA)", "website": "https://github.com/OCA/spreadsheet", diff --git a/spreadsheet_oca/controllers/main.py b/spreadsheet_oca/controllers/main.py index dcc35bc7..3323cd06 100644 --- a/spreadsheet_oca/controllers/main.py +++ b/spreadsheet_oca/controllers/main.py @@ -2,7 +2,8 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import json -from odoo.http import Controller, content_disposition, request, route +from odoo.http import Controller, request, route +from odoo.http.stream import content_disposition class SpreadsheetDownloadXLSX(Controller): diff --git a/spreadsheet_oca/models/spreadsheet_abstract.py b/spreadsheet_oca/models/spreadsheet_abstract.py index 86a1e317..43409c76 100644 --- a/spreadsheet_oca/models/spreadsheet_abstract.py +++ b/spreadsheet_oca/models/spreadsheet_abstract.py @@ -5,7 +5,7 @@ import json from typing import Any -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import AccessError CollaborationMessage = dict[str, Any] @@ -20,7 +20,9 @@ class SpreadsheetAbstract(models.AbstractModel): active = fields.Boolean(default=True) spreadsheet_binary_data = fields.Binary( string="Spreadsheet file", - default=lambda self: self._empty_spreadsheet_data_base64(), + default=lambda self: base64.b64encode( + self._empty_spreadsheet_data_bin() + ).decode(), ) spreadsheet_raw = fields.Serialized( inverse="_inverse_spreadsheet_raw", compute="_compute_spreadsheet_raw" @@ -49,12 +51,11 @@ def _inverse_spreadsheet_raw(self): json.dumps(record.spreadsheet_raw).encode("UTF-8") ) - def _empty_spreadsheet_data_base64(self): + def _empty_spreadsheet_data_bin(self): """Create an empty spreadsheet workbook. - Encoded as base64 + Returns raw JSON bytes. """ - data = json.dumps(self._empty_spreadsheet_data()) - return base64.b64encode(data.encode()) + return json.dumps(self._empty_spreadsheet_data()).encode() def _empty_spreadsheet_data(self): """Create an empty spreadsheet workbook. @@ -64,11 +65,10 @@ def _empty_spreadsheet_data(self): lang = self.env["res.lang"]._lang_get(self.env.user.lang) locale = lang._odoo_lang_to_spreadsheet_locale() return { - "version": 1, "sheets": [ { "id": "sheet1", - "name": _("Sheet1"), + "name": self.env._("Sheet1"), } ], "settings": { diff --git a/spreadsheet_oca/models/spreadsheet_spreadsheet.py b/spreadsheet_oca/models/spreadsheet_spreadsheet.py index 55a9ae9f..3b75803a 100644 --- a/spreadsheet_oca/models/spreadsheet_spreadsheet.py +++ b/spreadsheet_oca/models/spreadsheet_spreadsheet.py @@ -5,7 +5,7 @@ import zipfile from io import BytesIO -from odoo import _, api, fields, models +from odoo import api, fields, models class SpreadsheetSpreadsheet(models.Model): @@ -59,7 +59,7 @@ class SpreadsheetSpreadsheet(models.Model): @api.depends("name") def _compute_filename(self): for record in self: - record.filename = "%s.json" % (self.name or _("Unnamed")) + record.filename = "%s.json" % (self.name or self.env._("Unnamed")) def create_document_from_attachment(self, attachment_ids): attachments = self.env["ir.attachment"].browse(attachment_ids) diff --git a/spreadsheet_oca/models/spreadsheet_spreadsheet_tag.py b/spreadsheet_oca/models/spreadsheet_spreadsheet_tag.py index 29fc9593..9be5cf64 100644 --- a/spreadsheet_oca/models/spreadsheet_spreadsheet_tag.py +++ b/spreadsheet_oca/models/spreadsheet_spreadsheet_tag.py @@ -15,10 +15,11 @@ def _get_default_color(self): name = fields.Char(required=True, translate=True) color = fields.Integer( - default=_get_default_color, + default=lambda self: self._get_default_color(), help="Transparent tags are not visible in the kanban view", ) - _sql_constraints = [ - ("name_uniq", "unique (name)", "A tag with the same name already exists."), - ] + _name_uniq = models.Constraint( + "unique (name)", + "A tag with the same name already exists.", + ) diff --git a/spreadsheet_oca/security/security.xml b/spreadsheet_oca/security/security.xml index aa94100a..fd866f5f 100644 --- a/spreadsheet_oca/security/security.xml +++ b/spreadsheet_oca/security/security.xml @@ -2,22 +2,24 @@ - + Spreadsheet 99 + + Spreadsheets + No Access + + 10 + User - + Manager - + - Spreadsheet Company Rule @@ -36,7 +38,7 @@ ['|', ('contributor_ids','=', user.id), ('contributor_group_ids','in', user.groups_id.ids)] + >['|', ('contributor_ids','=', user.id), ('contributor_group_ids','in', user.group_ids.ids)] @@ -46,7 +48,7 @@ ['|', ('reader_ids','=', user.id), ('reader_group_ids','in', user.groups_id.ids)] + >['|', ('reader_ids','=', user.id), ('reader_group_ids','in', user.group_ids.ids)] @@ -60,6 +62,6 @@ Spreadsheet Import mode - [('group_ids','in', user.groups_id.ids)] + [('group_ids','in', user.group_ids.ids)] diff --git a/spreadsheet_oca/static/src/spreadsheet/bundle/filter.esm.js b/spreadsheet_oca/static/src/spreadsheet/bundle/filter.esm.js index 799faf37..8d7caacc 100644 --- a/spreadsheet_oca/static/src/spreadsheet/bundle/filter.esm.js +++ b/spreadsheet_oca/static/src/spreadsheet/bundle/filter.esm.js @@ -18,7 +18,7 @@ import {useService} from "@web/core/utils/hooks"; const {topbarMenuRegistry} = spreadsheet.registries; const uuidGenerator = new spreadsheet.helpers.UuidGenerator(); -topbarMenuRegistry.add("file", {name: _t("File"), sequence: 10}); +// "file" menu is already registered by o-spreadsheet core in Odoo 19 topbarMenuRegistry.addChild("filters", ["file"], { name: _t("Filters"), sequence: 70, @@ -27,7 +27,6 @@ topbarMenuRegistry.addChild("filters", ["file"], { }); topbarMenuRegistry.addChild("save", ["file"], { name: _t("Save"), - // Description: "Ctrl+S", // This is not working, so removing it from the view for now... sequence: 10, execute: (env) => env.saveSpreadsheet(), icon: "o-spreadsheet-Icon.DOWNLOAD", @@ -38,12 +37,6 @@ topbarMenuRegistry.addChild("download", ["file"], { execute: (env) => env.downloadAsXLXS(), icon: "o-spreadsheet-Icon.EXPORT_XLSX", }); -topbarMenuRegistry.addChild("settings", ["file"], { - name: _t("Settings"), - sequence: 100, - execute: (env) => env.openSidePanel("Settings"), - icon: "o-spreadsheet-Icon.COG", -}); const {sidePanelRegistry} = spreadsheet.registries; @@ -61,10 +54,14 @@ FilterPanel.components = { FilterValue, }; -sidePanelRegistry.add("FilterPanel", { - title: "Filters", - Body: FilterPanel, -}); +try { + sidePanelRegistry.add("FilterPanel", {title: "Filters", Body: FilterPanel}); +} catch { + sidePanelRegistry.replace("FilterPanel", { + title: "Filters", + Body: FilterPanel, + }); +} export class EditFilterPanel extends Component { setup() { @@ -297,7 +294,14 @@ EditFilterPanel.components = { MultiRecordSelector, }; -sidePanelRegistry.add("EditFilterPanel", { - title: "Edit Filter", - Body: EditFilterPanel, -}); +try { + sidePanelRegistry.add("EditFilterPanel", { + title: "Edit Filter", + Body: EditFilterPanel, + }); +} catch { + sidePanelRegistry.replace("EditFilterPanel", { + title: "Edit Filter", + Body: EditFilterPanel, + }); +} diff --git a/spreadsheet_oca/static/src/spreadsheet/bundle/filter_panel_datasources.esm.js b/spreadsheet_oca/static/src/spreadsheet/bundle/filter_panel_datasources.esm.js index a8081f6b..75401538 100644 --- a/spreadsheet_oca/static/src/spreadsheet/bundle/filter_panel_datasources.esm.js +++ b/spreadsheet_oca/static/src/spreadsheet/bundle/filter_panel_datasources.esm.js @@ -165,9 +165,11 @@ PivotPanel.components = { PivotPanelDisplay, }; -pivotSidePanelRegistry.add("ODOO", { - editor: PivotPanel, -}); +try { + pivotSidePanelRegistry.add("ODOO", {editor: PivotPanel}); +} catch { + pivotSidePanelRegistry.replace("ODOO", {editor: PivotPanel}); +} export class ListPanelDisplay extends Component { setup() { @@ -263,7 +265,11 @@ ListPanel.components = { ListPanelDisplay, }; -sidePanelRegistry.add("ListPanel", { - title: "List information", - Body: ListPanel, -}); +try { + sidePanelRegistry.add("ListPanel", {title: "List information", Body: ListPanel}); +} catch { + sidePanelRegistry.replace("ListPanel", { + title: "List information", + Body: ListPanel, + }); +} diff --git a/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js b/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js index 767c0143..acdac7da 100644 --- a/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js +++ b/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js @@ -79,21 +79,30 @@ class OdooStackablePanel extends OdooPanel { } OdooStackablePanel.template = "spreadsheet_oca.OdooStackablePanel"; -chartSidePanelComponentRegistry - .add("odoo_line", { - configuration: OdooStackablePanel, - design: PieChartDesignPanel, - }) - .add("odoo_bar", { - configuration: OdooStackablePanel, - design: PieChartDesignPanel, - }) - .add("odoo_pie", { - configuration: OdooPanel, - design: PieChartDesignPanel, - }); +// In Odoo 19, core spreadsheet module may already register these keys. +// Use a helper to safely add or replace registry entries. +function safeAdd(registry, key, value) { + try { + registry.add(key, value); + } catch { + registry.replace(key, value); + } +} + +safeAdd(chartSidePanelComponentRegistry, "odoo_line", { + configuration: OdooStackablePanel, + design: PieChartDesignPanel, +}); +safeAdd(chartSidePanelComponentRegistry, "odoo_bar", { + configuration: OdooStackablePanel, + design: PieChartDesignPanel, +}); +safeAdd(chartSidePanelComponentRegistry, "odoo_pie", { + configuration: OdooPanel, + design: PieChartDesignPanel, +}); -chartSubtypeRegistry.add("odoo_line", { +safeAdd(chartSubtypeRegistry, "odoo_line", { matcher: (definition) => definition.type === "odoo_line" && !definition.stacked && !definition.fillArea, subtypeDefinition: {stacked: false, fillArea: false}, @@ -103,7 +112,7 @@ chartSubtypeRegistry.add("odoo_line", { category: "line", preview: "o-spreadsheet-ChartPreview.LINE_CHART", }); -chartSubtypeRegistry.add("odoo_stacked_line", { +safeAdd(chartSubtypeRegistry, "odoo_stacked_line", { matcher: (definition) => definition.type === "odoo_line" && definition.stacked && !definition.fillArea, subtypeDefinition: {stacked: true, fillArea: false}, @@ -113,7 +122,7 @@ chartSubtypeRegistry.add("odoo_stacked_line", { category: "line", preview: "o-spreadsheet-ChartPreview.STACKED_LINE_CHART", }); -chartSubtypeRegistry.add("odoo_area", { +safeAdd(chartSubtypeRegistry, "odoo_area", { matcher: (definition) => definition.type === "odoo_line" && !definition.stacked && definition.fillArea, subtypeDefinition: {stacked: false, fillArea: true}, @@ -123,7 +132,7 @@ chartSubtypeRegistry.add("odoo_area", { category: "area", preview: "o-spreadsheet-ChartPreview.AREA_CHART", }); -chartSubtypeRegistry.add("odoo_stacked_area", { +safeAdd(chartSubtypeRegistry, "odoo_stacked_area", { matcher: (definition) => definition.type === "odoo_line" && definition.stacked && definition.fillArea, subtypeDefinition: {stacked: true, fillArea: true}, @@ -133,7 +142,7 @@ chartSubtypeRegistry.add("odoo_stacked_area", { category: "area", preview: "o-spreadsheet-ChartPreview.STACKED_AREA_CHART", }); -chartSubtypeRegistry.add("odoo_bar", { +safeAdd(chartSubtypeRegistry, "odoo_bar", { matcher: (definition) => definition.type === "odoo_bar" && !definition.stacked, subtypeDefinition: {stacked: false}, displayName: _t("Column"), @@ -142,7 +151,7 @@ chartSubtypeRegistry.add("odoo_bar", { category: "column", preview: "o-spreadsheet-ChartPreview.COLUMN_CHART", }); -chartSubtypeRegistry.add("odoo_stacked_bar", { +safeAdd(chartSubtypeRegistry, "odoo_stacked_bar", { matcher: (definition) => definition.type === "odoo_bar" && definition.stacked, subtypeDefinition: {stacked: true}, displayName: _t("Stacked Column"), @@ -151,7 +160,7 @@ chartSubtypeRegistry.add("odoo_stacked_bar", { category: "column", preview: "o-spreadsheet-ChartPreview.STACKED_COLUMN_CHART", }); -chartSubtypeRegistry.add("odoo_pie", { +safeAdd(chartSubtypeRegistry, "odoo_pie", { displayName: _t("Pie"), chartSubtype: "odoo_pie", chartType: "odoo_pie", diff --git a/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_renderer.esm.js b/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_renderer.esm.js index 83aae8cf..c4406745 100644 --- a/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_renderer.esm.js +++ b/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_renderer.esm.js @@ -5,7 +5,6 @@ import {ImageFileStore} from "./image_file_store.esm"; import {OdooDataProvider} from "@spreadsheet/data_sources/odoo_data_provider"; import {SpreadsheetComponent} from "@spreadsheet/actions/spreadsheet_component"; import {_t} from "@web/core/l10n/translation"; -import {loadSpreadsheetDependencies} from "@spreadsheet/assets_backend/helpers"; import {useService} from "@web/core/utils/hooks"; import {useSetupAction} from "@web/search/action_hook"; import {user} from "@web/core/user"; @@ -167,7 +166,6 @@ export class SpreadsheetRenderer extends Component { downloadAsXLXS: this.downloadAsXLXS.bind(this), }); onWillStart(async () => { - await loadSpreadsheetDependencies(); await waitForDataLoaded(this.spreadsheet_model); await this.env.importData(this.spreadsheet_model); this.spreadsheet_model.joinSession(); diff --git a/spreadsheet_oca/static/src/spreadsheet/list_controller.xml b/spreadsheet_oca/static/src/spreadsheet/list_controller.xml index 1f2ef570..ff044af5 100644 --- a/spreadsheet_oca/static/src/spreadsheet/list_controller.xml +++ b/spreadsheet_oca/static/src/spreadsheet/list_controller.xml @@ -2,16 +2,16 @@ - +