Skip to content

Commit

Permalink
[UPD] spreadsheet_oca: Update to 16.0.1.8.0 from OCA/spreadsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
tarteo committed Jan 24, 2025
1 parent 3c1f168 commit 194b279
Show file tree
Hide file tree
Showing 46 changed files with 4,696 additions and 59 deletions.
80 changes: 79 additions & 1 deletion spreadsheet_oca/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Spreadsheet Oca
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e5b362410ca5c8eed5057aba019e80bb65406834896e2299d36cf6bc86a83560
!! source digest: sha256:f709ae1a16584c7e8d453647d3efaf814791633d5622f432a33eaa840ab204f9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -30,11 +30,86 @@ Spreadsheet Oca

This module adds a functionality for adding and editing Spreadsheets using Odoo CE.

It is an alternative to the proprietary module ``spreadsheet_edition`` of Odoo Enterprise Edition.

**Table of contents**

.. contents::
:local:

Usage
=====

**Create a new spreadsheet**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Go to 'Spreadsheet' menu
* Click on 'Create'
* Put a name, then click on the "Edit" button

.. figure:: https://raw.githubusercontent.com/OCA/spreadsheet/16.0/spreadsheet_oca/static/description/spreadsheet_create.png

* At this point you switch to spreadsheet editing mode.
The editor is named ``o-spreadsheet`` and looks like another common spreadsheet web editors.
(OnlyOffice, Ethercalc, Google Sheets (non-free)).

.. figure:: https://raw.githubusercontent.com/OCA/spreadsheet/16.0/spreadsheet_oca/static/description/spreadsheet_edit.png

* You can use common functions ``SUM()``, ``AVERAGE()``, etc. in the cells.
For a complete list of functions and their syntax,
Refer to the documentation https://github.com/odoo/o-spreadsheet/
or go to https://odoo.github.io/o-spreadsheet/ and click on "Insert > Function".

.. figure:: https://raw.githubusercontent.com/OCA/spreadsheet/16.0/spreadsheet_oca/static/description/o-spreadsheet.png

* Note: Business Odoo module can add "business functions".
This is currently the case for the accounting module, which adds the following features:

* ``ODOO.CREDIT(account_codes, date_range)``: Get the total credit for the specified account(s) and period.
* ``ODOO.DEBIT(account_codes, date_range)``: Get the total debit for the specified account(s) and period.
* ``ODOO.BALANCE(account_codes, date_range)``: Get the total balance for the specified account(s) and period.
* ``ODOO.FISCALYEAR.START(day)``: Returns the starting date of the fiscal year encompassing the provided date.
* ``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 rows or dynamic columns option and set a number of rows/columns

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 or the columns,
the number of rows/columns 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
===========

If you want to develop custom business functions, you can add others, based on the file
https://github.com/odoo/odoo/blob/16.0/addons/spreadsheet_account/static/src/accounting_functions.js

Known issues / Roadmap
======================

Expand Down Expand Up @@ -67,6 +142,9 @@ Contributors
~~~~~~~~~~~~

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

* Carlos Roca

Maintainers
~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions spreadsheet_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from . import controllers
from . import models
from . import wizards
24 changes: 22 additions & 2 deletions spreadsheet_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Spreadsheet Oca",
"summary": """
Allow to edit spreadsheets""",
"version": "16.0.1.2.0",
"version": "16.0.1.8.0",
"license": "AGPL-3",
"author": "CreuBlanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/spreadsheet",
Expand All @@ -15,17 +15,35 @@
"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"],
"assets": {
"web.assets_backend": [
"spreadsheet_oca/static/src/spreadsheet_tree/spreadsheet_tree_view.esm.js",
"spreadsheet_oca/static/src/spreadsheet_tree/spreadsheet_tree_view.xml",
"spreadsheet_oca/static/src/spreadsheet/spreadsheet.scss",
"spreadsheet_oca/static/src/spreadsheet/spreadsheet.xml",
"spreadsheet_oca/static/src/spreadsheet/spreadsheet_action.esm.js",
"spreadsheet_oca/static/src/spreadsheet/pivot_controller.esm.js",
"spreadsheet_oca/static/src/spreadsheet/graph_controller.esm.js",
"spreadsheet_oca/static/src/spreadsheet/list_controller.esm.js",
"spreadsheet_oca/static/src/spreadsheet/list_renderer.esm.js",
(
"after",
"web/static/src/views/graph/graph_controller.xml",
"spreadsheet_oca/static/src/spreadsheet/graph_controller.xml",
),
(
"after",
"web/static/src/views/list/list_controller.xml",
"spreadsheet_oca/static/src/spreadsheet/list_controller.xml",
),
(
"after",
"web/static/src/views/pivot/pivot_controller.xml",
"spreadsheet_oca/static/src/spreadsheet/pivot_controller.xml",
),
],
"spreadsheet.o_spreadsheet": [
"spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml",
Expand All @@ -37,6 +55,8 @@
"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_generators.esm.js",
"spreadsheet_oca/static/src/pivot/pivot_table.esm.js",
],
},
}
1 change: 1 addition & 0 deletions spreadsheet_oca/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
27 changes: 27 additions & 0 deletions spreadsheet_oca/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024 Tecnativa - Carlos Roca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import json
from io import BytesIO
from zipfile import ZipFile

from odoo.http import Controller, content_disposition, request, route


class SpreadsheetDownloadXLSX(Controller):
@route("/spreadsheet/xlsx", type="http", auth="user", methods=["POST"])
def download_spreadsheet_xlsx(self, zip_name, files, **kw):
files = json.loads(files)
file_bytes = BytesIO()
with ZipFile(file_bytes, "w") as zip_file:
for file in files:
zip_file.writestr(file["path"], file["content"])
file_content = file_bytes.getvalue()
return request.make_response(
file_bytes.getvalue(),
[
("Content-Length", len(file_content)),
("Content-Type", "application/vnd.ms-excel"),
("X-Content-Type-Options", "nosniff"),
("Content-Disposition", content_disposition(zip_name)),
],
)
54 changes: 54 additions & 0 deletions spreadsheet_oca/demo/demo_spreadsheet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"version": 12.5,
"sheets": [
{
"id": "Sheet1",
"name": "Demo Sheet 1",
"colNumber": 26,
"rowNumber": 100,
"rows": {},
"cols": {},
"merges": [],
"cells": {
"A1": {"style": 1, "content": "First Value", "border": 1},
"A2": {"format": 1, "content": "30.55", "border": 1},
"B1": {"style": 1, "content": "Second Value", "border": 1},
"B2": {"format": 1, "content": "50", "border": 1},
"C1": {"style": 1, "content": "Total", "border": 1},
"C2": {"format": 1, "content": "=sum(A2:B2)", "border": 1},
"A3": {"border": 2},
"B3": {"border": 2},
"C3": {"border": 2},
"D1": {"border": 3},
"D2": {"border": 3}
},
"conditionalFormats": [],
"figures": [],
"filterTables": [],
"areGridLinesVisible": true,
"isVisible": true
}
],
"entities": {},
"styles": {"1": {"bold": true, "align": "center"}},
"formats": {"1": "[$$]#,##0.00"},
"borders": {
"1": {
"top": ["thin", "#000"],
"bottom": ["thin", "#000"],
"left": ["thin", "#000"],
"right": ["thin", "#000"]
},
"2": {"top": ["thin", "#000"]},
"3": {"left": ["thin", "#000"]}
},
"revisionId": "START_REVISION",
"uniqueFigureIds": true,
"odooVersion": 5,
"globalFilters": [],
"pivots": {},
"pivotNextId": 1,
"lists": {},
"listNextId": 1,
"chartOdooMenusReferences": {}
}
12 changes: 12 additions & 0 deletions spreadsheet_oca/demo/spreadsheet_spreadsheet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="demo_spreadsheet" model="spreadsheet.spreadsheet">
<field name="name">Demo spreadsheet</field>
<field
name="data"
type="base64"
file="spreadsheet_oca/demo/demo_spreadsheet.json"
/>

</record>
</odoo>
Loading

0 comments on commit 194b279

Please sign in to comment.