---
title: "Close Odoo 17 POS Sessions with Server Actions | OzonLayer"
description: "Learn how to automate your retail end-of-day. This guide shows you how to create an Odoo 17 Server Action to batch close POS sessions and post journal entries."
url: https://ozonlayer.com/how-to-close-odoo-17-pos-sessions-with-server-actions-ozonlayer/
---

Odoo apps & modules

# Automating Your Retail Workflow: How to Close POS Sessions in Odoo 17 via Server Actions

**Usman Anwar** OzonLayer · Odoo Silver Partner  1 Apr 2026 Updated 22 Oct 2026 2 min read

Managing a busy retail environment means every second counts. In **Odoo 17**, while the Point of Sale (POS) is more fluid than ever, managers often find themselves needing a faster way to wrap up the day or handle multiple sessions at once.

Today at **Ozonlayer**, we’re diving into a quick technical “hack” to streamline your end-of-day operations using **Server Actions**.

## Why Use a Server Action to Close Sessions?

Normally, closing a session involves several clicks: closing the interface, validating the orders, and clicking “Close Session” in the backend. A Server Action allows you to:

- **Batch Close:** Close multiple sessions across different branches simultaneously.
- **Automate:** Trigger a close based on specific conditions or schedules.
- **Efficiency:** Reduce the manual oversight required for daily accounting entries.

---

## Step-by-Step Guide: Creating the “Quick Close” Action

To get started, ensure you have **Developer Mode** activated in your Odoo 17 instance.

### 1. Create the Action

Navigate to **Settings > Technical > Actions > Server Actions** and create a new record.

- **Action Name:** `Ozonlayer: Force Close Session`
- **Model:** `pos.session`
- **Action To Do:** `Execute Code`

### 2. The Python Logic

In the code editor, input the following logic. This script targets sessions that are currently open and triggers Odoo’s native closing and posting sequence.

Python

```
for record in records:
    if record.state == 'opened':
        # Validates and posts the journal entries
        record.action_pos_session_closing_control()
```

### 3. Make it Accessible

Click the **Create Contextual Action** button at the top of the form. This adds your new tool to the “Action” gear icon menu in the POS Session list view.

---

## What Happens Under the Hood?

When you trigger `action_pos_session_closing_control()`, Odoo 17 performs several critical tasks:

1. **Order Validation:** It ensures all orders in the session are synchronized.
2. **Journal Entries:** It automatically generates the moves in your Accounting app.
3. **Stock Moves:** It finalizes the inventory depletions based on the day’s sales.

> **Ozonlayer Pro-Tip:** If your POS has a cash discrepancy (the “Real” balance doesn’t match the “Expected” balance), Odoo may prevent a background close. Ensure your POS Journal has **Default Profit/Loss Accounts** configured to allow Odoo to post the difference automatically.

---

## Final Thoughts

At **Ozonlayer**, we believe Odoo should work for you, not the other way around. By implementing small automations like this Server Action, you free up your management team to focus on what really matters: your customers.

**Need help customizing your Odoo 17 workflow?** Reach out to the Ozonlayer team today for expert implementation and support!

## Related Odoo Guides and Services

Keep exploring: these guides and services are the most relevant next steps for this topic. Need help applying it to your business? Our Odoo team in Saudi Arabia can assess your requirements and recommend the right setup.

- [POS system for retail and restaurants in Saudi Arabia](https://ozonlayer.com/pos-system-in-saudi-arabia/)
- [Top 7 custom Odoo modules for Saudi businesses](https://ozonlayer.com/top-7-custom-odoo-modules-every-saudi-business-needs/)
- [Odoo inventory management software in Saudi Arabia](https://ozonlayer.com/odoo-inventory-management-software-in-saudi-arabia/)
- [Odoo accounting software for ZATCA e-invoicing](https://ozonlayer.com/odoo-accounting-software-in-saudi-arabia/)
- [E-commerce platform for Saudi businesses](https://ozonlayer.com/e-commerce-platform-saudi-arabia/)
- [Odoo development in Saudi Arabia](https://ozonlayer.com/odoo-development-services-in-saudi-arabia/)
- [Odoo support in Saudi Arabia](https://ozonlayer.com/odoo-support-services-in-saudi-arabia/)
- [All Odoo services in Saudi Arabia](https://ozonlayer.com/odoo-services-in-ksa/)

Share this article

Written by  **Usman Anwar**

Published by OzonLayer, an official Odoo Silver Partner that helps businesses in Saudi Arabia and the United Kingdom implement, customise, migrate and support Odoo ERP.

[About OzonLayer](https://ozonlayer.com/about-us/)   [Our Odoo services](https://ozonlayer.com/services/)   [More articles](https://ozonlayer.com/blog/)

**Talk to an Odoo expert**

Get practical advice on your Odoo project from our consultants in Riyadh and London.

[WhatsApp us](https://wa.me/447477204638)   [Contact us](https://ozonlayer.com/contact-us/)

## Keep reading

[All articles](https://ozonlayer.com/blog/)

Latest ERP comparisons 3 Nov 2026 · 13 min read

### Odoo vs Xero (2026): When to Move from Accounting Software to ERP

Xero is accounting software with an app marketplace around it; Odoo is an integrated ERP where accounting, stock, sales, CRM, projects and e-commerce share…

[Read article](https://ozonlayer.com/odoo-vs-xero/)

Latest Case studies 18 Oct 2026 · 13 min read

### Odoo POS for Restaurants: How Sweet & Salty Cut Food Waste by 30%

This case study shows how Odoo POS for restaurants helped Sweet & Salty, a growing food and beverage business, replace manual cashier work with…

[Read article](https://ozonlayer.com/odoo-pos-for-restaurants-case-study/)

Latest Case studies 18 Oct 2026 · 13 min read

### Odoo for IT Services: How DPSIT Achieved 40% Faster Project Billing

This case study shows how Odoo IT services helped DPSIT (Data Solutions for Communication) connect sales, project delivery, timesheets and accounting in one system.…

[Read article](https://ozonlayer.com/odoo-for-it-services-case-study/)

## Want to see this working in your business?

Talk to a certified Odoo consultant about your requirements. We’ll give you a straight answer on scope, timeline and budget, with no obligation.

[WhatsApp **Chat with us now**](https://wa.me/447477204638)   [Call **+44 7477 204638**](tel:+447477204638)   [Email **info@ozonlayer.com**](mailto:info@ozonlayer.com)
