Skip to content

Commit 194b279

Browse files
committed
[UPD] spreadsheet_oca: Update to 16.0.1.8.0 from OCA/spreadsheet
1 parent 3c1f168 commit 194b279

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4696
-59
lines changed

spreadsheet_oca/README.rst

+79-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Spreadsheet Oca
77
!! This file is generated by oca-gen-addon-readme !!
88
!! changes will be overwritten. !!
99
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-
!! source digest: sha256:e5b362410ca5c8eed5057aba019e80bb65406834896e2299d36cf6bc86a83560
10+
!! source digest: sha256:f709ae1a16584c7e8d453647d3efaf814791633d5622f432a33eaa840ab204f9
1111
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212
1313
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -30,11 +30,86 @@ Spreadsheet Oca
3030

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

33+
It is an alternative to the proprietary module ``spreadsheet_edition`` of Odoo Enterprise Edition.
34+
3335
**Table of contents**
3436

3537
.. contents::
3638
:local:
3739

40+
Usage
41+
=====
42+
43+
**Create a new spreadsheet**
44+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45+
46+
* Go to 'Spreadsheet' menu
47+
* Click on 'Create'
48+
* Put a name, then click on the "Edit" button
49+
50+
.. figure:: https://raw.githubusercontent.com/OCA/spreadsheet/16.0/spreadsheet_oca/static/description/spreadsheet_create.png
51+
52+
* At this point you switch to spreadsheet editing mode.
53+
The editor is named ``o-spreadsheet`` and looks like another common spreadsheet web editors.
54+
(OnlyOffice, Ethercalc, Google Sheets (non-free)).
55+
56+
.. figure:: https://raw.githubusercontent.com/OCA/spreadsheet/16.0/spreadsheet_oca/static/description/spreadsheet_edit.png
57+
58+
* You can use common functions ``SUM()``, ``AVERAGE()``, etc. in the cells.
59+
For a complete list of functions and their syntax,
60+
Refer to the documentation https://github.com/odoo/o-spreadsheet/
61+
or go to https://odoo.github.io/o-spreadsheet/ and click on "Insert > Function".
62+
63+
.. figure:: https://raw.githubusercontent.com/OCA/spreadsheet/16.0/spreadsheet_oca/static/description/o-spreadsheet.png
64+
65+
* Note: Business Odoo module can add "business functions".
66+
This is currently the case for the accounting module, which adds the following features:
67+
68+
* ``ODOO.CREDIT(account_codes, date_range)``: Get the total credit for the specified account(s) and period.
69+
* ``ODOO.DEBIT(account_codes, date_range)``: Get the total debit for the specified account(s) and period.
70+
* ``ODOO.BALANCE(account_codes, date_range)``: Get the total balance for the specified account(s) and period.
71+
* ``ODOO.FISCALYEAR.START(day)``: Returns the starting date of the fiscal year encompassing the provided date.
72+
* ``ODOO.FISCALYEAR.END(day)``: Returns the ending date of the fiscal year encompassing the provided date.
73+
* ``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.
74+
(``income``, ``asset_receivable``, etc.)
75+
76+
**Create a new dynamic spreadsheet from pivot**
77+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78+
* Go to any pivot
79+
* Press on insert button
80+
* Select the dynamic rows or dynamic columns option and set a number of rows/columns
81+
82+
A new table that will be updated with the actual or filtered values will be added.
83+
84+
* Note: When a pivot has multiple levels of aggrupations in the rows or the columns,
85+
the number of rows/columns selected will be transfered to each level.
86+
87+
Example:
88+
number of groups -> 2
89+
number of rows -> 3
90+
91+
* val1
92+
* subval1.1
93+
* subval1.2
94+
* subval1.3
95+
* val2
96+
* subval2.1
97+
* subval2.2
98+
* subval2.3
99+
* val3
100+
* subval3.1
101+
* subval3.2
102+
* subval3.3
103+
104+
Here is a visual exaple of use:
105+
.. figure:: https://raw.githubusercontent.com/OCA/spreadsheet/16.0/spreadsheet_oca/static/description/spreadsheet_dynamic_table.gif
106+
107+
Development
108+
===========
109+
110+
If you want to develop custom business functions, you can add others, based on the file
111+
https://github.com/odoo/odoo/blob/16.0/addons/spreadsheet_account/static/src/accounting_functions.js
112+
38113
Known issues / Roadmap
39114
======================
40115

@@ -67,6 +142,9 @@ Contributors
67142
~~~~~~~~~~~~
68143

69144
* Enric Tobella
145+
* `Tecnativa <https://www.tecnativa.com>`_:
146+
147+
* Carlos Roca
70148

71149
Maintainers
72150
~~~~~~~~~~~

spreadsheet_oca/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
from . import controllers
12
from . import models
23
from . import wizards

spreadsheet_oca/__manifest__.py

+22-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Spreadsheet Oca",
66
"summary": """
77
Allow to edit spreadsheets""",
8-
"version": "16.0.1.2.0",
8+
"version": "16.0.1.8.0",
99
"license": "AGPL-3",
1010
"author": "CreuBlanca,Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/spreadsheet",
@@ -15,17 +15,35 @@
1515
"security/ir.model.access.csv",
1616
"views/spreadsheet_spreadsheet.xml",
1717
"data/spreadsheet_spreadsheet_import_mode.xml",
18+
"wizards/spreadsheet_select_row_number.xml",
1819
"wizards/spreadsheet_spreadsheet_import.xml",
1920
],
21+
"demo": ["demo/spreadsheet_spreadsheet.xml"],
2022
"assets": {
2123
"web.assets_backend": [
24+
"spreadsheet_oca/static/src/spreadsheet_tree/spreadsheet_tree_view.esm.js",
25+
"spreadsheet_oca/static/src/spreadsheet_tree/spreadsheet_tree_view.xml",
2226
"spreadsheet_oca/static/src/spreadsheet/spreadsheet.scss",
23-
"spreadsheet_oca/static/src/spreadsheet/spreadsheet.xml",
2427
"spreadsheet_oca/static/src/spreadsheet/spreadsheet_action.esm.js",
2528
"spreadsheet_oca/static/src/spreadsheet/pivot_controller.esm.js",
2629
"spreadsheet_oca/static/src/spreadsheet/graph_controller.esm.js",
2730
"spreadsheet_oca/static/src/spreadsheet/list_controller.esm.js",
2831
"spreadsheet_oca/static/src/spreadsheet/list_renderer.esm.js",
32+
(
33+
"after",
34+
"web/static/src/views/graph/graph_controller.xml",
35+
"spreadsheet_oca/static/src/spreadsheet/graph_controller.xml",
36+
),
37+
(
38+
"after",
39+
"web/static/src/views/list/list_controller.xml",
40+
"spreadsheet_oca/static/src/spreadsheet/list_controller.xml",
41+
),
42+
(
43+
"after",
44+
"web/static/src/views/pivot/pivot_controller.xml",
45+
"spreadsheet_oca/static/src/spreadsheet/pivot_controller.xml",
46+
),
2947
],
3048
"spreadsheet.o_spreadsheet": [
3149
"spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml",
@@ -37,6 +55,8 @@
3755
"spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js",
3856
"spreadsheet_oca/static/src/spreadsheet/bundle/chart_panels.esm.js",
3957
"spreadsheet_oca/static/src/spreadsheet/bundle/chart_panel.esm.js",
58+
"spreadsheet_oca/static/src/spreadsheet/utils/dynamic_generators.esm.js",
59+
"spreadsheet_oca/static/src/pivot/pivot_table.esm.js",
4060
],
4161
},
4262
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import main

spreadsheet_oca/controllers/main.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2024 Tecnativa - Carlos Roca
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
import json
4+
from io import BytesIO
5+
from zipfile import ZipFile
6+
7+
from odoo.http import Controller, content_disposition, request, route
8+
9+
10+
class SpreadsheetDownloadXLSX(Controller):
11+
@route("/spreadsheet/xlsx", type="http", auth="user", methods=["POST"])
12+
def download_spreadsheet_xlsx(self, zip_name, files, **kw):
13+
files = json.loads(files)
14+
file_bytes = BytesIO()
15+
with ZipFile(file_bytes, "w") as zip_file:
16+
for file in files:
17+
zip_file.writestr(file["path"], file["content"])
18+
file_content = file_bytes.getvalue()
19+
return request.make_response(
20+
file_bytes.getvalue(),
21+
[
22+
("Content-Length", len(file_content)),
23+
("Content-Type", "application/vnd.ms-excel"),
24+
("X-Content-Type-Options", "nosniff"),
25+
("Content-Disposition", content_disposition(zip_name)),
26+
],
27+
)
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"version": 12.5,
3+
"sheets": [
4+
{
5+
"id": "Sheet1",
6+
"name": "Demo Sheet 1",
7+
"colNumber": 26,
8+
"rowNumber": 100,
9+
"rows": {},
10+
"cols": {},
11+
"merges": [],
12+
"cells": {
13+
"A1": {"style": 1, "content": "First Value", "border": 1},
14+
"A2": {"format": 1, "content": "30.55", "border": 1},
15+
"B1": {"style": 1, "content": "Second Value", "border": 1},
16+
"B2": {"format": 1, "content": "50", "border": 1},
17+
"C1": {"style": 1, "content": "Total", "border": 1},
18+
"C2": {"format": 1, "content": "=sum(A2:B2)", "border": 1},
19+
"A3": {"border": 2},
20+
"B3": {"border": 2},
21+
"C3": {"border": 2},
22+
"D1": {"border": 3},
23+
"D2": {"border": 3}
24+
},
25+
"conditionalFormats": [],
26+
"figures": [],
27+
"filterTables": [],
28+
"areGridLinesVisible": true,
29+
"isVisible": true
30+
}
31+
],
32+
"entities": {},
33+
"styles": {"1": {"bold": true, "align": "center"}},
34+
"formats": {"1": "[$$]#,##0.00"},
35+
"borders": {
36+
"1": {
37+
"top": ["thin", "#000"],
38+
"bottom": ["thin", "#000"],
39+
"left": ["thin", "#000"],
40+
"right": ["thin", "#000"]
41+
},
42+
"2": {"top": ["thin", "#000"]},
43+
"3": {"left": ["thin", "#000"]}
44+
},
45+
"revisionId": "START_REVISION",
46+
"uniqueFigureIds": true,
47+
"odooVersion": 5,
48+
"globalFilters": [],
49+
"pivots": {},
50+
"pivotNextId": 1,
51+
"lists": {},
52+
"listNextId": 1,
53+
"chartOdooMenusReferences": {}
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<odoo>
3+
<record id="demo_spreadsheet" model="spreadsheet.spreadsheet">
4+
<field name="name">Demo spreadsheet</field>
5+
<field
6+
name="data"
7+
type="base64"
8+
file="spreadsheet_oca/demo/demo_spreadsheet.json"
9+
/>
10+
11+
</record>
12+
</odoo>

0 commit comments

Comments
 (0)