feat: disable numpad sign change and restrict quantity modifications for Ojol discount lines
This commit is contained in:
parent
42d87e2e77
commit
a8e72ba7fb
@ -21,6 +21,8 @@ This Odoo 19 module enhances the security and auditability of the Point of Sale
|
|||||||
- **Incremental Printing on Send**: When additional items are added to an already sent order, the automatic print on "Send" is filtered to print *only the newly added (additional) items*, preventing duplicate printing of already served items.
|
- **Incremental Printing on Send**: When additional items are added to an already sent order, the automatic print on "Send" is filtered to print *only the newly added (additional) items*, preventing duplicate printing of already served items.
|
||||||
- **Unlock Register PIN/Selection Bypass**: Bypasses the PIN prompt and employee selection when unlocking the register. It unlocks directly with the current/last cashier. Note that opening the register (new session) still requires PIN entry.
|
- **Unlock Register PIN/Selection Bypass**: Bypasses the PIN prompt and employee selection when unlocking the register. It unlocks directly with the current/last cashier. Note that opening the register (new session) still requires PIN entry.
|
||||||
- **Stay on Current Order on Send**: Retains the POS UI on the current table/order screen after clicking "Send" rather than returning to the Floor Screen (table view).
|
- **Stay on Current Order on Send**: Retains the POS UI on the current table/order screen after clicking "Send" rather than returning to the Floor Screen (table view).
|
||||||
|
- **Disable Numpad Sign Change**: Disables the "+/-" button on the POS numpad to prevent manual negative price input or quantity negation.
|
||||||
|
- **Lock Ojol Discount Quantity**: Blocks quantity changes (via numpad and keyboard) and configuration edits (via long press) on the "Diskon Ojol" product lines on POS orders.
|
||||||
|
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|||||||
18
static/src/app/components/numpad/numpad_patch.js
Normal file
18
static/src/app/components/numpad/numpad_patch.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import { Numpad } from "@point_of_sale/app/components/numpad/numpad";
|
||||||
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
import { localization } from "@web/core/l10n/localization";
|
||||||
|
|
||||||
|
patch(Numpad.prototype, {
|
||||||
|
get buttons() {
|
||||||
|
return super.buttons.map((btn) => {
|
||||||
|
const btnObj = typeof btn === "object" ? { ...btn } : { value: btn };
|
||||||
|
if (btnObj.value === "-" || btnObj.value === "." || btnObj.value === "," || btnObj.value === localization.decimalPoint) {
|
||||||
|
btnObj.disabled = true;
|
||||||
|
}
|
||||||
|
return btnObj;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import { OrderSummary } from "@point_of_sale/app/screens/product_screen/order_summary/order_summary";
|
||||||
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
import { AlertDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
|
||||||
|
import { _t } from "@web/core/l10n/translation";
|
||||||
|
|
||||||
|
patch(OrderSummary.prototype, {
|
||||||
|
async updateSelectedOrderline({ buffer, key }) {
|
||||||
|
const order = this.pos.getOrder();
|
||||||
|
const selectedLine = order ? order.getSelectedOrderline() : null;
|
||||||
|
if (selectedLine && selectedLine.is_ojol_discount && this.pos.numpadMode === "quantity") {
|
||||||
|
this.numberBuffer.reset();
|
||||||
|
this.dialog.add(AlertDialog, {
|
||||||
|
title: _t("Cannot change quantity"),
|
||||||
|
body: _t("The quantity of the Ojol discount line cannot be modified."),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return super.updateSelectedOrderline(...arguments);
|
||||||
|
},
|
||||||
|
|
||||||
|
async onOrderlineLongPress(ev, orderline) {
|
||||||
|
if (orderline && orderline.is_ojol_discount) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return super.onOrderlineLongPress(...arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user