Skip to content

Commit

Permalink
[FIX] pos_membership_extension : correctly remove all the incorrect s…
Browse files Browse the repository at this point in the history
…elected lines, preventing skipping order lines, if many lines have to be removed
  • Loading branch information
legalsylvain committed Apr 22, 2024
1 parent 82339f7 commit b2b0b30
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pos_membership_extension/static/src/js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ odoo.define("pos_membership_extension.models", function (require) {
* @returns {Boolean} In any case, return the result of the super function.
*/
set_partner(partner) {
var self = this;
var bad_product_list = [];
this.orderlines.forEach(function (orderline) {
var i = this.orderlines.length;
while (i--) {
var orderline = this.orderlines[i];
if (!orderline.product.get_membership_allowed(partner)) {
bad_product_list.push(orderline.product.display_name);
self.orderlines.remove(orderline);
this.orderlines.splice(i, 1);
}
});
}
if (bad_product_list.length !== 0) {
var bad_product_text = bad_product_list.join(", ");
Gui.showPopup("ErrorPopup", {
Expand Down

0 comments on commit b2b0b30

Please sign in to comment.