[REF] point_of_sale: remove CurrencyAmount component

It's only used twice, in a single component, and it's used to do
different things, one of which is just handled by formatCurrency
already. It's been inlined to the only other use site.

Part-of: odoo/odoo#122035
This commit is contained in:
Samuel Degueldre
2023-05-24 14:27:58 +02:00
parent 2173c252ad
commit cfcd25df39
4 changed files with 6 additions and 21 deletions
@@ -1,7 +0,0 @@
/** @odoo-module */
import { Component } from "@odoo/owl";
export class CurrencyAmount extends Component {
static template = "CurrencyAmount";
}
@@ -2,12 +2,10 @@
import { AbstractAwaitablePopup } from "@point_of_sale/js/Popups/AbstractAwaitablePopup";
import { useState } from "@odoo/owl";
import { CurrencyAmount } from "../Misc/CurrencyAmount";
import { usePos } from "@point_of_sale/app/pos_hook";
import { floatIsZero } from "@web/core/utils/numbers";
export class MoneyDetailsPopup extends AbstractAwaitablePopup {
static components = { CurrencyAmount };
static template = "MoneyDetailsPopup";
setup() {
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="CurrencyAmount" owl="1">
<label t-att-for="props.forTarget" t-att-class="{'oe_link_icon': props.forTarget}">
<t t-if="props.currency.position === 'before'"><t t-esc="props.currency.symbol"/><![CDATA[ ]]></t>
<t t-esc="props.amount"/>
<t t-if="props.currency.position === 'after'"><![CDATA[ ]]><t t-esc="props.currency.symbol"/></t>
</label>
</t>
</templates>
@@ -11,14 +11,18 @@
<t t-foreach="moneyDetailsList" t-as="moneyValue" t-key="moneyValue">
<div class="money-details-value" t-on-input="updateMoneyDetailsAmount">
<input class="pos-input" t-att-id="moneyValue" type="number" t-model.number="state.moneyDetails[moneyValue]" t-on-focus="ev=>ev.target.select()"/>
<CurrencyAmount forTarget="moneyValue" currency="currency" amount="moneyValue"/>
<label class="oe_link_icon" t-att-for="moneyValue">
<t t-if="currency.position === 'before'"><t t-esc="currency.symbol"/>&nbsp;</t>
<t t-esc="moneyValue"/>
<t t-if="currency.position === 'after'">&nbsp;<t t-esc="currency.symbol"/></t>
</label>
</div>
</t>
</div>
</div>
<div class="total-section">
<span>Total </span>
<CurrencyAmount currency="currency" amount="env.utils.formatCurrency(state.total, false)"/>
<label t-esc="env.utils.formatCurrency(state.total)"/>
</div>
</main>
<footer class="footer footer-flex">