first commit
This commit is contained in:
commit
d44defdba1
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.pyc
|
||||||
|
__pycache__/
|
||||||
7
README.md
Normal file
7
README.md
Normal 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
1
__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
22
__manifest__.py
Normal file
22
__manifest__.py
Normal 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',
|
||||||
|
}
|
||||||
23
static/src/app/services/pos_store_patch.js
Normal file
23
static/src/app/services/pos_store_patch.js
Normal 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);
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user