Odoo Help


How to get translated selection values and formatted dates when we use XML-RPC ?

Yug Faa
on 4/22/14, 8:41 AM 657 views

Hi everybody,

I developped an android application that use XML-RPC to communicate with the server.

All request returns non-formatted text,

I tried to force the context but no changes

if not context : 
    context = {}
user = self.pool.get('res.users').read(cr, uid, uid, ['lang','tz'])
context.update({'lang' : str(user.get('lang',u'fr_FR'))})
context.update({'tz' : str(user.get('tz',u'GMT'))})
context.update({'uid' : uid})
result = {}

then I use :

for invoice in self.browse(cr, uid, ids, context=context):
    res = _('Name : ') + (invoice.number or '') + EOL
    res += _('Etat : ') + ( invoice.state or '') + EOL
    res += _('Date de la facture : ') + (invoice.date_invoice or '') + EOL

It returns :

Name : INV0002
Etat : paid
Date de la facture : 2014-04-22

A help please

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/22/14, 8:41 AM
Seen: 657 times
Last updated: 3/16/15, 8:10 AM