This question has been flagged

I am setting up our warehouse and I am encountering many problems when adding locations or warehouse.

Hell appears to have broke loose in the location structure and I don't know how to restore it. I couldn't find a way to manage the locations if they are not internal locations. If they are a virtual location or a supplier location, they do not appear in the "locations" menu and I can't delete or modify them.

I am not sure what manipulations may have caused this, but it completely blocks the warehouse app and I can't add incoming orders properly, without having errors such as this:

Client Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, *self.params) File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1128, in call_kw return self._call_kw(req, model, method, args, kwargs) File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1120, in _call_kw return getattr(req.session.model(model), method)(args, **kwargs) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 42, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 30, in proxy_method result = self.session.send(self.service_name, method, *args) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 103, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 296, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, params) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, args, *kwargs) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/usr/lib/pymodules/python2.7/openerp/addons/stock/stock.py", line 82, in name_get res = self._complete_name(cr, uid, ids, 'complete_name', None, context=context) File "/usr/lib/pymodules/python2.7/openerp/addons/stock/stock.py", line 91, in _complete_name names = [m.name] File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 499, in __getattr__ raise AttributeError(e) AttributeError: 'Field name not found in browse_record(stock.location, 12)'

EDIT: I managed to trace it down to a mistake on my part. Apparently, according to the launchpad thread /openobject-addons/+bug/1217146 , I removed the default warehouse that the stock module defines from my system. Apparently, if I upgrade the stock module, I should have it back again.

However, I have no way to update since either updating, upgrading and uninstalling the module yield this error:

Client Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, *self.params) File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1132, in call_button action = self._call_kw(req, model, method, args, {}) File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1120, in _call_kw return getattr(req.session.model(model), method)(args, **kwargs) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 42, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 30, in proxy_method result = self.session.send(self.service_name, method, *args) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 103, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 296, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 622, in dispatch security.check(db,uid,passwd) File "/usr/lib/pymodules/python2.7/openerp/service/security.py", line 40, in check pool = pooler.get_pool(db) File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 49, in get_pool return get_db_and_pool(db_name, force_demo, status, update_module)[1] File "/usr/lib/pymodules/python2.7/openerp/pooler.py", line 33, in get_db_and_pool registry = RegistryManager.get(db_name, force_demo, status, update_module) File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 203, in get update_module) File "/usr/lib/pymodules/python2.7/openerp/modules/registry.py", line 233, in new openerp.modules.load_modules(registry.db, force_demo, status, update_module) File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 350, in load_modules force, status, report, loaded_modules, update_module) File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 256, in load_marked_modules loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks) File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 188, in load_module_graph load_data(module_name, idref, mode) File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 76, in <lambda> load_data = lambda args: _load_data(cr, *args, kind='data') File "/usr/lib/pymodules/python2.7/openerp/modules/loading.py", line 124, in _load_data tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report) File "/usr/lib/pymodules/python2.7/openerp/tools/convert.py", line 954, in convert_xml_import obj.parse(doc.getroot()) File "/usr/lib/pymodules/python2.7/openerp/tools/convert.py", line 847, in parse self._tagsrec.tag File "/usr/lib/pymodules/python2.7/openerp/tools/convert.py", line 814, in _tag_record id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context ) File "/usr/lib/pymodules/python2.7/openerp/addons/base/ir/ir_model.py", line 969, in _update res_id = model_obj.create(cr, uid, values, context=context) File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4506, in create cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2)) File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 161, in wrapper return f(self, *args, *kwargs) File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 226, in execute res = self._obj.execute(query, params) IntegrityError: insert or update on table "stock_warehouse" violates foreign key constraint "stock_warehouse_lot_input_id_fkey" DETAIL: Key (lot_input_id)=(12) is not present in table "stock_location".

The database already contain important info and is otherwise fully configured, so I can't really restart it.

Avatar
Discard

Did you try updating from the console with the -d YOUR DATABASE NAME -u stock parameters

Author

Nope. Can you eleborate on the procedure? I am not a database expert. Thanks!

Best Answer

Hi Dany,

Maybe this could help : https://accounts.openerp.com/forum/Help-1/question/39598#39601

Avatar
Discard
Author

From this, I managed to trace back the errors described below. Also, the fact that you used some French names helped me greatly.

Author Best Answer

I have accidentally found a way to resolve the problem.

This has been done on a recovered database.

It appears there was, unknown to me, a PoS session active without a PoS terminal, which apparently screwed the warehouse module and stopping me from uninstalling the warehouse module. By manually deleting the PoS records and closing the PoS session afterward, the warehouse module and the PoS module were successfully uninstalled and then reinstalled, which cleaned up the problem. Everything appears to work in order now.

Avatar
Discard