简体   繁体   中英

Odoo server raises error Module CRM is not available on your system

I am new to modules development. I want to add attributes and features to the existing crm_lead object. Working on 8.0 version.

I have created a new module with the scaffold feature. In the __openerp__.py manifest, I have added a dependency

# any module necessary for this one to work correctly
'depends': ['base','CRM'],

When trying to import the module, I get the error

 raise orm.except_orm(_('Error'), _("You try to install module '%s' that depends on module '%s'.\nBut the latter module is not available in your system.") % (module.name, dep.name,)) 
except_orm: (u'Error', u"You try to install module 'yvleads' that depends on module 'CRM'.\nBut the latter module is not available in your system.")

Here is the skeletton of the class. I have tried various import (from openerp, from CRM, import crm, import crm_lead) without much success.

class yvleads(models.Model):
    _inherit = 'crm.crm_lead'
    _name = 'yvleads.yvleads'
    name = fields.Char()
    _column = { 'Last_Action': fields.Char('Last_Action', size=240, required=False) }

Any hint here or link to a good practise document or code example to override or add info to existing standard modules?

Thanks

You just have to put the name of the module as a package hence CRM goes in lower case:

'depends': ['base', 'crm'],

You can actually see it in other default addons modules like crm_claim/__openerp__.py that adds some functionality to the standard crm module.

For the class code itself, the _inherit attribute needs to refer to the correct mode name, ie the _name attribute of the crm_lead model. Here is the corrected class code

from openerp import models, fields, api
from openerp.addons.crm import crm_lead

class yvleads(models.Model):
    _inherit = 'crm.lead'
    _name = 'yvleads.yvleads'
    name = fields.Char()
    _column = { 'Last_Action': fields.Char('Last_Action', size=240, required=False) }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM