# HG changeset patch
# User Adrián Romero <adrianromero@openbravo.com>
# Date 1459423547 -7200
#      Thu Mar 31 13:25:47 2016 +0200
# Node ID b651d0a20f5115ea6a4e6de4fdd0f5435bca5c95
# Parent  0db6224fa2cb9d8bb2b6852f0b3105f76dc58892
Fixes issue 0032565: OBPRINT_PostPrint hook must be invoked also when document printed is a report

diff --git a/web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-print.js b/web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-print.js
--- a/web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-print.js
+++ b/web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-print.js
@@ -167,9 +167,14 @@
           } else {
             // Success. Try to print the pending receipts.
             OB.Model.OfflinePrinter.printPendingJobs();
-            if (args.callback) {
-              args.callback();
-            }
+            OB.UTIL.HookManager.executeHooks('OBPRINT_PostPrint', {
+              receipt: receipt
+            }, function () {
+              OB.debug('Executed hooks of OBPRINT_PostPrint');
+              if (args.callback) {
+                args.callback();
+              }
+            });
           }
         });
       }
