Comment 17 for bug 943359

Revision history for this message
jasimmk (jasimmk-c) wrote :

You will have to change the function to detect the period id in unicode also,

Patch the addons/account/account_move_line.py function

    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

to support unicode period ids

  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 or type(period_id) == unicode:
                ids = period_obj.search(cr, uid, [('name', 'ilike', period_id)])
                context.update({
                    'period_id': ids[0]
                })
        return context