Hi!
I have something really strange happening in one of my models. I am using Odoo 11 and I am trying to create a many2many field, but I get the error below:
- If instead of defining a many2many field I define the field as many2one, everything works perfectly.
- If I use many2many field and set store = False, then model works fine too, but the values are of course, not stored.
- If I remove the store = False, then I get the error below.
As you can see from the error, there is a parameter 'module' that receives a null (None) value. I have no clue why.
Any insights would be greatly appreciated.
Fernando
2018-10-14 16:28:58,185 26090 ERROR trial_db1 odoo.sql_db: bad query: b" INSERT INTO ir_model_relation (name, date_init, date_update, module, model)\n VALUES ('founda_point_founda_point_tag_rel', now() AT TIME ZONE 'UTC', now() AT TIME ZONE 'UTC',\n (SELECT id FROM ir_module_module WHERE name=NULL),\n (SELECT id FROM ir_model WHERE model='founda.point')) "
ERROR: null value in column "module" violates not-null constraint
DETAIL: Failing row contains (14, founda_point_founda_point_tag_rel, 129, null, 2018-10-14 16:28:51.967784, 2018-10-14 16:28:51.967784, null, null, null, null).
2018-10-14 16:28:58,188 26090 WARNING trial_db1 odoo.modules.loading: Transient module states were reset
2018-10-14 16:28:58,194 26090 ERROR trial_db1 odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/opt/odoo_11/server/odoo/modules/registry.py", line 85, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo_11/server/odoo/modules/loading.py", line 380, in load_modules
loaded_modules, update_module, models_to_check)
File "/opt/odoo_11/server/odoo/modules/loading.py", line 274, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/opt/odoo_11/server/odoo/modules/loading.py", line 153, in load_module_graph
registry.init_models(cr, model_names, {'module': package.name})
File "/opt/odoo_11/server/odoo/modules/registry.py", line 311, in init_models
func()
File "/opt/odoo_11/server/odoo/addons/base/ir/ir_model.py", line 1076, in _reflect_relation
cr.execute(query, (table, module, model._name))
File "/opt/odoo_11/server/odoo/sql_db.py", line 155, in wrapper
return f(self, *args, **kwargs)
File "/opt/odoo_11/server/odoo/sql_db.py", line 232, in execute
res = self._obj.execute(query, params)
psycopg2.IntegrityError: null value in column "module" violates not-null constraint
DETAIL: Failing row contains (14, founda_point_founda_point_tag_rel, 129, null, 2018-10-14 16:28:51.967784, 2018-10-14 16:28:51.967784, null, null, null, null).
Hi,
where is your code ? it's a fields function ?
Bye