Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions pos_pay/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "Instant Pay",
"summary": """
Pay directly from Ticked Screen
""",
"description": """
Pay directly from Ticked Screen
""",
"author": "Odoo",
"website": "https://www.odoo.com/",
"category": "Tutorials",
"version": "0.1",
"application": True,
"installable": True,
"depends": ["base", "point_of_sale"],
"data": [],
"assets": {
"point_of_sale._assets_pos": [
"pos_pay/static/src/app/screens/ticket_screen.js",
"pos_pay/static/src/app/screens/ticket_screen.xml",
],
},
"license": "AGPL-3",
}
14 changes: 14 additions & 0 deletions pos_pay/static/src/app/screens/ticket_screen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { patch } from "@web/core/utils/patch";
import { TicketScreen } from "@point_of_sale/app/screens/ticket_screen/ticket_screen";

patch(TicketScreen.prototype, {
payFromTicketScreen() {
const selectedOrder = this.getSelectedOrder();
if (!selectedOrder) {
this.env.services.notification.add("No order selected");
return;
}
this.setOrder(selectedOrder);
this.pos.pay();
},
});
27 changes: 27 additions & 0 deletions pos_pay/static/src/app/screens/ticket_screen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>

<templates id="template" xml:space="preserve">
<t
t-name="pos_pay.TicketScreen"
t-inherit="point_of_sale.TicketScreen"
t-inherit-mode="extension"
>
<xpath expr="//div[@t-else and hasclass('pads')]" position="inside">
<button class="button validation load-order-button w-100 btn btn-lg btn-primary py-3"
t-att-disabled="!_selectedSyncedOrder"
t-on-click="() => this.payFromTicketScreen()">
<div class="text-">Instant Pay</div>
</button>
</xpath>

<xpath expr="//div[hasclass('switchpane')]" position="inside">
<button
class="btn-switchpane load-order-button primary btn btn-primary btn-lg lh-lg w-50 py-3"
t-att-disabled="!_selectedSyncedOrder"
t-if="!isOrderSynced"
t-on-click="() => this.payFromTicketScreen()">
<div>Pay</div>
</button>
</xpath>
</t>
</templates>