Skip to content

Commit bf2fcda

Browse files
committed
[MIG] pos_payment_disable_multiselection: Migration to 17.0
1 parent 278148f commit bf2fcda

File tree

3 files changed

+25
-35
lines changed

3 files changed

+25
-35
lines changed

pos_payment_disable_multiselection/__manifest__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"depends": ["point_of_sale"],
88
"data": [],
99
"assets": {
10-
"point_of_sale.assets": [
11-
"pos_payment_disable_multiselection/static/src/**/*",
10+
"point_of_sale._assets_pos": [
11+
"pos_payment_disable_multiselection/static/src/app/screens/payment_screen/payment_screen.js",
1212
],
1313
},
1414
"license": "LGPL-3",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/** @odoo-module **/
2+
3+
import {PaymentScreen} from "@point_of_sale/app/screens/payment_screen/payment_screen";
4+
import {patch} from "@web/core/utils/patch";
5+
6+
patch(PaymentScreen.prototype, {
7+
addNewPaymentLine(paymentMethod) {
8+
const matchingLines = this.currentOrder
9+
.get_paymentlines()
10+
.filter((line) => line.payment_method.id === paymentMethod.id);
11+
12+
if (matchingLines.length > 0) {
13+
// Delete all duplicate payment lines except the first
14+
for (let i = 1; i < matchingLines.length; i++) {
15+
this.deletePaymentLine(matchingLines[i].cid);
16+
}
17+
// Select the first line
18+
this.selectPaymentLine(matchingLines[0].cid);
19+
return true;
20+
}
21+
return super.addNewPaymentLine(paymentMethod);
22+
},
23+
});

pos_payment_disable_multiselection/static/src/js/PaymentScreen.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)