View source | Discuss this page | Page history | Printable version   

Retail:Developers Guide/How-to/How to add an approval



There are several actions in Web POS which could need an approval of a supervisor because in some stores cashiers do not have rights to do some actions.

This document explains how to implement this action.

Already exist few approvals implemented: Approvals List


Add the approval in the action

This section explains how to add the approval in a component action:

It is enough to add this javascript code, for example, in a tap of a button:

tap: function () {
  var me = this;
  me.model, 'OBPOS_approval.deleteLine', function (approved, supervisor, approvalType) {
  if (approved) {
    line: me.owner.line

It is simple, we have to call OB.UTIL.Approval.requestApproval with parameters: window model, property searchKey(a string or an array of searchKeys) and the callback (the action of the button). If approved parameter is true the credentials of the supervisor are ok and we can do the action.

Create Preferences

Yoy need to create a property in the Reference window in the Property Configuration.

Each action requiring approval can have its own supervisors, thus it is possible for a user to be supervisor of action A but not action's B supervisor.

Each Approvable Action require of a different preference to be set:

Note that, as opposite as the other security preferences, supervisor preferences require of explicit setting, this means automatic roles are not considered as supervisor unless there is a preference defining it.

Back to How-to

Add custom messages to the approval

Bulbgraph.png   Starting from RR15Q1 below functionality is available

It is possible to add custom messages to the approval in order to give an accurate vision of what you are asking for an approval.

OB.UTIL.HookManager.registerHook('OBPOS_CheckPaymentApproval', function (args, callbacks) {
  var yourMessage = 'I am a dummy message'
    approval: 'DUMMY_approval.test',
    message: 'DUMMY_approval.test',
    params: ['<div style="font-size:16px;padding-left:0.5em">' + yourMessage + '</div>']
  // Continue normal process
  OB.UTIL.HookManager.callbackExecutor(args, callbacks);

When you want to throw the approval you can send the property params with the custom message you want to send as its value. HTML code is accepted in order to give a custom style.

Retrieved from ""

This page has been accessed 3,361 times. This page was last modified on 26 January 2015, at 11:35. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.