first commit

This commit is contained in:
Suherdy Yacob 2026-06-15 10:49:57 +07:00
commit d44defdba1
5 changed files with 55 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.pyc
__pycache__/

7
README.md Normal file
View File

@ -0,0 +1,7 @@
# POS Sync Before Print
Ensure POS receipts are only printed after the order is successfully synced with the server.
## Description
This module patches the Point of Sale printReceipt method to check the synchronization state of the order. If the order has not been synchronized with the server yet, printing is blocked. During offline validation, the order validation proceeds normally but the receipt is not printed automatically, and a warning is shown if printing manually.

1
__init__.py Normal file
View File

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

22
__manifest__.py Normal file
View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
{
'name': 'POS Sync Before Print',
'version': '19.0.1.0.0',
'summary': 'Ensure POS receipts are only printed after the order is successfully synced with the server.',
'description': """
Ensure POS receipts are only printed after the order is successfully synced with the server.
If an order is not synced, the receipt will not be printed automatically, and manual printing will show a warning popup.
""",
'author': 'Suherdy Yacob',
'category': 'Point of Sale',
'depends': ['point_of_sale'],
'data': [],
'assets': {
'point_of_sale._assets_pos': [
'pos_sync_before_print/static/src/app/services/pos_store_patch.js',
],
},
'installable': True,
'auto_install': False,
'license': 'LGPL-3',
}

View File

@ -0,0 +1,23 @@
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { PosStore } from "@point_of_sale/app/services/pos_store";
import { _t } from "@web/core/l10n/translation";
import { AlertDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
patch(PosStore.prototype, {
async printReceipt(options = {}) {
const order = options.order || this.getOrder();
if (order && !order.isSynced && !options.printBillActionTriggered) {
this.dialog.add(AlertDialog, {
title: _t("Unsynced Order"),
body: _t(
"This order has not been synchronized with the server yet. " +
"Please wait for the server synchronization to complete before printing the receipt."
),
});
return false;
}
return super.printReceipt(...arguments);
}
});