File tree Expand file tree Collapse file tree 3 files changed +25
-35
lines changed
pos_payment_disable_multiselection
app/screens/payment_screen Expand file tree Collapse file tree 3 files changed +25
-35
lines changed Original file line number Diff line number Diff line change 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/js/PaymentScreen.js " ,
1212 ],
1313 },
1414 "license" : "LGPL-3" ,
Original file line number Diff line number Diff line change 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+ } ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments