This question has been flagged
4 Replies
28914 Views

Hi I am using Win 7 with eclipse IDE along with Python . I have created a custom module for openerp 7. My module updated successfully and it is in the openerp module list . Now I am trying to add fields in my module , but when I try to declare fields I am facing an error ( " ImportError: No module named openerp.osv ") . How to overcome this issue ? Please help

Hopes for suggestion . Thanks

Avatar
Discard
Best Answer

im also creating simple modules for openERP v 7.0 until i encountered this problem in Odoo v8.0 (former openERP), i solved this problem by changing the traditional syntax for import  from  from osv import fields,osv   to    from openerp.osv import osv, fields     and make sure in your __init__.py   to remove the extension ".py" , example   import student  not import student.py    .... this works for me, i hope this will also work for you.

Avatar
Discard
Best Answer

Hi Arsalan, Try,

from openerp.osv import fields, osv

class your_class_name(osv.Model):

Hope it work for you.

Avatar
Discard
Author

Thanks but it didnot work . Am I making any configuration mistake or should I use some other IDE for running my code. I am a bit worried about this issue. Please help

Best Answer

I think the correct import statement dependent on the revision of openerp v7. If you use an older revision , you could try "from osv import fields, osv" as stated in the technical memento of openerp v7.

Avatar
Discard
Author

I have tried " from osv import fields , osv" but still the same issue , Do me a favour , tell me about the configuration because may be it is some configuration issue

Best Answer

How did you solve this problem? I have same problem. my openerp-server on eclipse but I get the error when I debug addons modules. I'm quite sure is eclipse configuration. googled all over but people assume once openerp-server start on eclipse then people will be able to debug modules. that is completely wrong. you get this ImportError: No module named openerp.osv that many tutorials do not address. I'm still to see a tutorial on eclipse debug that works without people raising this issue

Avatar
Discard