Skip to content

Commit

Permalink
[IMP] spreadsheet_oca: Extension views on separate files and added ju…
Browse files Browse the repository at this point in the history
…st after file

If this files aren't charged just after the main file if some module that
is charged before spreadsheet_oca makes a primary template, the button
will not be shown.
  • Loading branch information
CarlosRoca13 committed Sep 16, 2024
1 parent d9822d4 commit b0847b4
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 46 deletions.
16 changes: 15 additions & 1 deletion spreadsheet_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,26 @@
"assets": {
"web.assets_backend": [
"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 Down
15 changes: 15 additions & 0 deletions spreadsheet_oca/static/src/spreadsheet/graph_controller.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-inherit="web.GraphView.Buttons" t-inherit-mode="extension" owl="1">
<xpath expr="//button[hasclass('fa-pie-chart')]" position="after">
<button
class="btn btn-secondary fa fa-table"
t-on-click="onSpreadsheetButtonClicked"
data-tooltip="Add to spreadsheet"
aria-label="Add to spreadsheet"
t-attf-disabled="{{noDataDisplayed ? 'disabled' : false}}"
/>

</xpath>
</t>
</templates>
16 changes: 16 additions & 0 deletions spreadsheet_oca/static/src/spreadsheet/list_controller.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-inherit="web.ListView.Buttons" t-inherit-mode="extension" owl="1">
<xpath expr="//button[hasclass('o_list_export_xlsx')]/.." position="after">
<t t-if="!env.isSmall">
<button
type="button"
class="btn btn-secondary fa fa-table o_list_export_spreadsheet"
data-tooltip="Add to spreadsheet"
aria-label="Add to spreadesheet"
t-on-click="(ev) => this.onSpreadsheetButtonClicked(ev)"
/>
</t>
</xpath>
</t>
</templates>
15 changes: 15 additions & 0 deletions spreadsheet_oca/static/src/spreadsheet/pivot_controller.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-inherit="web.PivotView.Buttons" t-inherit-mode="extension" owl="1">
<xpath expr="//button[hasclass('o_pivot_download')]" position="after">
<div t-att-data-tooltip="getSpreadsheetInsertionTooltip()">
<button
class="btn btn-secondary fa fa-table"
t-on-click="onSpreadsheetButtonClicked"
aria-label="Add to spreadsheet"
t-att-disabled="disableSpreadsheetInsertion()"
/>
</div>
</xpath>
</t>
</templates>
45 changes: 0 additions & 45 deletions spreadsheet_oca/static/src/spreadsheet/spreadsheet.xml

This file was deleted.

0 comments on commit b0847b4

Please sign in to comment.