---
title: "Hooks, Jobs and Integrations"
space: "Frappoint"
url: "https://docs.navari.co.ke/frappoint/hooks-jobs-and-integrations"
updated: "2026-11-30"
---

Everything Frappoint wires into Frappe, ERPNext and HRMS is declared in `frappoint/hooks.py`.

## Install and migrate

| Hook | What it does |
| --- | --- |
| `after_install` → `frappoint.setup.setup.execute` | Sets default values in Service Appointment Settings. |
| `after_migrate` | Shows or hides the Hospitality desktop icon (`sync_hospitality_visibility`), and installs hospitality defaults: booking sources, room move reasons, the Room Post Mode of Payment, and permission grants. |
| `fixtures` | Roles (spa, HR and hotel roles), lost reasons, custom fields (below) and the Booking Desk custom HTML block. |
| `required_apps` | `erpnext`, `hrms`, `payments`. |

## Custom fields on standard DocTypes

| DocType | Field | Used for |
| --- | --- | --- |
| Customer | Visible on Booking Desk | Customers listed in the Booking Desk customer search. |
| Sales Partner | Supplier | The Supplier a partner's commission is billed to. |
| Sales Invoice | Commission Billed On | The commission Purchase Invoice that billed it. |
| Sales Invoice | Guest Folio | The folio a settlement invoice came from. |
| Sales Invoice, POS Invoice | Charge to Room (Guest), Room | Outlet bills charged to an in-house guest's room. |
| Selling Settings | Commission Payable On, Commission Item, Partner Supplier Group | Sales Partner commission settings. |
| Sales Invoice, Material Request, Stock Entry | Service Appointment | Links back to the appointment. |
| Sales Invoice | Service Booking | Links back to the booking. |

## Document events

| DocType | Event | What Frappoint does |
| --- | --- | --- |
| Every DocType | `after_insert` | While sample data is being generated, logs the new document so removal deletes exactly what was made. Does nothing otherwise. |
| Purchase Invoice | `on_cancel`, `on_trash` | Makes the Sales Invoices a commission invoice billed payable again. |
| Item | `on_update` | Keeps a Service Type's Item Group in step with its Item. |
| Service Appointment | `on_update`, `on_update_after_submit`, `on_cancel`, `on_trash` | For appointments charged to a hotel room: posts each guest's share to their folio on completion, and closes participants on cancellation or no-show. |
| POS Invoice, Sales Invoice | `validate`, `on_submit`, `on_cancel` | Room posting: checks the guest can charge to the room, posts the lines to the folio, reverses them on cancel. |
| Stay Reservation | `on_update` | Cancels scheduled wake-up calls when a stay ends. |
| Leave Application | `on_submit`, `on_update_after_submit`, `on_cancel` | Creates or cancels the matching Service Provider Unavailability. |

Hotel-related events check the hospitality flag first and return at once when hospitality is off.

## Scheduled jobs

| Frequency | Job | What it does |
| --- | --- | --- |
| Every scheduler tick (`all`) | `frappoint.utils.expire_pending_payment_holds` | Releases spa slots held for payments that weren't made within Payment Hold Minutes. |
| Every minute | `vuna_hospitality.services.reservations.expire_holds` | Releases hotel holds that weren't confirmed in time. |
| Hourly | `frappoint.scheduler.refresh_availability_counters.execute` | Refreshes the spa's availability counters. |
| Hourly | `vuna_hospitality.services.notifications.send_timed` | Sends before-arrival, before-departure and after-stay guest messages. |
| Hourly | `vuna_hospitality.services.group_blocks.release_due_blocks` | Releases group blocks' unbooked rooms once the business date reaches their cutoff. |
| Daily | `frappoint.utils.purge_old_slots`, `replenish_slot_window` | Removes past appointment slots and creates new ones up to Max Advance Days. |
| Daily | `vuna_hospitality.services.rooms.refresh_all_sellability` | Puts rooms in and out of service as room state periods start and end. |
| Daily | `vuna_hospitality.services.inventory.daily_inventory_maintenance` | Keeps the nightly inventory counters in step. |
| Daily | `vuna_hospitality.services.guest_history.propose_matches` | Proposes guest profiles for guests on completed appointments. |
| Daily | `vuna_hospitality.services.guest_dedup.propose_duplicates` | Proposes possible duplicate guest profiles for review. |
| Daily | `vuna_hospitality.services.data_retention.purge_expired_id_documents` | Clears ID documents past their retention period. |

The **night audit** is not scheduled: a person always starts it. It runs as a background job on the `long` queue, as does sample data generation.

## Permissions

- `permission_query_conditions` and `has_permission` limit every property-scoped hotel DocType to the user's properties, and hide restricted guest incidents from everyone but managers and the data protection officer.
- `add_to_apps_screen` adds Frappoint to the apps screen, checked by `frappoint.check_app_permission` (website users are refused).

## Custom hook: inventory demand

`hospitality_inventory_demand_sources` is a Frappoint-specific hook: a list of functions that count the rooms held or sold per room type and night. Frappoint registers stays (`reservations.occupancy_demand`) and group blocks (`group_blocks.block_demand`). Another app can add its own source, for example rooms held by a channel manager, and the inventory counters and rebuilds will include it.

## Integrations

| With | How |
| --- | --- |
| **ERPNext** | Items and Item Groups, Customers, Sales Invoices (spa bookings and folio settlement, with credit notes and receivables), Payment Entries, Journal Entries (cashier over/short), Payment Requests, POS Invoices, Material Requests and Stock Entries (consumables, service orders), Purchase Invoices (commission), Assets and Asset Repairs, Currency Exchange, Sales Taxes and Item Tax Templates. |
| **Frappe HR** | Employees (service providers, housekeeping staff), Shift Assignments, Holiday Lists, Leave Applications. |
| **Payments app** | Payment gateways (`frappoint/payments.py`), payment links, and M-Pesa STK push for folio payments and deposits. |
| **Google Calendar** | Appointment Events through Frappe's Google Calendar integration, with Google Meet links. |
| **SMS and email** | Frappe SMS Settings and Email Queue, for appointment confirmations and guest notification rules. |
| **Tax compliance** | None built in. Settlement creates standard Sales Invoices through ERPNext's own submit, so a tax-compliance app (for example for KRA eTIMS) runs on them as usual. |
