Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 27: ordinal not in range(128)

By
oumaima
on 6/11/13, 7:10 AM 11,033 views

Hi everyone;i'm trying to add constraints of unicity;i can show the message in the beginning but after 2 tests i show this message: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 27: ordinal not in range(128) any idea please

myclass.py

class time_table_line(osv.osv): _description ='Time Table Line' _name = 'time.table.line' _rec_name ="table_id" _columns = {

    'teacher_id': fields.many2one('hr.employee', 'Nom du professeur',),
    'subject_id': fields.many2one('subject.subject', 'Nom de la matiere'),
    'table_id': fields.many2one('time.table', 'TimeTable'),
    'start_time' : fields.datetime('Start Time', required=True ),
    'end_time' : fields.float('End Time', required=True ),
    'sale_id' : fields.many2one('school.sale', 'Salle',required=True ),
}
_sql_constraints = [
('sale', 'unique(sale_id,start_time,end_time)', 'Salle existante')
]

_sql_constraints = [
('prof', 'unique(teacher_id,start_time,end_time)', 'Prof existant')
]

time_table_line()

0

Another reason could be that you forgot other files in the addons directory root.  Happened to me seconds ago, I referenced the addons folder but not only it contained my_module_name1/ or my_module_name2/ etc, but also a jpeg :s

Stupid of me but didn't take to much time to realize it.

0
Mind And Go
On 3/5/15, 5:37 PM

Hy,

Have a look there : https://github.com/odoo/odoo/issues/773

@oumaima if my answer is correct, thnaks for voting

Mind & Go, Mind And Go
on 4/11/15, 11:38 AM
0

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 6/11/13, 7:21 AM

Hi,

Maybe add the charset at the beginning of your source file :

# -*- coding: utf-8 -*-

Hi,thank you replay i added it but i still have the same problem;after 2 tests i show this error

oumaima
on 6/11/13, 7:26 AM

in your code python if any string contains accent, to add the prefix u : for example replace « "é" » by « u"é" »

Borni DHIFI
on 6/11/13, 7:35 AM

I have no string containing accent;any other idea please

oumaima
on 6/11/13, 8:03 AM
0
Luis Felipe Miléo
On 9/17/14, 9:09 AM

Try to define your string as unicode:

u'Nom du professeur'

'teacher_id': fields.many2one('hr.employee', u'Nom du professeur',),

 

[]s

his error is due to unicode and there is no special character in 'Nom du professeur'. in odoo/python to avoid this type of error, for char, use you must encode in utf-8: from openerp.tools import ustr my_char = ustr("spécial évènement")

Cyril Gaspard (GEM)
on 3/5/15, 6:27 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 6/11/13, 7:10 AM
Seen: 11033 times
Last updated: 3/24/16, 8:13 PM