-
-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[14.0][FIX] pos_order_mgmt: Return with positive amounts
The sign of a return is forced to be negative so that it does not give an error later when confirming the order. In addition, a confirmation message is added in the event of returning more than the quantity sold.
- Loading branch information
Showing
4 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* Copyright Aures Tic - Jose Zambudio <jose@aurestic.es> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) */ | ||
odoo.define("pos_order_mgmt.ProductScreen", function (require) { | ||
"use strict"; | ||
|
||
const ProductScreen = require("point_of_sale.ProductScreen"); | ||
const Registries = require("point_of_sale.Registries"); | ||
|
||
const PosOrderMgmtProductScreen = (ProductScreen) => | ||
class extends ProductScreen { | ||
async _onClickPay() { | ||
if ( | ||
this.env.pos | ||
.get_order() | ||
.orderlines.any( | ||
(line) => | ||
line.returned_orderline_id && | ||
Math.abs(line.quantity) > line.max_return_qty | ||
) | ||
) { | ||
const {confirmed} = await this.showPopup("ConfirmPopup", { | ||
title: this.env._t("Incorrect quantities"), | ||
body: this.env._t( | ||
`It is returning more than the quantity delivered. | ||
Would you like to proceed anyway?` | ||
), | ||
confirmText: this.env._t("Yes"), | ||
cancelText: this.env._t("No"), | ||
}); | ||
if (confirmed) { | ||
return super._onClickPay(...arguments); | ||
} | ||
} else { | ||
return super._onClickPay(...arguments); | ||
} | ||
} | ||
}; | ||
|
||
Registries.Component.extend(ProductScreen, PosOrderMgmtProductScreen); | ||
|
||
return PosOrderMgmtProductScreen; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters