Odoo Help

Welcome!

This community 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.

0

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

By
Yug Faa
on 4/22/14, 8:34 AM 544 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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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