*** This bug is a duplicate of bug 1029316 ***
    https://bugs.launchpad.net/bugs/1029316

** This bug has been marked a duplicate of bug 1029316
   [Trunk/6.1.1] UnicodeEncodeError: 'ascii' codec can't encode character 
u'\xf3' in position 8: ordinal not in range(128)

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

Title:
  Couldn't search account by unicode names

Status in OpenERP Addons (modules):
  New

Bug description:
  I'm testing 6.1 version.

  It could not able to search account by unicode name. I found the
  reason of this problem.

  addons/account/account.py

  
  def search(self, cr, uid, args, offset=0, limit=None, order=None,
              context=None, count=False):
          if context is None:
              context = {}
          pos = 0

          while pos < len(args):

              if args[pos][0] == 'code' and args[pos][1] in ('like', 'ilike') 
and args[pos][2]:
                  args[pos] = ('code', '=like', str(args[pos][2].replace('%', 
''))+'%')
              if args[pos][0] == 'journal_id':
                  if not args[pos][2]:
                      del args[pos]
                      continue
                  jour = self.pool.get('account.journal').browse(cr, uid, 
args[pos][2], context=context)
                  if (not (jour.account_control_ids or jour.type_control_ids)) 
or not args[pos][2]:
                      args[pos] = ('type','not in',('consolidation','view'))
                      continue
                  ids3 = map(lambda x: x.id, jour.type_control_ids)
                  ids1 = super(account_account, self).search(cr, uid, 
[('user_type', 'in', ids3)])
                  ids1 += map(lambda x: x.id, jour.account_control_ids)
                  args[pos] = ('id', 'in', ids1)
              pos += 1

          if context and context.has_key('consolidate_children'): #add 
consolidated children of accounts
              ids = super(account_account, self).search(cr, uid, args, offset, 
limit,
                  order, context=context, count=count)
              for consolidate_child in self.browse(cr, uid, 
context['account_id'], context=context).child_consol_ids:
                  ids.append(consolidate_child.id)
              return ids

          return super(account_account, self).search(cr, uid, args, offset, 
limit,
                  order, context=context, count=count)

  
  See that line:
  args[pos] = ('code', '=like', str(args[pos][2].replace('%', ''))+'%')

  I want to change this line like this:
  args[pos] = ('code', '=like', u'%s%%' % args[pos][2].replace('%', ''))

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

_______________________________________________
Mailing list: https://launchpad.net/~openerp-india
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-india
More help   : https://help.launchpad.net/ListHelp

Reply via email to