Skip to content

Commit

Permalink
Merge PR #19 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 Aug 23, 2023
2 parents b892bca + 5389a1b commit 2ff2c43
Show file tree
Hide file tree
Showing 8 changed files with 282 additions and 18 deletions.
22 changes: 19 additions & 3 deletions spreadsheet_oca/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
Spreadsheet Oca
===============

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:32b5b0c526375df2a635235ae4b4204334012bc326b4741f499614faaa7c6697
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
Expand All @@ -19,8 +22,11 @@ Spreadsheet Oca
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/spreadsheet&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4|
|badge1| |badge2| |badge3| |badge4| |badge5|

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

Expand All @@ -29,12 +35,22 @@ This module adds a functionality for adding and editing Spreadsheets using Odoo
.. contents::
:local:

Usage
=====

Adding new lines on pivot tables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When we add a pivot table, the number of rows is predefined according to the current data.

In order to add new rows, we need to reinsert the pivot table.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/spreadsheet/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/spreadsheet/issues/new?body=module:%20spreadsheet_oca%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.
Expand Down
2 changes: 2 additions & 0 deletions spreadsheet_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_controlpanel.esm.js",
"spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js",
"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",
],
},
}
6 changes: 6 additions & 0 deletions spreadsheet_oca/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Adding new lines on pivot tables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When we add a pivot table, the number of rows is predefined according to the current data.

In order to add new rows, we need to reinsert the pivot table.
40 changes: 27 additions & 13 deletions spreadsheet_oca/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Spreadsheet Oca</title>
<style type="text/css">

Expand Down Expand Up @@ -366,45 +366,59 @@ <h1 class="title">Spreadsheet Oca</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:32b5b0c526375df2a635235ae4b4204334012bc326b4741f499614faaa7c6697
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/spreadsheet/tree/16.0/spreadsheet_oca"><img alt="OCA/spreadsheet" src="https://img.shields.io/badge/github-OCA%2Fspreadsheet-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/spreadsheet/tree/16.0/spreadsheet_oca"><img alt="OCA/spreadsheet" src="https://img.shields.io/badge/github-OCA%2Fspreadsheet-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/spreadsheet-16-0/spreadsheet-16-0-spreadsheet_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/builds?repo=OCA/spreadsheet&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds a functionality for adding and editing Spreadsheets using Odoo CE.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
<li><a class="reference internal" href="#usage" id="id1">Usage</a><ul>
<li><a class="reference internal" href="#adding-new-lines-on-pivot-tables" id="id2">Adding new lines on pivot tables</a></li>
</ul>
</li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<div class="section" id="adding-new-lines-on-pivot-tables">
<h2><a class="toc-backref" href="#id2">Adding new lines on pivot tables</a></h2>
<p>When we add a pivot table, the number of rows is predefined according to the current data.</p>
<p>In order to add new rows, we need to reinsert the pivot table.</p>
</div>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/spreadsheet/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/spreadsheet/issues/new?body=module:%20spreadsheet_oca%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple">
<li>CreuBlanca</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple">
<li>Enric Tobella</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id7">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>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
Expand Down
43 changes: 43 additions & 0 deletions spreadsheet_oca/static/src/spreadsheet/bundle/chart_panel.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/** @odoo-module */

import {patch} from "@web/core/utils/patch";
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
const {chartRegistry} = spreadsheet.registries;

const {ChartPanel} = spreadsheet.components;
export function isOdooKey(code) {
return code.startsWith("odoo_");
}

patch(ChartPanel.prototype, "spreadsheet_oca.ChartPanel", {
get chartTypes() {
return this.filterChartTypes(isOdooKey(this.getChartDefinition().type));
},

filterChartTypes(isOdoo) {
var result = {};
for (const key of chartRegistry.getKeys()) {
if ((isOdoo && isOdooKey(key)) || (!isOdoo && !isOdooKey(key))) {
result[key] = chartRegistry.get(key).name;
}
}
return result;
},
onTypeChange(type) {
if (isOdooKey(this.getChartDefinition().type)) {
const definition = {
stacked: false,
verticalAxisPosition: "left",
...this.env.model.getters.getChartDefinition(this.figureId),
type,
};
this.env.model.dispatch("UPDATE_CHART", {
definition,
id: this.figureId,
sheetId: this.env.model.getters.getActiveSheetId(),
});
} else {
this._super(type);
}
},
});
82 changes: 82 additions & 0 deletions spreadsheet_oca/static/src/spreadsheet/bundle/chart_panels.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/** @odoo-module */

import {Domain} from "@web/core/domain";
import {Many2OneField} from "@web/views/fields/many2one/many2one_field";
import {patch} from "@web/core/utils/patch";
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
import {useService} from "@web/core/utils/hooks";

const {LineBarPieConfigPanel, ScorecardChartConfigPanel, GaugeChartConfigPanel} =
spreadsheet.components;

const menuChartProps = {
setup() {
this._super.apply(this, arguments);
this.menus = useService("menu");
},
get menuId() {
const menu = this.env.model.getters.getChartOdooMenu(this.props.figureId);
if (menu) {
return [menu.id, menu.name];
}
return false;
},
updateMenu(menuId) {
if (!menuId) {
this.env.model.dispatch("LINK_ODOO_MENU_TO_CHART", {
chartId: this.props.figureId,
odooMenuId: false,
});
return;
}
const menu = this.env.model.getters.getIrMenu(menuId[0]);
this.env.model.dispatch("LINK_ODOO_MENU_TO_CHART", {
chartId: this.props.figureId,
odooMenuId: menu.xmlid || menu.id,
});
},
get record() {
const menus = this.menus
.getAll()
.map((menu) => menu.id)
.filter((menuId) => menuId !== "root");
return {
getFieldDomain: function () {
return new Domain([["id", "in", menus]]);
},
getFieldContext: function () {
return {};
},
};
},
};

patch(
LineBarPieConfigPanel.prototype,
"spreadsheet_oca.LineBarPieConfigPanel",
menuChartProps
);
LineBarPieConfigPanel.components = {
...LineBarPieConfigPanel.components,
Many2OneField,
};

patch(
ScorecardChartConfigPanel.prototype,
"spreadsheet_oca.ScorecardChartConfigPanel",
menuChartProps
);
ScorecardChartConfigPanel.components = {
...ScorecardChartConfigPanel.components,
Many2OneField,
};

patch(
GaugeChartConfigPanel.prototype,
"spreadsheet_oca.GaugeChartConfigPanel",
menuChartProps
);
GaugeChartConfigPanel.components = {
...GaugeChartConfigPanel.components,
Many2OneField,
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export class OdooPanel extends Component {
if (menu) {
return [menu.id, menu.name];
}
return undefined;
return false;
}
updateMenu(menuId) {
if (!menuId) {
this.env.model.dispatch("LINK_ODOO_MENU_TO_CHART", {
chartId: this.props.figureId,
odooMenuId: undefined,
odooMenuId: false,
});
return;
}
Expand Down
101 changes: 101 additions & 0 deletions spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,105 @@
</div>
</xpath>
</t>
<t
t-inherit="spreadsheet.o-spreadsheet-BarConfigPanel"
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//div" position="inside">
<div class="o-section">
<div class="o-section-title">Link to Odoo menu</div>
<div class="o-section-value">
<Many2OneField
value="menuId"
relation="'ir.ui.menu'"
record="record"
update.bind="updateMenu"
canOpen="false"
/>
</div>
</div>
</xpath>
</t>
<t
t-inherit="spreadsheet.o-spreadsheet-LineConfigPanel"
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//div" position="inside">
<div class="o-section">
<div class="o-section-title">Link to Odoo menu</div>
<div class="o-section-value">
<Many2OneField
value="menuId"
relation="'ir.ui.menu'"
record="record"
update.bind="updateMenu"
canOpen="false"
/>
</div>
</div>
</xpath>
</t>
<t
t-inherit="spreadsheet.o-spreadsheet-LineBarPieConfigPanel"
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//div" position="inside">
<div class="o-section">
<div class="o-section-title">Link to Odoo menu</div>
<div class="o-section-value">
<Many2OneField
value="menuId"
relation="'ir.ui.menu'"
record="record"
update.bind="updateMenu"
canOpen="false"
/>
</div>
</div>
</xpath>
</t>
<t
t-inherit="spreadsheet.o-spreadsheet-GaugeChartConfigPanel"
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//div" position="inside">
<div class="o-section">
<div class="o-section-title">Link to Odoo menu</div>
<div class="o-section-value">
<Many2OneField
value="menuId"
relation="'ir.ui.menu'"
record="record"
update.bind="updateMenu"
canOpen="false"
/>
</div>
</div>
</xpath>
</t>
<t
t-inherit="spreadsheet.o-spreadsheet-ScorecardChartConfigPanel"
t-inherit-mode="extension"
owl="1"
>
<xpath expr="//div" position="inside">
<div class="o-section">
<div class="o-section-title">Link to Odoo menu</div>
<div class="o-section-value">
<Many2OneField
value="menuId"
relation="'ir.ui.menu'"
record="record"
update.bind="updateMenu"
canOpen="false"
/>
</div>
</div>
</xpath>
</t>

</templates>

0 comments on commit 2ff2c43

Please sign in to comment.