feat: restrict split or transfer of discount and manual adjustment lines in POS split bill screen

This commit is contained in:
Suherdy Yacob 2026-06-08 10:12:46 +07:00
parent f425cd2e2c
commit 4b32aba967
4 changed files with 42 additions and 0 deletions

View File

@ -5,6 +5,7 @@ This Odoo 19 module enhances the security and auditability of the Point of Sale
## Features
- **Mandatory PIN on Table Selection**: Prevents unauthorized access to tables. Every table selection triggers a PIN prompt to identify the employee taking the order.
- **Block Discount Split/Transfer**: Prevents discount lines (including reward lines, global discounts, and negative price/manual adjustment lines) from being manually split or transferred on the POS split bill screen.
- **Mandatory PIN on Load Order**: Enforces PIN entry when a draft order is loaded/resumed from the Orders tab (`TicketScreen`).
- **Mandatory PIN on Payment**: Requires PIN authentication before processing payments to ensure the transaction is handled by an authorized employee.
- **Role-Based Payment Gating**: Cross-checks employee roles (using `pos_employee_role`) to prevent roles like 'waiter' from processing payments.

View File

@ -0,0 +1,20 @@
import { PosOrderline } from "@point_of_sale/app/models/pos_order_line";
import { patch } from "@web/core/utils/patch";
patch(PosOrderline.prototype, {
get isDiscountLine() {
return (
this.is_reward_line ||
(this.config.discount_product_id && this.product_id.id === this.config.discount_product_id.id) ||
this.price_unit < 0 ||
this.prices?.total_included < 0
);
},
isGlobalDiscountApplicable() {
if (this.isDiscountLine) {
return false;
}
return super.isGlobalDiscountApplicable();
},
});

View File

@ -0,0 +1,13 @@
/** @odoo-module */
import { patch } from "@web/core/utils/patch";
import { SplitBillScreen } from "@pos_restaurant/app/screens/split_bill_screen/split_bill_screen";
patch(SplitBillScreen.prototype, {
onClickLine(line) {
if (line.isDiscountLine) {
return;
}
super.onClickLine(...arguments);
}
});

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="pos_custom_access.SplitBillScreen" t-inherit="pos_restaurant.SplitBillScreen" t-inherit-mode="extension">
<xpath expr="//Orderline" position="attributes">
<attribute name="t-if">!line.isDiscountLine</attribute>
</xpath>
</t>
</templates>