Skip to Content
Menu
This question has been flagged
1 Reply
811 Views

Hello odooers,

i'm trying to convert the total amount of the sale order to letter using to the app studio.

I created a text  computed field called letters and here's the code i used to get the amount in letter :

for rec in self:
rec['x_studio_letters']=rec.currency_id.amount_to_text(rec.amount_total)

 i put  amount_total,x_studio_letters in dependencies

the problem is i'm getting this bug everytime i try to create a new quotation :

Traceback (most recent call last):
  File "/home/odoo/src/odoo/14.0/odoo/http.py", line 640, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/src/odoo/14.0/odoo/http.py", line 316, in _handle_exception
    raise exception.with_traceback(None) from new_cause
ValueError: : "Expected singleton: res.currency()" while evaluating
"for rec in self:\n  rec['x_studio_letters']=rec.currency_id.amount_to_text(rec.amount_total)"
i used the same code for the invoice and it worked don't know why its not working with the sale order
Avatar
Discard
Author

It works, thank you Mohammed

Best Answer

Add a condition to check if currency field is set before trying to assign the value to x_studio_letters

Avatar
Discard