Search code examples
openbravo

How to disable 'Recent Documents' and 'Recenet Views' in Openbravo?


After Completing the Invoice user cannot see the Invoice in any menu [For example]. But from the Recent documents user able to open the record and edit it. To avoid this either have to Disable Recent Documents and or make the record read-only.

Coming to Recent Views, sometimes we disabling Menus under certain Roles but user still able to open those menus from Recent Views and perform the actions.

Expecting any configuration changes that might disable these troublesome features without doing any changes to the Core.


Solution

  • I have checked the official documentation.I haven't found the option to disable to recent documents.

    Alternatives:-

    1)Mark the role as portal user. Corns:-User won't have access to any of the menu's.Access should be given using a widget.

    2)Using a trigger which will override the recent documents will null

    I tried using the business event handler to block the recent documents but system is not allowing.So i went with trigger approach.

    Use the below trigger it will erase all the recent documents.(Only once ther user is logged out)

     create or replace TRIGGER DB_PREFIX_DISABLE_RECENTDOC BEFORE
      INSERT OR
      UPDATE
        --OF PROPERTY,VALUE
        ON AD_PREFERENCE FOR EACH ROW
        --WHEN (NEW.PROPERTY='OBUIAPP_RecentDocumentsList')
        BEGIN IF AD_isTriggerEnabled()='N' THEN RETURN;
    END IF;
    IF(:new.PROPERTY ='OBUIAPP_RecentDocumentsList') THEN
      IF (INSERTING OR UPDATING ) THEN
        :NEW.VALUE:=NULL;
      END IF;
    END IF;
    END;