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?
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Mar 15
|
5911 | ||
|
1
Sep 17
|
6339 | ||
|
1
Aug 17
|
13435 | ||
|
1
May 17
|
4444 | ||
|
1
Jun 16
|
10436 |
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!