Hi Guys,
I need to remove the currency symbol for a specific monetary field.
Is this possible?
Please note that this is for a form view and not for a QWEB view.
Thank you
Eshan Harshana
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi Guys,
I need to remove the currency symbol for a specific monetary field.
Is this possible?
Please note that this is for a form view and not for a QWEB view.
Thank you
Eshan Harshana
Hi,
Try this code
Edit the XML View:
Find the field you want to modify.
It should look something like this in the XML view:
<field name="amount_total" />
Add the options attribute to the field definition, specifying the 'currency_no_symbol' option:
<field name="amount_total" options="{'currency_no_symbol'
By adding this attribute with the 'currency_no_symbol' option, you are
instructing Odoo to display the monetary value without the currency
symbol.
Hope it helps
<span t-field="line.price_subtotal" t-options='{"widget": "float", "precision": 2}'/>
I think form should support the same options
odoo 17
I have found another solution. Add below code to your model:
def formatted_amount(self):
return self.env['ir.qweb.field.monetary'].value_to_html(
self.amount,
{
'currency': self.currency_id,
'display_currency': self.currency_id
}
).replace(self.currency_id.symbol, '').strip()
And then use it like this:
<td class="text-end font-monospace" >
<t t-esc="record.formatted_amount()" />
</td>
A bit tricky but couldn't get other suggestions work.
Hi, to remove currency symbols from models, try this solution, it worked.
example for a qweb field model in xml:
"line.price.replace('€', '')" />
( replace '€' with the currency symbol you use)
In the xml use widget="float" in the specific monetary field
example:
field name="your_field" widget="float"/>
I have tried the solution from Cybrosys, but it does not work:
span t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included" t-field-options="{'widget': False}"/
Have you ever managed to find a way how to hide the symbol?
Apologies for the weird formatting - Odoo strips all tags in the answer, even when it's formatted as code.
I have seen that there is a `no_symbol` Option: https://github.com/odoo/odoo/blob/c00baa010e7981f16bf3047cee6aaee1fc0f7495/addons/web/static/tests/views/fields/monetary_field_tests.js#L930
However, I haven't found a way to use this in a QWeb view. Does anybody have a working solution?
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 3 15
|
6053 | ||
|
1
thg 9 17
|
6445 | ||
|
1
thg 8 17
|
13552 | ||
|
1
thg 5 17
|
4575 | ||
|
1
thg 6 16
|
10502 |
https://www.odoo.com/forum/help-1/solved-how-to-remove-currency-symbol-from-monetary-field-qweb-report-98462
@ESHANG Harshana is asked for form view but this link is for QWEB!