← Back to team overview

openerp-india team mailing list archive

[Bug 1037923] [NEW] unicode problem on account module

 

Public bug reported:

I have account period with unicode such as "5-р сар.2012".

But convert_to_period method on account.move.line does not support
unicode data. This is bug.

def convert_to_period(self, cr, uid, context=None):
        if context is None:
            context = {}
        period_obj = self.pool.get('account.period')
        #check if the period_id changed in the context from client side
        if context.get('period_id', False):
            period_id = context.get('period_id')
            if type(period_id) == str:
                ids = period_obj.search(cr, uid, [('name', 'ilike', period_id)])
                context.update({
                    'period_id': ids[0]
                })
        return context

If i search period and journal on journal item display then getting
errors.

File "/openerp/addons/account/account_move_line.py", line 958, in view_header_get
    cr.execute('SELECT code FROM account_period WHERE id = %s', (context['period_id'], ))
  File "/openerp/sql_db.py", line 152, in wrapper
    return f(self, *args, **kwargs)
  File "/openerp/sql_db.py", line 212, in execute
    res = self._obj.execute(query, params)
DataError: invalid input syntax for integer: "5-р сар.2012"
LINE 1: SELECT code FROM account_period WHERE id = '5-р сар.2012'

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

-- 
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/1037923

Title:
  unicode problem on account module

Status in OpenERP Addons (modules):
  New

Bug description:
  I have account period with unicode such as "5-р сар.2012".

  But convert_to_period method on account.move.line does not support
  unicode data. This is bug.

  def convert_to_period(self, cr, uid, context=None):
          if context is None:
              context = {}
          period_obj = self.pool.get('account.period')
          #check if the period_id changed in the context from client side
          if context.get('period_id', False):
              period_id = context.get('period_id')
              if type(period_id) == str:
                  ids = period_obj.search(cr, uid, [('name', 'ilike', period_id)])
                  context.update({
                      'period_id': ids[0]
                  })
          return context

  If i search period and journal on journal item display then getting
  errors.

  File "/openerp/addons/account/account_move_line.py", line 958, in view_header_get
      cr.execute('SELECT code FROM account_period WHERE id = %s', (context['period_id'], ))
    File "/openerp/sql_db.py", line 152, in wrapper
      return f(self, *args, **kwargs)
    File "/openerp/sql_db.py", line 212, in execute
      res = self._obj.execute(query, params)
  DataError: invalid input syntax for integer: "5-р сар.2012"
  LINE 1: SELECT code FROM account_period WHERE id = '5-р сар.2012'

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


Follow ups

References