← Back to team overview

report-openoffice-team team mailing list archive

[Bug 646271] Re: Translation in slection items

 

Use Aeroo Reports instead.

-- 
You received this bug notification because you are a member of Report
OpenOffice Team, which is the registrant for Report OpenOffice.
https://bugs.launchpad.net/bugs/646271

Title:
  Translation in slection items

Status in OpenOffice.org Reporting Engine for OpenObject:
  Won't Fix

Bug description:
  Try to use get_selection_item with french translation.
  No way to have field in french.
  Modify extrafunction with adaption of code from orm :

      def _get_selection_item(self, obj, field):
          try:
              if isinstance(obj, report_sxw.browse_record_list):
                  obj = obj[0]
              if type(obj)==str:
                  model = obj
              else:
                  model = obj._table_name
              field_val = getattr(obj, field)
              if field_val:
                  selection = self.pool.get(model)._columns[field].selection
                  if selection.__class__==list:
                      translation_obj = self.pool.get('ir.translation')
                      sel2 = []
                      for (key, val) in selection:
                          val2 = None
                          if val:
                              val2 = translation_obj._get_source(self.cr, self.uid, self.pool.get(model)._name + ',' + field, 'selection', self._get_lang(), val)
                          sel2.append((key, val2 or val))
                      val_dict = dict(sel2)
                  else:
                      val_dict = dict(selection(self.pool.get(model), self.cr, self.uid, {'lang':self._get_lang()}))
                  return val_dict[field_val]
              return ''
          except Exception:
              return ''

  selection items appear in french.

To manage notifications about this bug go to:
https://bugs.launchpad.net/report-openoffice/+bug/646271/+subscriptions


References