Updating stock module
Summary Upgrading the stock module will produce this error, psycopg2.IntegrityError: null value in column "location_id" violates not-null constraint
Steps to reproduce
- flectra -c /etc/flectra/flectra.conf -u stock -d mydb
What is the current bug behavior?
- crashes the system, Internal Server Error on browser
What is the expected correct behavior?
- upgrade the module without problems
Relevant logs and/or screenshots
Traceback (most recent call last):
File "/opt/flectra/flectra/flectra/modules/registry.py", line 85, in new
flectra.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/flectra/flectra/flectra/modules/loading.py", line 414, in load_modules
env['ir.model.data']._process_end(processed_modules)
File "/opt/flectra/flectra/flectra/addons/base/ir/ir_model.py", line 1636, in _process_end
record.unlink()
File "/opt/flectra/flectra/flectra/models.py", line 2952, in unlink
cr.execute(query, (sub_ids,))
File "/opt/flectra/flectra/flectra/sql_db.py", line 156, in wrapper
return f(self, *args, **kwargs)
File "/opt/flectra/flectra/flectra/sql_db.py", line 233, in execute
res = self._obj.execute(query, params)
psycopg2.IntegrityError: null value in column "location_id" violates not-null constraint
DETAIL: Failing row contains (6752, null, 6759, 3138, 1, 0.0, 0.000, 0.000, 1.000, null, 119, null, null, 2018-12-12 08:36:12, null, null, 5, done, INV:Physical Count Dec.10 2018 - Zero out
Qty , 7, 2018-12-12 08:26:35.55799, 7, 2018-12-12 08:26:35.55799).
CONTEXT: SQL statement "UPDATE ONLY "public"."stock_move_line" SET "location_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "location_id""
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
Edited by Thomas Winteler