有没有关于权限方面的讲解呢?我希望能设置一个模块,其中一般权限者只能读写自己创建的表单,而模块的管理员权限能对所有表单具有全权限
zysdmjj
-
Odoo每天学习10分钟免费视频活动开始了 -
新建模块时models不能加载如何解决@Joshua 感谢,我这就去进行尝试
-
新建模块时models不能加载如何解决@Joshua 不好意思或许还要麻烦下您,在听从上面的几位朋友的意见之后,我仍然是无法将自己的模型导入到odoo的数据库之中。现在的我真的是黔驴技穷了,恳请答疑解惑,万分感谢
-
新建模块时models不能加载如何解决@Siyuan
有编译过的pyc文件,但是修改日期似乎不对,我是不是应该将其删除之后重新启动服务器再让其编译一次?另外听从您的建议,已将import controller注释掉了 -
新建模块时models不能加载如何解决@Siyuan
额额。。不好意思,这是我在发帖过程中的手打失误,在模块中未发生这样的低级错误。。。但是相应的,问题未被解决。。 -
新建模块时models不能加载如何解决@Siyuan
报错如下Traceback (most recent call last): File "D:\GOdoo10\source\odoo\http.py", line 638, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "D:\GOdoo10\source\odoo\http.py", line 675, in dispatch result = self._call_function(**self.params) File "D:\GOdoo10\source\odoo\http.py", line 331, in _call_function return checked_call(self.db, *args, **kwargs) File "D:\GOdoo10\source\odoo\service\model.py", line 119, in wrapper return f(dbname, *args, **kwargs) File "D:\GOdoo10\source\odoo\http.py", line 324, in checked_call result = self.endpoint(*a, **kw) File "D:\GOdoo10\source\odoo\http.py", line 933, in __call__ return self.method(*args, **kw) File "D:\GOdoo10\source\odoo\http.py", line 504, in response_wrap response = f(*args, **kw) File "D:\GOdoo10\source\addons\web\controllers\main.py", line 866, in call_button action = self._call_kw(model, method, args, {}) File "D:\GOdoo10\source\addons\web\controllers\main.py", line 854, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "D:\GOdoo10\source\odoo\api.py", line 681, in call_kw return call_kw_multi(method, model, args, kwargs) File "D:\GOdoo10\source\odoo\api.py", line 672, in call_kw_multi result = method(recs, *args, **kwargs) File "D:\GOdoo10\source\odoo\addons\base\module\module.py", line 527, in button_immediate_upgrade return self._button_immediate_function(type(self).button_upgrade) File "D:\GOdoo10\source\odoo\addons\base\module\module.py", line 484, in _button_immediate_function modules.registry.Registry.new(self._cr.dbname, update_module=True) File "D:\GOdoo10\source\odoo\modules\registry.py", line 78, in new odoo.modules.load_modules(registry._db, force_demo, status, update_module) File "D:\GOdoo10\source\odoo\modules\loading.py", line 333, in load_modules force, status, report, loaded_modules, update_module) File "D:\GOdoo10\source\odoo\modules\loading.py", line 235, in load_marked_modules loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks) File "D:\GOdoo10\source\odoo\modules\loading.py", line 156, in load_module_graph _load_data(cr, module_name, idref, mode, kind='data') File "D:\GOdoo10\source\odoo\modules\loading.py", line 95, in _load_data tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report) File "D:\GOdoo10\source\odoo\tools\convert.py", line 851, in convert_file convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "D:\GOdoo10\source\odoo\tools\convert.py", line 921, in convert_xml_import obj.parse(doc.getroot(), mode=mode) File "D:\GOdoo10\source\odoo\tools\convert.py", line 802, in parse self.parse(rec, mode) File "D:\GOdoo10\source\odoo\tools\convert.py", line 805, in parse self._tags[rec.tag](rec, de, mode=mode) File "D:\GOdoo10\source\odoo\tools\convert.py", line 443, in _tag_act_window id = self.env['ir.model.data']._update('ir.actions.act_window', self.module, res, xml_id, noupdate=self.isnoupdate(data_node), mode=self.mode) File "D:\GOdoo10\source\odoo\addons\base\ir\ir_model.py", line 1159, in _update record = record.create(values) File "D:\GOdoo10\source\odoo\addons\base\ir\ir_actions.py", line 340, in create return super(IrActionsActWindow, self).create(vals) File "D:\GOdoo10\source\odoo\addons\base\ir\ir_actions.py", line 40, in create res = super(IrActions, self).create(vals) File "D:\GOdoo10\source\odoo\models.py", line 3798, in create record = self.browse(self._create(old_vals)) File "D:\GOdoo10\source\odoo\models.py", line 3954, in _create self._validate_fields(vals) File "D:\GOdoo10\source\odoo\models.py", line 1058, in _validate_fields check(self) File "D:\GOdoo10\source\odoo\addons\base\ir\ir_actions.py", line 248, in _check_model raise ValidationError(_('Invalid model name %r in action definition.') % action.res_model) ParseError: "Invalid model name u'shouhou.shouhoudan' in action definition. None" while parsing file:///D:/GOdoo10/myaddons/shouhou/views/views.xml:38, near <act_window id="action_shouhou_shouhoudan" name="售后单" res_model="shouhou.shouhoudan" view_mode="tree,form"/>
应该就是模型未被成功的导入,但是却不知的为什么会导入不了
-
新建模块时models不能加载如何解决@Siyuan 但是这个并不影响大局吧?对我现在的情况应该没有帮助,在默认模板中有controllers文件夹的,在将来的开发中如果有需要,那么也能用到
-
新建模块时models不能加载如何解决@Siyuan
.\_init_.py# -*- coding: utf-8 -*- from . import controllers from . import models
.\_manifest_.py
{ 'name': "shouhou", 'summary': """ 售后模块""", 'description': """ 售后模块 """, 'website': "", # Categories can be used to filter modules in modules listing # Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml # for the full list 'category': 'Uncategorized', 'version': '0.1', # any module necessary for this one to work correctly 'depends': ['base'], # always loaded 'data': [ # 'security/ir.model.access.csv', 'views/views.xml', 'views/templates.xml', ], # only loaded in demonstration mode 'demo': [ 'demo/demo.xml', ], }
\models\models.py
from odoo import models, fields, api class shouhoudan(models.Model): _name = 'shouhou.shouhoudan' name = fields.Char(string="报修人") days = fields.Integer(string="预计处理时长") startdate = fields.Date(string="报修日期日期") reason = fields.Text(string="售后事由")
\models\_init_.py
# -*- coding: utf-8 -*- from . import models
\views\views.xml
<openerp> <data> <record id="view_tree_shouhou_shouhoudan" model="ir.ui.view"> <field name="name">售后单列表</field> <field name="model">shouhou.shouhoudan</field> <field name="arch" type="xml"> <tree> <field name="name"/> <field name="days"/> <field name="startdate"/> </tree> </field> </record> <record id="view_form_shouhou_shouhoudan" model="ir.ui.view"> <field name="name">售后单</field> <field name="model">shouhou.shouhoudan</field> <field name="arch" type="xml"> <form> <sheet> <group name="group_top" string="售后单"> <field name="name"/> <field name="days"/> <field name="startdate"/> <field name="reason"/> </group> </sheet> </form> </field> </record> <act_window id="action_shouhou_shouhoudan" name="售后单" res_model="shouhou.shouhoudan" view_mode="tree,form" /> <menuitem name="售后" id="menu_shouhou"/> <menuitem name="售后单" id="menu_shouhou_shouhoudan" parent="menu_shouhou" action="action_shouhou_shouhoudan"/> </data> </openerp>
-
新建模块时models不能加载如何解决@digitalsatori 在 新建模块时models不能加载如何解决 中说:
mode
\shouhou \_init_.py
# -*- coding: utf-8 -*- from . import controllers from . import models
\shouhou\models
# -*- coding: utf-8 -*- from . import models
两个导入模块均有的,或许是我的格式有问题?
-
新建模块时models不能加载如何解决@digitalsatori 听从您的,在新手提问区重新发帖。
我是使用source\odoo-bin scaffold shouhou myaddons代码直接生成一个模块的模板的,在\myaddons\shouhou\models文件夹下默认生成了_init_.py文件的,models、manifest、view三个文件也是默认创建好的,只不过其中的默认代码被注释掉了。我在模板上修改的过程是修改好models文件与manifest文件,然后在浏览器中更新应用列表,安装售后模块。在这之后如果编辑view文件,想要创建视图,那么就会出现之前所述问题,服务端后台奔溃,循环报错,但是如果在这时把view文件恢复到初始模板(主要代码均被注释)的状态后,服务端报错就会立刻停止。
另外因为我是在windows环境下开发,使用的版本是Godoo10,个人暂时没有找到服务端的控制台在哪,望告知 -
整理了一部非常适合新手入门的开发手册@Joshua 我仔细的看了一下,在对models文件和manifest文件做好修改之后,按照您给我的那份手册中的说法,似乎是需要重启服务器对Python文件进行加载(我用的是Godoo10,暂时没找到如何开启dev模式),然而反复重启多次,我添加的这个自定义模块里的models文件所定义的shouhou.shouhoudan模型也没有加载,同时我在odoo浏览器客户端中的数据库结构的模型项中搜索之后也没有发现这个模型,不知道如何将其正确的加载
-
整理了一部非常适合新手入门的开发手册from odoo import models, fields, api class shouhoudan(models.Model): _name = 'shouhou.shouhoudan' name = fields.Char(string="报修人") days = fields.Integer(string="预计处理时长") startdate = fields.Date(string="报修日期日期") reason = fields.Text(string="售后事由")
view.xml
<openerp> <data> <!-- tree视图 --> <record id="view_tree_shouhou_shouhoudan" model="ir.ui.view"> <field name="name">售后单列表</field> <field name="model">shouhou.shouhoudan</field> <field name="arch" type="xml"> <tree> <field name="name"/> <field name="days"/> <field name="startdate"/> </tree> </field> </record> <!-- form视图 --> <record id="view_form_shouhou_shouhoudan" model="ir.ui.view"> <field name="name">售后单</field> <field name="model">shouhou.shouhoudan</field> <field name="arch" type="xml"> <form> <sheet> <group name="group_top" string="售后单"> <field name="name"/> <field name="days"/> <field name="startdate"/> <field name="reason"/> </group> </sheet> </form> </field> </record> <!-- 视图动作 --> <act_window id="action_shouhou_shouhoudan" name="售后单" res_model="shouhou.shouhoudan" view_mode="tree,form" /> <!-- 顶级菜单 --> <menuitem name="售后" id="menu_shouhou"/> <!-- 二级菜单 --> <menuitem name="售后单" id="menu_shouhou_shouhoudan" parent="menu_shouhou" action="action_shouhou_shouhoudan"/> </data> </openerp>
-
整理了一部非常适合新手入门的开发手册@Joshua
_manifest.py# -*- coding: utf-8 -*- { 'name': "shouhou", 'summary': """ 售后模块""", 'description': """ 售后模块 """, 'website': "http://www.yourcompany.com", # Categories can be used to filter modules in modules listing # Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml # for the full list 'category': 'Uncategorized', 'version': '0.1', # any module necessary for this one to work correctly 'depends': ['base'], # always loaded 'data': [ # 'security/ir.model.access.csv', 'views/views.xml', 'views/templates.xml', ], # only loaded in demonstration mode 'demo': [ 'demo/demo.xml', ], }
-
整理了一部非常适合新手入门的开发手册在仿照着请假模块做一个简易的售后模块,然后就出现这种情况,然后用作者的源码一步一步仿照着做也是会在修改好view文件之后出现报错
-
整理了一部非常适合新手入门的开发手册按照手册一步一步做,在到第二章时自定义模块出了以下
Traceback (most recent call last):
File "D:\GOdoo10\source\odoo\http.py", line 638, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "D:\GOdoo10\source\odoo\http.py", line 675, in dispatch
result = self._call_function(**self.params)
File "D:\GOdoo10\source\odoo\http.py", line 331, in _call_function
return checked_call(self.db, *args, **kwargs)
File "D:\GOdoo10\source\odoo\service\model.py", line 119, in wrapper
return f(dbname, *args, **kwargs)
File "D:\GOdoo10\source\odoo\http.py", line 324, in checked_call
result = self.endpoint(*a, **kw)
File "D:\GOdoo10\source\odoo\http.py", line 933, in call
return self.method(*args, **kw)
File "D:\GOdoo10\source\odoo\http.py", line 504, in response_wrap
response = f(*args, **kw)
File "D:\GOdoo10\source\addons\web\controllers\main.py", line 866, in call_button
action = self._call_kw(model, method, args, {})
File "D:\GOdoo10\source\addons\web\controllers\main.py", line 854, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "D:\GOdoo10\source\odoo\api.py", line 681, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "D:\GOdoo10\source\odoo\api.py", line 672, in call_kw_multi
result = method(recs, *args, **kwargs)
File "D:\GOdoo10\source\odoo\addons\base\module\module.py", line 527, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade)
File "D:\GOdoo10\source\odoo\addons\base\module\module.py", line 484, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "D:\GOdoo10\source\odoo\modules\registry.py", line 78, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "D:\GOdoo10\source\odoo\modules\loading.py", line 333, in load_modules
force, status, report, loaded_modules, update_module)
File "D:\GOdoo10\source\odoo\modules\loading.py", line 235, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "D:\GOdoo10\source\odoo\modules\loading.py", line 156, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "D:\GOdoo10\source\odoo\modules\loading.py", line 95, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "D:\GOdoo10\source\odoo\tools\convert.py", line 851, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "D:\GOdoo10\source\odoo\tools\convert.py", line 921, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "D:\GOdoo10\source\odoo\tools\convert.py", line 802, in parse
self.parse(rec, mode)
File "D:\GOdoo10\source\odoo\tools\convert.py", line 805, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "D:\GOdoo10\source\odoo\tools\convert.py", line 443, in _tag_act_window
id = self.env['ir.model.data']._update('ir.actions.act_window', self.module, res, xml_id, noupdate=self.isnoupdate(data_node), mode=self.mode)
File "D:\GOdoo10\source\odoo\addons\base\ir\ir_model.py", line 1159, in _update
record = record.create(values)
File "D:\GOdoo10\source\odoo\addons\base\ir\ir_actions.py", line 340, in create
return super(IrActionsActWindow, self).create(vals)
File "D:\GOdoo10\source\odoo\addons\base\ir\ir_actions.py", line 40, in create
res = super(IrActions, self).create(vals)
File "D:\GOdoo10\source\odoo\models.py", line 3798, in create
record = self.browse(self._create(old_vals))
File "D:\GOdoo10\source\odoo\models.py", line 3954, in _create
self._validate_fields(vals)
File "D:\GOdoo10\source\odoo\models.py", line 1058, in _validate_fields
check(self)
File "D:\GOdoo10\source\odoo\addons\base\ir\ir_actions.py", line 248, in check_model
raise ValidationError(('Invalid model name %r in action definition.') % action.res_model)
ParseError: "Invalid model name u'shouhou.shouhoudan' in action definition.
None" while parsing file:///D:/GOdoo10/myaddons/shouhou/views/views.xml:38, near
<act_window id="action_shouhou_shouhoudan" name="售后单" res_model="shouhou.shouhoudan" view_mode="tree,form"/> -
新人求助模块的学习问题我想自行编写一个类似于odoo10自带模块中的修理模块那样的模块,但是找了很久没有找到系统的编写模块的教程,在摸索中我发现view文件中的视图并不全面,在我尝试对odoo10自带的mrp-repair模块的修改中,很多的地方都找不到对应的视图代码,求帮助