Я строй модуля для Odoo 8, чтобы добавить дополнительные поля в по умолчанию CRM модуль Возможность раздела, но я получаю следующее сообщение об ошибке:KeyError: «CRM» при установке пользовательского модуля в Odoo 8
Traceback (most recent call last):
File "/opt/odoo/odoo-server/openerp/http.py", line 540, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo-server/openerp/http.py", line 577, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo-server/openerp/http.py", line 313, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/http.py", line 310, in checked_call
return self.endpoint(*a, **kw)
File "/opt/odoo/odoo-server/openerp/http.py", line 806, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo-server/openerp/http.py", line 406, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo-server/addons/web/controllers/main.py", line 948, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/odoo/odoo-server/addons/web/controllers/main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/module/module.py", line 447, in button_immediate_install
return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
File "/opt/odoo/odoo-server/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo-server/openerp/addons/base/module/module.py", line 495, in _button_immediate_function
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
File "/opt/odoo/odoo-server/openerp/modules/registry.py", line 370, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/odoo-server/openerp/modules/loading.py", line 355, in load_modules
loaded_modules, update_module)
File "/opt/odoo/odoo-server/openerp/modules/loading.py", line 255, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/opt/odoo/odoo-server/openerp/modules/loading.py", line 152, in load_module_graph
models = registry.load(cr, package)
File "/opt/odoo/odoo-server/openerp/modules/registry.py", line 163, in load
model = cls._build_model(self, cr)
File "/opt/odoo/odoo-server/openerp/models.py", line 595, in _build_model
original_module = pool[name]._original_module if name in parents else cls._module
File "/opt/odoo/odoo-server/openerp/modules/registry.py", line 102, in __getitem__
return self.models[model_name]
KeyError: 'crm'
Это похоже на ошибку зависимостей, но я уже добавил 'crm' в файл openerp .py. Я также предоставить мой модуль информации файлов:
__init__.py
import cant_neg_crm
__openerp__.py
{
'name': 'Cant Neg CRM',
'version': '1.0',
'category': 'Customer Relationship Management',
'summary': 'Leads, Opportunities, Phone Calls',
'description': """
Info
====================================================
Added :
-------------------------------
* Hosting
""",
'author': 'Gigabee',
'website': 'https://gigabee.es',
'depends': ['base','crm',],
'data': [
'cant_neg_crm.xml',
],
'installable': True,
'application': True,
'auto_install': False,
}
cant_neg_crm.py
import openerp
from openerp.osv import fields, osv, orm
from openerp import models
class tipo_facturacion(models.Model):
_name = "tipo_facturacion"
name = fields.char('Tipo', required=True)
class cant_neg_opp(models.Model):
_name = "crm"
_inherit = "crm"
_columns = {
'tiene_dominio': fields.boolean('Tiene dominio(s)'),
'su_dominio': fields.char('Dominio(s)'),
'modo_facturacion': fields.many2one('tipo_facturacion' ,'Tipo Facturacion'),
}
cant_neg_crm.xml
<?xml version="1.0"?>
<openerp>
<data>
<record id="crm_cant_neg_view" model="ir.ui.view">
<field name="name">res.partner.cant_neg_crm.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor" />
<field name="arch" type="xml">
<xpath expr="//page[@string='Internal Notes']" position="after">
<page string="Dominios y Hosting">
<group string="Dominios y Hosting del Cliente">
<field string="¿Tiene dominio?" name="tiene_dominio"/>
<field string="Dominio" name="su_dominio" attrs="{'invisible':[('tiene_dominio', '!=', True)], 'required':[('tiene_dominio', '=', True)]}" />
</group>
</xpath>
</field>
</record>
</data>
</openerp>
Большое спасибо заранее за вашу помощь!
С наилучшими пожеланиями,
Большое спасибо ! Это сработало отлично! –