Openerp说,现有的模型并不存在于多种关系中

时间:2014-05-25 16:29:35

标签: python orm openerp

我正试图在我的模型和account.tax之间建立一个很多关系。

我正在使用以下列定义:

'tax_id': fields.many2many('account.tax', 'account_contract_line_tax', 'contract_line_id', 'tax_id', 'Taxes', domain=[('parent_id','=',False)]),

我得到以下的错误:

2014-05-25 16:18:55,456 31937 ERROR ***_dev openerp.netsvc: Programming Error
Many2Many destination model does not exist: `account.tax`
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 622, in dispatch
    security.check(db,uid,passwd)
  File "/usr/lib/pymodules/python2.7/openerp/service/security.py", line 40, in check
    pool = pooler.get_pool(db)
  File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 49, in get_pool
    return get_db_and_pool(db_name, force_demo, status, update_module)[1]
  File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 33, in get_db_and_pool
    registry = RegistryManager.get(db_name, force_demo, status, update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 203, in get
    update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 233, in new
    openerp.modules.load_modules(registry.db, force_demo, status, update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 350, in load_modules
    force, status, report, loaded_modules, update_module)
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 256, in load_marked_modules
    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
  File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 165, in load_module_graph
    init_module_models(cr, package.name, models)
  File "/usr/lib/pymodules/python2.7/openerp/modules/module.py", line 374, in init_module_models
    result = obj._auto_init(cr, {'module': module_name})
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3028, in _auto_init
    self._m2m_raise_or_create_relation(cr, f)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3338, in _m2m_raise_or_create_relation
    raise except_orm('Programming Error', 'Many2Many destination model does not exist: `%s`' % (f._obj,))
except_orm: ('Programming Error', 'Many2Many destination model does not exist: `account.tax`')

当然,自从我使用ERP建立帐户模块发票以来,account.tax已经存在。此外,我可以在配置/数据库结构/模型中看到模型

我几乎从帐户模块中复制了这行......

有什么想法吗?

一个。

1 个答案:

答案 0 :(得分:2)

好的...

似乎原因是

缺乏明确的依赖性
__openerp__.py

添加" account"到依赖列表,它开始工作......

致以最诚挚的问候,

一个。