Criptomart/red-supermercados-coop#4 add pos_full_refund from OCA/pos/pull/1458
This commit is contained in:
parent
5c213a3d6a
commit
6b1b032101
12 changed files with 714 additions and 0 deletions
27
pos_full_refund/static/src/js/TicketScreen.esm.js
Normal file
27
pos_full_refund/static/src/js/TicketScreen.esm.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import TicketScreen from "point_of_sale.TicketScreen";
|
||||
import {patch} from "@web/core/utils/patch";
|
||||
|
||||
patch(TicketScreen.prototype, "pos_full_refund.TicketScreen", {
|
||||
onDoFullRefund() {
|
||||
const order = this.getSelectedSyncedOrder();
|
||||
if (!order) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set all orderlines to be fully refunded
|
||||
// In Odoo 16, we use env.pos.toRefundLines instead of order.uiState.lineToRefund
|
||||
for (const line of order.get_orderlines()) {
|
||||
const refundableQty = line.get_quantity() - line.refunded_qty;
|
||||
if (refundableQty > 0) {
|
||||
// Get or create refund detail for this orderline
|
||||
const toRefundDetail = this._getToRefundDetail(line);
|
||||
toRefundDetail.qty = refundableQty;
|
||||
}
|
||||
}
|
||||
|
||||
// Trigger the refund process
|
||||
this._onDoRefund();
|
||||
},
|
||||
});
|
||||
26
pos_full_refund/static/src/xml/pos_full_refund.xml
Normal file
26
pos_full_refund/static/src/xml/pos_full_refund.xml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<t
|
||||
t-name="TicketScreen"
|
||||
t-inherit="point_of_sale.TicketScreen"
|
||||
t-inherit-mode="extension"
|
||||
owl="1"
|
||||
>
|
||||
<xpath
|
||||
expr="//div[hasclass('leftpane')]//div[hasclass('control-buttons')]"
|
||||
position="inside"
|
||||
>
|
||||
<button
|
||||
id="set_full_refund_button"
|
||||
class='control-button btn btn-light rounded-0 fw-bolder'
|
||||
t-if="_selectedSyncedOrder"
|
||||
t-on-click="() => this.onDoFullRefund()"
|
||||
>
|
||||
<i class="fa fa-cart-arrow-down" />
|
||||
Do Full Refund
|
||||
</button>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
Loading…
Add table
Add a link
Reference in a new issue