From 8a232e7f45eb52f6e5589ff1183d97bbd354cb7e Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Mon, 21 Sep 2015 14:56:21 +0200 Subject: [PATCH] [FIX] point_of_sale: don't automatically open the frontend from workflow It was preventing pos managers from opening sessions for pos users. Because pos users cannot open their own sessions, this means they couldn't do anything anymore. The reason for it is that the open frontend function checks whether or not the opened session belongs to the current user. If it doesn't, it throws a UserError, which prevents the session from being created. That's all open_frontend_cb did when called from wkf_action_open anyway, because the action it returns just gets ignored in the workflow. This also removes the validate & open session button because the only reason not to use the new dashboard to create a session is when you want to create a session for a different user. When doing that, validating and opening the session yourself makes no sense. When people do want to create a session for themselves without using the dashboard they can still do so, they will just have to save the session form and then click on the continue selling button. --- addons/point_of_sale/point_of_sale.py | 23 +-------------------- addons/point_of_sale/point_of_sale_view.xml | 1 - 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 461d0a4aafb..ab2cb895254 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -546,27 +546,6 @@ class pos_session(osv.osv): statement.unlink(context=context) return super(pos_session, self).unlink(cr, uid, ids, context=context) - def open_cb(self, cr, uid, ids, context=None): - """ - call the Point Of Sale interface and set the pos.session to 'opened' (in progress) - """ - if context is None: - context = dict() - - if isinstance(ids, (int, long)): - ids = [ids] - - this_record = self.browse(cr, uid, ids[0], context=context) - this_record.signal_workflow('open') - - context.update(active_id=this_record.id) - - return { - 'type' : 'ir.actions.act_url', - 'url' : '/pos/web/', - 'target': 'self', - } - def login(self, cr, uid, ids, context=None): this_record = self.browse(cr, uid, ids[0], context=context) this_record.write({ @@ -584,7 +563,7 @@ class pos_session(osv.osv): for st in record.statement_ids: st.button_open() - return self.open_frontend_cb(cr, uid, ids, context=context) + return True def wkf_action_opening_control(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state' : 'opening_control'}, context=context) diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index e192e5e9322..be2ef10d227 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -772,7 +772,6 @@
-