Skip to content

Commit

Permalink
[FIX] spreadsheet_oca: Show the "Add" button in invoice list
Browse files Browse the repository at this point in the history
If any module males a primary template from the ones where the button is
added, the button wasn't be shown previously.

That's because the inheritance and load order works in OWL. The way to
fix this is to make this load order deterministic specifying to be
loaded after the corresponding template for being taken into account for
primary views. This also required to split the templates file into
several ones.
  • Loading branch information
CarlosRoca13 committed Sep 17, 2024
1 parent d9822d4 commit bf32eda
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 bf32eda

Please sign in to comment.