到底怎么做啊 翻阅了很多文档也找不到.
ten951
-
关于many2one关系中 下拉框的问题 -
关于many2one关系中 下拉框的问题场景:
对象 dic 字段有 id name
对象 group 字段 id key value dic_id
这个关系模型用odoo已经实现了
但是问题是
在group 的tree试图 新增group页面 选择dic关系中的 下拉框显示不是name 而是dic,1,(保存也不会报错,数据库中dic_id值为1) 我想要的是显示name
求解如何解决呢?
我想要的结果是 就如html中的select一样 显示name字段 其实传递的是id
形容的很罗嗦,希望能理解意思,谢谢各位前辈 -
安装自定义模块 出错误 重启服务后[quote author=KevinKong link=topic=17379.msg31324#msg31324 date=1446796581]
错误不是很明显嘛——”ir.actions.view",哪里来的妖怪!
[/quote]
这个我也不清楚 我吧数据库重新初始化了一下 就没问题了 ::) -
安装自定义模块 出错误 重启服务后百度 谷歌搜索遍了 也找不到答案 真是郁闷啊
-
安装自定义模块 出错误 重启服务后页面报错500
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
后台打印错误信息:
Traceback (most recent call last):
File "E:\GreenOdoo-8.0-win32\runtime\python\lib\site-packages\werkzeug\serving.py", line 177, in run_wsgi
execute(self.server.app)
File "E:\GreenOdoo-8.0-win32\runtime\python\lib\site-packages\werkzeug\serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "E:\odoo-8.0\openerp\service\server.py", line 290, in app
return self.app(e, s)
File "E:\odoo-8.0\openerp\service\wsgi_server.py", line 216, in application
return application_unproxied(environ, start_response)
File "E:\odoo-8.0\openerp\service\wsgi_server.py", line 202, in application_unproxied
result = handler(environ, start_response)
File "E:\odoo-8.0\openerp\http.py", line 1290, in call
return self.dispatch(environ, start_response)
File "E:\odoo-8.0\openerp\http.py", line 1264, in call
return self.app(environ, start_wrapped)
File "E:\GreenOdoo-8.0-win32\runtime\python\lib\site-packages\werkzeug\wsgi.py", line 588, in call
return self.app(environ, start_response)
File "E:\odoo-8.0\openerp\http.py", line 1437, in dispatch
result = ir_http._dispatch()
File "E:\odoo-8.0\openerp\addons\base\ir\ir_http.py", line 175, in _dispatch
return self._handle_exception(e)
File "E:\odoo-8.0\openerp\addons\base\ir\ir_http.py", line 145, in _handle_exception
return request._handle_exception(exception)
File "E:\odoo-8.0\openerp\http.py", line 666, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "E:\odoo-8.0\openerp\addons\base\ir\ir_http.py", line 171, in _dispatch
result = request.dispatch()
File "E:\odoo-8.0\openerp\http.py", line 684, in dispatch
r = self._call_function(**self.params)
File "E:\odoo-8.0\openerp\http.py", line 310, in _call_function
return checked_call(self.db, *args, **kwargs)
File "E:\odoo-8.0\openerp\service\model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "E:\odoo-8.0\openerp\http.py", line 307, in checked_call
return self.endpoint(*a, **kw)
File "E:\odoo-8.0\openerp\http.py", line 803, in call
return self.method(*args, **kw)
File "E:\odoo-8.0\openerp\http.py", line 403, in response_wrap
response = f(*args, **kw)
File "E:\odoo-8.0\addons\web\controllers\main.py", line 477, in web_client
menu_data = request.registry['ir.ui.menu'].load_menus(request.cr, request.uid, context=request.context)
File "E:\odoo-8.0\openerp\api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in load_menus
File "E:\odoo-8.0\openerp\tools\cache.py", line 122, in lookup
value = d[key] = self.method(*args, **kwargs)
File "E:\odoo-8.0\openerp\addons\base\ir\ir_ui_menu.py", line 381, in load_menus
menu_root_ids = self.get_user_roots(cr, uid, context=context)
File "E:\odoo-8.0\openerp\api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "E:\odoo-8.0\openerp\addons\base\ir\ir_ui_menu.py", line 355, in get_user_roots
return self.search(cr, uid, menu_domain, context=context)
File "E:\odoo-8.0\openerp\api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "E:\odoo-8.0\addons\mail\mail_group_menu.py", line 42, in search
context=context, count=False)
File "E:\odoo-8.0\openerp\api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "E:\odoo-8.0\openerp\addons\base\ir\ir_ui_menu.py", line 128, in search
result = self._filter_visible_menus(cr, uid, ids, context=context)
File "E:\odoo-8.0\openerp\api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "E:\odoo-8.0\openerp\api.py", line 372, in old_api
result = method(recs, *args, **kwargs)
File "E:\odoo-8.0\openerp\addons\base\ir\ir_ui_menu.py", line 85, in _filter_visible_menus
action_menus = menus.filtered('action')
File "E:\odoo-8.0\openerp\models.py", line 5420, in filtered
return self.browse([rec.id for rec in self if func(rec)])
File "E:\odoo-8.0\openerp\models.py", line 5419, in <lambda>
func = lambda rec: filter(None, rec.mapped(name))
File "E:\odoo-8.0\openerp\models.py", line 5395, in mapped
recs = recs._mapped_func(operator.itemgetter(name))
File "E:\odoo-8.0\openerp\models.py", line 5375, in _mapped_func
vals = [func(rec) for rec in self]
File "E:\odoo-8.0\openerp\models.py", line 5613, in getitem
return self._fields[key].get(self, type(self))
File "E:\odoo-8.0\openerp\fields.py", line 819, in get
self.determine_value(record)
File "E:\odoo-8.0\openerp\fields.py", line 912, in determine_value
record._prefetch_field(self)
File "E:\odoo-8.0\openerp\api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "E:\odoo-8.0\openerp\models.py", line 3241, in _prefetch_field
result = records.read(list(fnames), load='_classic_write')
File "E:\odoo-8.0\openerp\api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "E:\odoo-8.0\openerp\models.py", line 3178, in read
self._read_from_database(stored, inherited)
File "E:\odoo-8.0\openerp\api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "E:\odoo-8.0\openerp\models.py", line 3381, in _read_from_database
record._cache.update(record._convert_to_cache(vals, validate=False))
File "E:\odoo-8.0\openerp\models.py", line 5351, in _convert_to_cache
for name, value in values.iteritems()
File "E:\odoo-8.0\openerp\models.py", line 5352, in <dictcomp>
if name in fields
File "E:\odoo-8.0\openerp\fields.py", line 1437, in convert_to_cache
return record.env[res_model].browse(int(res_id))
File "E:\odoo-8.0\openerp\api.py", line 744, in getitem
return self.registry[model_name]._browse(self, ())
File "E:\odoo-8.0\openerp\modules\registry.py", line 102, in getitem
return self.models[model_name]
KeyError: u'ir.actions.view' -
求助,自定义了一个新的模块 在模块中搜索不到[quote author=卓忆 link=topic=17377.msg31316#msg31316 date=1446767556]
先提一点 : author = 'Darcy' 除了 openerp.py 其他py 里放的话,注释一下 。
另外,注意 日志的 出错信息。
[/quote]
非常感谢 删除以后果然好了
非常感谢 -
求助,自定义了一个新的模块 在模块中搜索不到没人么?
-
求助,自定义了一个新的模块 在模块中搜索不到目录结构
px_addons
dictionary
init.py
openerp.py
dictionary.py
dictionary_group_view.xml
init.py
# -- coding: utf-8 --
author = 'Darcy'
import dictionary
openerp.py
# -- coding:utf-8 --
author = 'Darcy'
{
'name':'SXT dictionary',
'version':'1.0',
'author':'Darcy',
'description':'字典表类型(组)',
'depends':[],
'data':[
'dictionary_group_view.xml',
],
'category':'Others',
'installable':True,
'application':True,
}
dictionary.py
# -- coding : utf-8 --
author = 'Darcy'
import time
from datetime import datetime
from dateutil.relativedelta import relativedelta
from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _
class dictionary(osv.osv):
_name="dictionary.group"
_description="字典表(组)"
_columns = {
"type":fields.char("Type",required=True),
"code":fields.char("code",required=True)
}
dictionary_group_view.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_dictionary_group_form">
<field name="name">dictionary.group.form</field>
<field name="model">dictionary.group</field>
<field name="arch" type="xml">
<form string="dictionaryFrom">
<group>
<field name="type"/>
</group>
<group>
<field name="code"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_dictionary_group_tree">
<field name="name">dictionary.group.tree</field>
<field name="model">dictionary.group</field>
<field name="arch" type="xml">
<tree string="dictionaryTree">
<field name="type"/>
<field name="code"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_dictionary_group_search">
<field name="name">dictionary.group.search</field>
<field name="model">dictionary.group</field>
<field name="arch" type="xml">
<search string="Search Dictionary Group">
<field name="type" string="Dictionary Type"/>
</search>
</field>
</record>
<menuitem id="system" name="system"/>
<menuitem id="dictionary" name="Dictionary" parent="system"/>
<menuitem id="dictionary_group" name="dictionary_group" parent="dictionary" action="view_dictionary_group_search"/>
</data>
</openerp>
openerp-server.conf 其他的参数就不写了
addons_path = E:\odoo-8.0\addons,E:\odoo-8.0\px_addons
启动odoo以后 就是找不到该模块