19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:32:12 +01:00
parent 79f83631d5
commit 73afc09215
6267 changed files with 1534193 additions and 1130106 deletions

View file

@ -1,26 +0,0 @@
/** @odoo-module alias=pos_sale_loyalty.models **/
import { Orderline } from 'point_of_sale.models';
import Registries from 'point_of_sale.Registries';
export const PosSaleLoyaltyOrderline = (Orderline) => class PosSaleLoyaltyOrderline extends Orderline {
//@override
ignoreLoyaltyPoints(args) {
if (this.sale_order_origin_id) {
return true;
}
return super.ignoreLoyaltyPoints(args);
}
//@override
setQuantityFromSOL(saleOrderLine) {
// we need to consider reward product such as discount in a quotation
if (saleOrderLine.reward_id) {
this.set_quantity(saleOrderLine.product_uom_qty);
} else {
super.setQuantityFromSOL(...arguments);
}
}
};
Registries.Model.extend(Orderline, PosSaleLoyaltyOrderline);

View file

@ -0,0 +1,29 @@
import { PosOrderline } from "@point_of_sale/app/models/pos_order_line";
import { PosOrder } from "@point_of_sale/app/models/pos_order";
import { patch } from "@web/core/utils/patch";
patch(PosOrderline.prototype, {
//@override
ignoreLoyaltyPoints(args) {
if (this.sale_order_origin_id) {
return true;
}
return super.ignoreLoyaltyPoints(args);
},
//@override
setQuantityFromSOL(saleOrderLine) {
// we need to consider reward product such as discount in a quotation
if (saleOrderLine.reward_id) {
this.setQuantity(saleOrderLine.product_uom_qty);
} else {
super.setQuantityFromSOL(...arguments);
}
},
});
patch(PosOrder.prototype, {
isLineValidForLoyaltyPoints(line) {
const result = super.isLineValidForLoyaltyPoints(line);
return !line.sale_order_origin_id && result;
},
});

View file

@ -1,21 +0,0 @@
/** @odoo-module **/
import { PaymentScreen } from 'point_of_sale.tour.PaymentScreenTourMethods';
import { ProductScreen } from 'pos_sale.tour.ProductScreenTourMethods';
import { ReceiptScreen } from 'point_of_sale.tour.ReceiptScreenTourMethods';
import { getSteps, startSteps } from 'point_of_sale.tour.utils';
import Tour from 'web_tour.tour';
// First tour should not get any automatic rewards
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.do.clickDisplayedProduct('Desk Pad');
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickPaymentMethod('Bank');
PaymentScreen.do.clickValidate();
ReceiptScreen.check.isShown();
Tour.register('PosSaleLoyaltyTour1', { test: true, url: '/pos/web' }, getSteps());

View file

@ -0,0 +1,46 @@
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util";
import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util";
import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util";
import * as ReceiptScreen from "@point_of_sale/../tests/pos/tours/utils/receipt_screen_util";
import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util";
import * as PosSale from "@pos_sale/../tests/tours/utils/pos_sale_utils";
import * as PosLoyalty from "@pos_loyalty/../tests/tours/utils/pos_loyalty_util";
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("PosSaleLoyaltyTour1", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.clickDisplayedProduct("Desk Pad"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("test_pos_sale_loyalty_ignored_in_pos", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.totalAmountIs(90),
].flat(),
});
registry.category("web_tour.tours").add("test_sale_order_loyalty_card_can_be_used_in_pos", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
ProductScreen.clickDisplayedProduct("Desk Pad"),
PosLoyalty.enterCode("LOYALTY123"),
ProductScreen.customerIsSelected("partner_a"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});