[已解决]使用mass edit v11时报错,ERROR: relation "mass_object_id_seq" does not exist,
-
odoo11下
mass edit
点击保存时报错如下。在pgsql中还有一个区别就是:能使用mass edit
的id显示的类型是serial,不能使用mass edit
的id显示的是integer,如下图。
这个怎么解决?2018-07-17 07:50:36,908 26191 ERROR 0711_v11 odoo.sql_db: bad query: b'INSERT INTO "mass_object" ("id", "model_id", "model_list", "name", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval(\'mass_object_id_seq\'), 77, \'[77]\', \'q\', 1, 1, (now() at time zone \'UTC\'), (now() at time zone \'UTC\')) RETURNING id' ERROR: relation "mass_object_id_seq" does not exist LINE 1: ...uid", "create_date", "write_date") VALUES(nextval('mass_obje... ^ 2018-07-17 07:50:36,909 26191 ERROR 0711_v11 odoo.http: Exception during JSON request handling. Traceback (most recent call last): File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 650, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 310, in _handle_exception raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/tools/pycompat.py", line 87, in reraise raise value File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 692, in dispatch result = self._call_function(**self.params) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 342, in _call_function return checked_call(self.db, *args, **kwargs) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/service/model.py", line 97, in wrapper return f(dbname, *args, **kwargs) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 335, in checked_call result = self.endpoint(*a, **kw) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 936, in __call__ return self.method(*args, **kw) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/http.py", line 515, in response_wrap response = f(*args, **kw) File "/home/hui/odoo-dev/odoo11/odoo11/addons/web/controllers/main.py", line 931, in call_kw return self._call_kw(model, method, args, kwargs) File "/home/hui/odoo-dev/odoo11/odoo11/addons/web/controllers/main.py", line 923, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/api.py", line 687, in call_kw return call_kw_model(method, model, args, kwargs) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/api.py", line 672, in call_kw_model result = method(recs, *args, **kwargs) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/models.py", line 3373, in create record = self.browse(self._create(old_vals)) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/models.py", line 3466, in _create cr.execute(query, tuple(u[2] for u in updates if len(u) > 2)) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/sql_db.py", line 155, in wrapper return f(self, *args, **kwargs) File "/home/hui/odoo-dev/odoo11/odoo11/odoo/sql_db.py", line 232, in execute res = self._obj.execute(query, params) psycopg2.ProgrammingError: relation "mass_object_id_seq" does not exist LINE 1: ...uid", "create_date", "write_date") VALUES(nextval('mass_obje... ^
正常使用
mass edit
的数据库样子:
报错使用mass edit
的数据库的样子: -
-
现在就是不知道 字段类型 错的 那张表 是如何创建出来的,
试着在原虚拟机环境下,出问题的那个数据库里:ubuntu 18.04装了下最原始的那个mass_edit_v11,发现表也是正常的,
注意,官网的那个mass_edit_v11,有4个坑要填:
1:目录名要修改为mass_edit,
2:unlink_action 需要注释掉一行(感谢-石家庄老刘),# see line 27 #self.mapped('ref_ir_value_id').sudo().unlink()
3:就是model_domain那里要修改下,python3 map 取出来的是 object, 2.7取出来是list,改下xml文件比较好 (感谢小张)
domain="[('ttype', 'not in', ['reference', 'function']), ('model_id', '=', model_id)]"/>
4:mass_object.py中
keys = active_model_obj._inherits.keys()
下增加一行,这样就能正确用在那些 _inherits 继承的对象上了,比如 res.user用户(感谢小张):keys = list(keys)
改好的模块 我放github了: https://github.com/zykj/mass_edit_v11