[REF] all: pass pre-commit on the whole repo
Needed for the lint job of the CI to go green. Mostly automatic hook fixes (black, isort, prettier, pyupgrade, autoflake, whitespace). By hand: - flake8: two unused imports, an ambiguous variable name `l`. - pylint-odoo mandatory: manifest keys equal to their default value (installable, application, data, external_dependencies). - end-of-file-fixer skips *.patch too, like trailing-whitespace: the upstream patches stay as git format-patch wrote them. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d9d9e8be2d
commit
fbd43bb459
45 changed files with 330 additions and 295 deletions
|
|
@ -2,33 +2,32 @@ import { TicketScreen } from "@point_of_sale/app/screens/ticket_screen/ticket_sc
|
|||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
patch(TicketScreen.prototype, {
|
||||
/**
|
||||
* Mark every refundable line of the selected order for a full refund and
|
||||
* trigger the standard refund flow.
|
||||
*
|
||||
* `onDoRefund` is what the "Refund" action of the ticket screen calls: it
|
||||
* builds the negative lines, links the combo children, carries over the
|
||||
* fiscal position and the partner, and switches to the destination order.
|
||||
*/
|
||||
async onDoFullRefund() {
|
||||
const order = this.getSelectedOrder();
|
||||
if (!order) {
|
||||
return;
|
||||
}
|
||||
for (const line of order.lines) {
|
||||
const toRefundDetails = line
|
||||
.getAllLinesInCombo()
|
||||
.map((comboLine) => this.getToRefundDetail(comboLine));
|
||||
for (const toRefundDetail of toRefundDetails) {
|
||||
// Per line, and net of what was already refunded: the same
|
||||
// guard the core applies in `_onUpdateSelectedOrderline`.
|
||||
const refundableQty =
|
||||
toRefundDetail.line.qty - toRefundDetail.line.refunded_qty;
|
||||
if (refundableQty > 0) {
|
||||
toRefundDetail.qty = refundableQty;
|
||||
/**
|
||||
* Mark every refundable line of the selected order for a full refund and
|
||||
* trigger the standard refund flow.
|
||||
*
|
||||
* `onDoRefund` is what the "Refund" action of the ticket screen calls: it
|
||||
* builds the negative lines, links the combo children, carries over the
|
||||
* fiscal position and the partner, and switches to the destination order.
|
||||
*/
|
||||
async onDoFullRefund() {
|
||||
const order = this.getSelectedOrder();
|
||||
if (!order) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.onDoRefund();
|
||||
},
|
||||
for (const line of order.lines) {
|
||||
const toRefundDetails = line
|
||||
.getAllLinesInCombo()
|
||||
.map((comboLine) => this.getToRefundDetail(comboLine));
|
||||
for (const toRefundDetail of toRefundDetails) {
|
||||
// Per line, and net of what was already refunded: the same
|
||||
// guard the core applies in `_onUpdateSelectedOrderline`.
|
||||
const refundableQty = toRefundDetail.line.qty - toRefundDetail.line.refunded_qty;
|
||||
if (refundableQty > 0) {
|
||||
toRefundDetail.qty = refundableQty;
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.onDoRefund();
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,27 +14,24 @@ import { registry } from "@web/core/registry";
|
|||
* negated at its full quantity, without touching the numpad.
|
||||
*/
|
||||
registry.category("web_tour.tours").add("pos_full_refund_tour", {
|
||||
steps: () =>
|
||||
[
|
||||
Chrome.startPoS(),
|
||||
Dialog.confirm("Open Register"),
|
||||
ProductScreen.addOrderline("Desk Pad", "2", "3"),
|
||||
ProductScreen.addOrderline("Letter Tray", "3", "2"),
|
||||
ProductScreen.clickPayButton(),
|
||||
PaymentScreen.clickPaymentMethod("Bank"),
|
||||
PaymentScreen.clickValidate(),
|
||||
ReceiptScreen.isShown(),
|
||||
ReceiptScreen.clickNextOrder(),
|
||||
steps: () =>
|
||||
[
|
||||
Chrome.startPoS(),
|
||||
Dialog.confirm("Open Register"),
|
||||
ProductScreen.addOrderline("Desk Pad", "2", "3"),
|
||||
ProductScreen.addOrderline("Letter Tray", "3", "2"),
|
||||
ProductScreen.clickPayButton(),
|
||||
PaymentScreen.clickPaymentMethod("Bank"),
|
||||
PaymentScreen.clickValidate(),
|
||||
ReceiptScreen.isShown(),
|
||||
ReceiptScreen.clickNextOrder(),
|
||||
|
||||
ProductScreen.clickRefund(),
|
||||
TicketScreen.selectOrder("-0001"),
|
||||
TicketScreen.clickControlButton("Do Full Refund"),
|
||||
ProductScreen.clickRefund(),
|
||||
TicketScreen.selectOrder("-0001"),
|
||||
TicketScreen.clickControlButton("Do Full Refund"),
|
||||
|
||||
{ ...ProductScreen.back(), isActive: ["mobile"] },
|
||||
ProductScreen.isShown(),
|
||||
inLeftSide([
|
||||
...Order.hasLine("Desk Pad", "-2"),
|
||||
...Order.hasLine("Letter Tray", "-3"),
|
||||
]),
|
||||
].flat(),
|
||||
{ ...ProductScreen.back(), isActive: ["mobile"] },
|
||||
ProductScreen.isShown(),
|
||||
inLeftSide([...Order.hasLine("Desk Pad", "-2"), ...Order.hasLine("Letter Tray", "-3")]),
|
||||
].flat(),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue