This question has been flagged
2 Replies
6578 Views

hello I have a strange error and I do not know what's causing this error. My code is:

___init__.py

import project_extended

__openerp___.py

{
'name': 'project_extended',
'version': '1.0',
'category': 'Generic Modules/Others',
'description': " Project object extend"
    'author': 'bogdan @ nvncompany.ro',
'depends': ['base',"project","project_issue",],
'data': [
    '',
],
'installable': True,
'auto_install': False,
}

prokect_extended.py

from openerp.osv import fields, osv

class extended_project_issue_version(osv.osv):
_name = "project.issue.version"
_inherit = "project.issue.version"
_columns = {
    'company_id': fields.many2one('res.company', 'Company'),
}
_defaults = {
    'company_id': lambda self, cr, uid, ctx=None: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=ctx),
}   
extended_project_issue_version()    

class extended_project_phase(osv.osv):
_name = "project.phase"
_inherit = "project.phase"
_columns = {
    'company_id': fields.many2one('res.company', 'Company'),
}
_defaults = {
    'company_id': lambda self, cr, uid, ctx=None: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=ctx),
}
extend_project_phase()

class extend_project_category(osv.osv):
_name = "project.category"
_inherit = "project.category"
_columns = {
    'company_id': fields.many2one('res.company', 'Company'),
}
_defaults = {
    'company_id': lambda self, cr, uid, ctx=None: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=ctx),
}
extend_project_category()
Avatar
Discard
Best Answer

Hello,

It seems like error of importing .py file.

Make sure the .py file imported in the __init__.py is existing in the model.

Thanks and Regards,

Serpent Consulting Services

Avatar
Discard
Author

Thank you. I slove the problem. My module name was "project_extended7" and in _init__.py was import "project_extend".

Author

I import corect module but I have a new error :RuntimeError: maximum recursion depth exceeded in cmp openerp

In __init__.py you need to import the python file project_extended.py that is inside the module, not the module itself, that's why you are getting a recursion error.

Author

Can you tell me how can i import onli the file project_extended.py?

put import project_extended in __init__.pyand restart your server.

Author Best Answer

In first post I put __init__.py file and my file have "import project_extended" but does not work. I restart server everty time when I install a new module but i think OpenERP cache some information. Now I rename module folder on new installation but i think it's not a good ideea.

In this moment I restart the server I have "project_extended" folder on OpenERP Addons directory, in __init__.py I have "import project_extended" and all code from my first post and error is "IOError: File not found: project_extended\" I look in "Apply scheduled upgrades from "Modules" and it's only "project_extended" module (not project_extend7 or others".

Avatar
Discard