Skip to content
Snippets Groups Projects
Commit 8a232e7f authored by Joren Van Onder's avatar Joren Van Onder
Browse files

[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.
parent 973b94bd
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -772,7 +772,6 @@
<field name="arch" type="xml">
<form string="Point of Sale Session">
<header>
<button name="open_cb" type="object" string="Validate &amp; Open Session" states="opening_control" class="oe_highlight"/>
<button name="open_frontend_cb" type="object" string="Continue Selling" states="opened"
class="oe_highlight"/>
<button name="cashbox_control" type="workflow" string="End of Session"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment