Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
5932 Zobrazení

Hello All,

I want to get string form unicode. For this my code is here:

@api.multi

    def _select_service_product(self):

        r = []

        for order in self.order_line:

            res = order.product_id.type_service

            r.append(res)

            self.services_infor = r

            l = self.services_infor

            print "test,,,", res, self.services_infor, l


    services_infor = fields.Char(compute='_select_service_product')


Now terminal showes: 

test,,, d [False, u'a', u'd'] [False, u'a', u'd']

From here i want values a, b
Avatar
Zrušit
Nejlepší odpověď

Convert unicode string to ordinary string before append operation,

res = res.encode('ascii','ignore')

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
2
srp 22
11611
2
kvě 21
8503
2
bře 24
11905
5
zář 20
6240
1
pro 19
9663