Hi, I want to remove dot(.) from amount. Example: 1000.00 to be converted to 100000. This is a requirement from a new payment acquirer that I'm working on. The conversion will be used as part of the value for the shasign. For now I only want to know how to convert amount in odoo 12.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
I solved it using the following code:
def acquirer_form_generate_values(self, values):
acquirer_values = dict(values,
u_amount=f"{values['amount']:.2f}".replace('.', ''),
Hi,
Go to the settings then to Technical Settings -> Database Structure -> Decimal Accuracy Then Change "Digits" to the number you want Save and Refresh the page so changes you made take place
Thanks for the help but what I'm trying to do is on custom module. How can I format amount in payment acquirer template. Something like this:
<template id="acquirer_form">
<input type="hidden" name="u_amount" t-att-value='u_amount'/>
</template>
Correction to my last post, the question should be how can I format amount in python not xml template. Something like this:
def acquirer_form_generate_values(self, values):
acquirer_values = dict(values,
u_amount=values['amount']
I solved it using the following code:
def acquirer_form_generate_values(self, values):
acquirer_values = dict(values,
u_amount=f"{values['amount']}".replace('.', ''),
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj się