Openerp Many2Many Relation

时间:2014-07-11 05:12:22

标签: python openerp-7

我试图在我的模型和商品之间建立一个很多关系。创造。  我使用以下列定义:' tax_id':

fields.many2many('commodity.creation', 'commodity_creation_rel', 'rel_id', 'tax_id', 'Commodities Depends') 

我在base模块中使用的many2many字段和' commodity.creation'出现在其他模块中。

以下是我得到的错误:

2014-07-11 05:07:48,494 3515 ERROR live_db_test openerp.netsvc: Programming Error
**Many2Many destination model does not exist: `commodity.creation`**
Traceback (most recent call last):
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/netsvc.py", line 289, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/service/web_services.py", line 425, in dispatch
    return fn(*params)
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/service/web_services.py", line 436, in exp_authenticate
    res_users = pooler.get_pool(db).get('res.users')
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/pooler.py", line 49, in get_pool
    return get_db_and_pool(db_name, force_demo, status, update_module)[1]
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/pooler.py", line 33, in get_db_and_pool
    registry = RegistryManager.get(db_name, force_demo, status, update_module)
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/modules/registry.py", line 192, in get
    update_module)
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/modules/registry.py", line 214, in new
    openerp.modules.load_modules(registry.db, force_demo, status, update_module)
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/modules/loading.py", line 303, in load_modules
    loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=update_module, report=report)
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/modules/loading.py", line 167, in load_module_graph
    init_module_models(cr, package.name, models)
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/modules/module.py", line 374, in init_module_models
    result = obj._auto_init(cr, {'module': module_name})
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/osv/orm.py", line 3009, in _auto_init
    self._m2m_raise_or_create_relation(cr, f)
  File "/home/srikanth/VJ Work/pyCharmaProject/openerp/osv/orm.py", line 3319, 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: `commodity.creation`')**
2014-07-11 05:07:48,503 3515 INFO live_db_test werkzeug: 127.0.0.1 - - [11/Jul/2014 05:07:48] "POST /web/session/authenticate HTTP/1.1" 200 -

1 个答案:

答案 0 :(得分:0)

commodity.creation表不存在,我想您在父模块中尝试过。

试试这个例子

'employee_ids': fields.many2many('hr.employee', 'employee_category_rel', 
                                 'category_id', 'emp_id', 'Employees'),

其中

  • hr.employee是一个表名,
  • employee_category_rel =>链接表名称,
  • category_id和emp_id是它的字段。