← Back to team overview

openerp-india team mailing list archive

[Bug 1027759] [NEW] ORM Object does not translate fields from context

 

Public bug reported:

Seems there was some architectural changes between 6.0 and 6.1 that is
stopping a method like this from working. We need to translate back and
forth between 2 languages (Canadian English and HK Chinese). In 6.0 we
wrote a method to help solve this problem, but this method is of no use
in 6.1.

def setLang(self, lang, bo=None):
    if not lang:
        lang = 'en_US'
    self.parser_instance.localcontext['lang'] = lang
    if bo:
        bo._context['lang'] = lang
        bo._data = {bo.id:{}}
    for obj in self.parser_instance.objects:
        obj._context['lang'] = lang


After you set the browse object's context's language to a different language than previous, and you clear the data, and call that object, again, it does NOT pull up the translated data that we need. I also tried changing my user to using HK Chinese, but everything still keeps coming out in English.

How can I manage to switch back and forth between 2 or more languages,
now?

** Affects: openobject-server
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1027759

Title:
  ORM Object does not translate fields from context

Status in OpenERP Server:
  New

Bug description:
  Seems there was some architectural changes between 6.0 and 6.1 that is
  stopping a method like this from working. We need to translate back
  and forth between 2 languages (Canadian English and HK Chinese). In
  6.0 we wrote a method to help solve this problem, but this method is
  of no use in 6.1.

  def setLang(self, lang, bo=None):
      if not lang:
          lang = 'en_US'
      self.parser_instance.localcontext['lang'] = lang
      if bo:
          bo._context['lang'] = lang
          bo._data = {bo.id:{}}
      for obj in self.parser_instance.objects:
          obj._context['lang'] = lang

  
  After you set the browse object's context's language to a different language than previous, and you clear the data, and call that object, again, it does NOT pull up the translated data that we need. I also tried changing my user to using HK Chinese, but everything still keeps coming out in English.

  How can I manage to switch back and forth between 2 or more languages,
  now?

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1027759/+subscriptions


Follow ups

References