feat: Apply decimal formatting to purchase dashboard, list view aggregates, and pivot view cells.
This commit is contained in:
parent
32e1114316
commit
a8ce87fe25
0
__init__.py
Normal file
0
__init__.py
Normal file
@ -17,6 +17,9 @@
|
|||||||
'web_decimal_style/static/src/views/fields/formatters_patch.js',
|
'web_decimal_style/static/src/views/fields/formatters_patch.js',
|
||||||
'web_decimal_style/static/src/views/fields/float_field.xml',
|
'web_decimal_style/static/src/views/fields/float_field.xml',
|
||||||
'web_decimal_style/static/src/views/fields/monetary_field.xml',
|
'web_decimal_style/static/src/views/fields/monetary_field.xml',
|
||||||
|
'web_decimal_style/static/src/views/purchase_dashboard.xml',
|
||||||
|
'web_decimal_style/static/src/views/purchase_dashboard_patch.js',
|
||||||
|
'web_decimal_style/static/src/views/list_pivot_patch.xml',
|
||||||
],
|
],
|
||||||
'web.assets_frontend': [
|
'web.assets_frontend': [
|
||||||
'web_decimal_style/static/src/css/decimal_style.css',
|
'web_decimal_style/static/src/css/decimal_style.css',
|
||||||
@ -24,6 +27,7 @@
|
|||||||
'web_decimal_style/static/src/views/fields/formatters_patch.js',
|
'web_decimal_style/static/src/views/fields/formatters_patch.js',
|
||||||
'web_decimal_style/static/src/views/fields/float_field.xml',
|
'web_decimal_style/static/src/views/fields/float_field.xml',
|
||||||
'web_decimal_style/static/src/views/fields/monetary_field.xml',
|
'web_decimal_style/static/src/views/fields/monetary_field.xml',
|
||||||
|
'web_decimal_style/static/src/views/list_pivot_patch.xml',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|||||||
BIN
__pycache__/__init__.cpython-312.pyc
Normal file
BIN
__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
0
models/__init__.py
Normal file
0
models/__init__.py
Normal file
BIN
models/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
models/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
models/__pycache__/purchase_order.cpython-312.pyc
Normal file
BIN
models/__pycache__/purchase_order.cpython-312.pyc
Normal file
Binary file not shown.
28
static/src/views/list_pivot_patch.xml
Normal file
28
static/src/views/list_pivot_patch.xml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<templates xml:space="preserve">
|
||||||
|
<!-- Patch List View Footer Aggregates -->
|
||||||
|
<t t-inherit="web.ListRenderer" t-inherit-mode="extension">
|
||||||
|
<xpath expr="//tfoot//span[@t-esc='aggregate.value']" position="replace">
|
||||||
|
<span t-out="aggregate.value" t-att-data-tooltip="aggregate.help"/>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<!-- Patch List View Group Row Aggregates -->
|
||||||
|
<t t-inherit="web.ListRenderer.GroupRow" t-inherit-mode="extension">
|
||||||
|
<xpath expr="//t[@t-esc='formatAggregateValue(group, column)']" position="replace">
|
||||||
|
<t t-if="column.type === 'field'" t-out="formatAggregateValue(group, column)"/>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<!-- Patch Pivot View Cells -->
|
||||||
|
<t t-inherit="web.PivotRenderer" t-inherit-mode="extension">
|
||||||
|
<xpath expr="//div[hasclass('o_variation')]" position="attributes">
|
||||||
|
<attribute name="t-esc"></attribute>
|
||||||
|
<attribute name="t-out">getFormattedVariation(cell)</attribute>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//div[hasclass('o_value')]" position="attributes">
|
||||||
|
<attribute name="t-esc"></attribute>
|
||||||
|
<attribute name="t-out">getFormattedValue(cell)</attribute>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
</templates>
|
||||||
11
static/src/views/purchase_dashboard.xml
Normal file
11
static/src/views/purchase_dashboard.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<templates id="template" xml:space="preserve">
|
||||||
|
<t t-name="web_decimal_style.PurchaseDashboard" t-inherit="purchase.PurchaseDashboard" t-inherit-mode="extension">
|
||||||
|
<xpath expr="//t[@t-out="purchaseData['all_avg_order_value']"]" position="replace">
|
||||||
|
<t t-out="formatDecimal(purchaseData['all_avg_order_value'])"/>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//t[@t-out="purchaseData['all_total_last_7_days']"]" position="replace">
|
||||||
|
<t t-out="formatDecimal(purchaseData['all_total_last_7_days'])"/>
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
</templates>
|
||||||
11
static/src/views/purchase_dashboard_patch.js
Normal file
11
static/src/views/purchase_dashboard_patch.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import { PurchaseDashBoard } from "@purchase/views/purchase_dashboard";
|
||||||
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
import { wrapDecimal } from "@web_decimal_style/core/utils/numbers_patch";
|
||||||
|
|
||||||
|
patch(PurchaseDashBoard.prototype, {
|
||||||
|
formatDecimal(value) {
|
||||||
|
return wrapDecimal(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user