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

@ -0,0 +1,662 @@
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 TicketScreen from "@point_of_sale/../tests/pos/tours/utils/ticket_screen_util";
import * as PosSale from "@pos_sale/../tests/tours/utils/pos_sale_utils";
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util";
import * as Order from "@point_of_sale/../tests/generic_helpers/order_widget_util";
import * as Utils from "@point_of_sale/../tests/generic_helpers/utils";
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add("PosSettleOrder", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Pizza Chicken", 9),
ProductScreen.clickNumpad("Qty", "2"), // Change the quantity of the product to 2
ProductScreen.selectedOrderlineHas("Pizza Chicken", 2),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
Chrome.clickOrders(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleOrderIncompatiblePartner", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
// The second item in the list is the first sale.order.
PosSale.settleNthOrder(2),
ProductScreen.selectedOrderlineHas("product1", 1),
ProductScreen.totalAmountIs("10.00"),
// The first item in the list is the second sale.order.
// Selecting the 2nd sale.order should use a new order,
// therefore, the total amount will change.
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("product2", 1),
ProductScreen.totalAmountIs("11.00"),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleOrder2", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.clickOrderline("Product A", "1"),
ProductScreen.selectedOrderlineHas("Product A", "1"),
ProductScreen.clickOrderline("Product B", "1"),
ProductScreen.clickNumpad("Qty", "0"),
ProductScreen.selectedOrderlineHas("Product B", "0"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank", true, { remaining: "0.0" }),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("PosRefundDownpayment", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.downPaymentFirstOrder("+10"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Cash"),
PaymentScreen.clickValidate(),
ReceiptScreen.clickNextOrder(),
...ProductScreen.clickRefund(),
// Filter should be automatically 'Paid'.
TicketScreen.filterIs("Paid"),
TicketScreen.selectOrder("001"),
Order.hasLine({
productName: "Down Payment",
withClass: ".selected",
quantity: "1",
}),
ProductScreen.clickNumpad("1"),
TicketScreen.confirmRefund(),
PaymentScreen.isShown(),
PaymentScreen.clickPaymentMethod("Cash"),
PaymentScreen.clickValidate(),
ReceiptScreen.clickNextOrder(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleOrderRealTime", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.totalAmountIs(40),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleOrder3", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Product A", "1"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank", true, { remaining: "0.0" }),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleOrderNotGroupable", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.totalAmountIs(28.98), // 3.5 * 8 * 1.15 * 90%
ProductScreen.selectedOrderlineHas("Product A", "0.5"),
ProductScreen.checkOrderlinesNumber(4),
ProductScreen.selectedOrderlineHas("Product A", "0.5", "4.14"),
].flat(),
});
registry.category("web_tour.tours").add("test_import_lot_groupable_and_non_groupable", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1, { loadSN: true }),
PosSale.selectedOrderLinesHasLots("Groupable Product", []),
ProductScreen.checkOrderlinesNumber(5),
ProductScreen.totalAmountIs(60),
ProductScreen.selectedOrderlineHas("Groupable Product", "1", "10"),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleOrderWithNote", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
Order.hasLine({
customerNote: "Customer note 2--Customer note 3",
}),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
// Check in the receipt
Order.hasLine({
customerNote: "Customer note 2--Customer note 3",
}),
ReceiptScreen.clickNextOrder(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleAndInvoiceOrder", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
Order.hasLine({}),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickInvoiceButton(),
PaymentScreen.clickValidate(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleAndInvoiceOrder2", {
steps: () =>
[
Chrome.startPoS(),
PosSale.settleNthOrder(1),
Order.hasLine({}),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickInvoiceButton(),
PaymentScreen.clickValidate(),
].flat(),
});
registry.category("web_tour.tours").add("PosOrderDoesNotRemainInList", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.clickNextOrder(),
PosSale.checkOrdersListEmpty(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleDraftOrder", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Test service product", "1", "50.00"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleCustomPrice", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Product A", "1", "100"),
ProductScreen.clickPartnerButton(),
ProductScreen.clickCustomer("A Test Partner AAA"),
ProductScreen.selectedOrderlineHas("Product A", "1", "100"),
].flat(),
});
registry.category("web_tour.tours").add("PoSSaleOrderWithDownpayment", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Down Payment (POS)"),
ProductScreen.totalAmountIs(980.0),
].flat(),
});
registry.category("web_tour.tours").add("test_settle_so_with_non_pos_groupable_uom", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Pomme de Terre", "0.5", "5.00"),
].flat(),
});
registry.category("web_tour.tours").add("PoSDownPaymentLinesPerTax", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.downPaymentFirstOrder("+20"),
Order.hasLine({
productName: "Down Payment",
quantity: "1",
price: "2.20",
}),
Order.hasLine({
productName: "Down Payment",
quantity: "1",
price: "1.00",
}),
Order.hasLine({
productName: "Down Payment",
quantity: "1",
price: "3.00",
}),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickInvoiceButton(),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("PoSApplyDownpayment", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.downPaymentFirstOrder("+10"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
].flat(),
});
registry.category("web_tour.tours").add("PoSApplyDownpaymentInvoice", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.downPaymentFirstOrder("+10"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickInvoiceButton(),
PaymentScreen.clickValidate(),
].flat(),
});
registry.category("web_tour.tours").add("PoSApplyDownpaymentInvoice2", {
steps: () =>
[
Chrome.startPoS(),
PosSale.downPaymentFirstOrder("+10"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickInvoiceButton(),
PaymentScreen.clickValidate(),
].flat(),
});
registry.category("web_tour.tours").add("PosShipLaterNoDefault", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.clickPayButton(),
PaymentScreen.isShown(),
Utils.negateStep(PaymentScreen.shippingLaterHighlighted()),
].flat(),
});
registry.category("web_tour.tours").add("PosSaleTeam", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
ProductScreen.clickDisplayedProduct("Test Product"),
ProductScreen.totalAmountIs("100.00"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
].flat(),
});
registry.category("web_tour.tours").add("PosOrdersListDifferentCurrency", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
ProductScreen.clickControlButton("Quotation/Order"),
{
content: "Check that no orders are displayed",
trigger: '.o_nocontent_help p:contains("No record found")',
},
].flat(),
});
registry.category("web_tour.tours").add("PoSDownPaymentAmount", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.downPaymentFirstOrder("+20"),
Order.hasLine({
productName: "Down Payment",
quantity: "1",
price: "20.0",
}),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Cash"),
PaymentScreen.clickValidate(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleOrder4", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Product A", "1"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.remainingIs("0.0"),
PaymentScreen.clickShipLaterButton(),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleOrderShipLater", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(2),
ProductScreen.clickPayButton(),
PaymentScreen.clickShipLaterButton(),
PaymentScreen.shippingLaterHighlighted(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.remainingIs("0.0"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
ReceiptScreen.clickNextOrder(),
PosSale.settleNthOrder(1),
ProductScreen.clickPayButton(),
PaymentScreen.clickShipLaterButton(),
PaymentScreen.shippingLaterHighlighted(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.remainingIs("0.0"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("PosSettleOrder5", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Product A", 1),
].flat(),
});
registry.category("web_tour.tours").add("PosSaleWarning", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
ProductScreen.clickPartnerButton(),
ProductScreen.clickCustomer("A Test Customer 2"),
{
content: "Check warning popup are displayed",
trigger:
'.modal-dialog:has(.modal-header:contains("Warning for A Test Customer 2")):has(.modal-body:contains("Cannot afford our services"))',
},
{
trigger: ".modal-footer button",
run: "click",
},
ProductScreen.customerIsSelected("A Test Customer 2"),
ProductScreen.clickDisplayedProduct("Letter Tray", true, "1"),
ProductScreen.selectedOrderlineHas("Letter Tray", "1"),
ProductScreen.clickPartnerButton(),
ProductScreen.clickCustomer("A Test Customer 1"),
{
content: "Check warning popup are displayed",
trigger:
'.modal-dialog:has(.modal-header:contains("Warning for A Test Customer 1")):has(.modal-body:contains("Highly infectious disease"))',
},
{
trigger: ".modal-footer button",
run: "click",
},
ProductScreen.customerIsSelected("A Test Customer 1"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.remainingIs("0.0"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("PoSSettleQuotation", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("POSSalePaymentScreenInvoiceOrder", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
ProductScreen.addOrderline("Product Test", "1"),
ProductScreen.clickPartnerButton(),
ProductScreen.clickCustomer("AAA - Test Partner invoice"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickInvoiceButton(),
PaymentScreen.clickValidate(),
ReceiptScreen.receiptIsThere(),
Chrome.waitRequest(),
].flat(),
});
registry.category("web_tour.tours").add("test_settle_order_with_lot", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1, { loadSN: true }),
PosSale.selectedOrderLinesHasLots("Product A", ["1001", "1002"]),
].flat(),
});
registry.category("web_tour.tours").add("test_down_payment_displayed", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.downPaymentFirstOrder("+10"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.clickNextOrder(),
PosSale.settleNthOrder(1),
Order.hasLine({
productName: "Down Payment",
quantity: "1.0",
price: "-1.15",
}),
].flat(),
});
registry.category("web_tour.tours").add("test_sale_order_fp_different_from_partner_one", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleSaleOrderByPrice("20.00"),
ProductScreen.checkTaxAmount("10.00"),
ProductScreen.checkFiscalPosition("Partner FP"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.receiptIsThere(),
ReceiptScreen.clickNextOrder(),
PosSale.settleSaleOrderByPrice("10.00"),
ProductScreen.checkTaxAmount("0.00"),
ProductScreen.checkFiscalPosition("Sale Order FP"),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.receiptIsThere(),
ReceiptScreen.clickNextOrder(),
].flat(),
});
registry.category("web_tour.tours").add("test_quantity_updated_settle", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
ProductScreen.clickNumpad("2"),
Order.hasLine({ productName: "Product A", quantity: "2.0" }),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.clickNextOrder(),
PosSale.settleNthOrder(1),
Order.hasLine({
productName: "Product A",
quantity: "3.0",
price: "34.50",
}),
].flat(),
});
registry.category("web_tour.tours").add("test_multiple_lots_sale_order_1", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1),
Order.hasLine({ productName: "Product", quantity: "6.0" }),
].flat(),
});
registry.category("web_tour.tours").add("test_multiple_lots_sale_order_2", {
steps: () =>
[
Chrome.startPoS(),
PosSale.settleNthOrder(1, { loadSN: false }),
Order.hasLine({ productName: "Product", quantity: "6.0" }),
{
content: "Check that the line-lot-icon has text-danger class",
trigger: `.order-container .orderline:has(.product-name:contains("Product")) .line-lot-icon.text-danger`,
},
].flat(),
});
registry.category("web_tour.tours").add("test_multiple_lots_sale_order_3", {
steps: () =>
[
Chrome.startPoS(),
PosSale.settleNthOrder(1, { loadSN: true }),
PosSale.selectedOrderLinesHasLots("Product", ["1002"]),
Utils.negateStep(...PosSale.selectedOrderLinesHasLots("Product", ["1001"])),
ProductScreen.selectedOrderlineHas("Product", "2.00"),
ProductScreen.clickOrderline("Product", "4"),
PosSale.selectedOrderLinesHasLots("Product", ["1001"]),
ProductScreen.selectedOrderlineHas("Product", "4.00"),
Utils.negateStep(...PosSale.selectedOrderLinesHasLots("Product", ["1002"])),
ProductScreen.clickPayButton(),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.clickValidate(),
ReceiptScreen.isShown(),
].flat(),
});
registry.category("web_tour.tours").add("test_selected_partner_quotation_loading", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
ProductScreen.clickPartnerButton(),
ProductScreen.clickCustomer("A Test Partner 1"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Product A", "1.00"),
Chrome.createFloatingOrder(),
ProductScreen.clickPartnerButton(),
ProductScreen.clickCustomer("A Test Partner 2"),
PosSale.settleNthOrder(1),
ProductScreen.selectedOrderlineHas("Product B", "2.00"),
].flat(),
});
registry.category("web_tour.tours").add("test_ecommerce_paid_order_is_hidden_in_pos", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
ProductScreen.clickPartnerButton(),
ProductScreen.clickCustomer("A Test Partner 1"),
PosSale.checkOrdersListEmpty(),
].flat(),
});
registry.category("web_tour.tours").add("test_ecommerce_unpaid_order_is_shown_in_pos", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
ProductScreen.clickPartnerButton(),
ProductScreen.clickCustomer("A Test Partner 1"),
PosSale.checkOrdersListNotEmpty(),
].flat(),
});
registry.category("web_tour.tours").add("test_settle_groupable_lot_total_amount", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
PosSale.settleNthOrder(1, { loadSN: true }),
Order.hasTotal("12.00"),
].flat(),
});

View file

@ -1,201 +0,0 @@
odoo.define('pos_sale.tour', function (require) {
'use strict';
const { Chrome } = require('point_of_sale.tour.ChromeTourMethods');
const { PaymentScreen } = require('point_of_sale.tour.PaymentScreenTourMethods');
const { ProductScreen } = require('pos_sale.tour.ProductScreenTourMethods');
const { ReceiptScreen } = require('pos_sale.tour.ReceiptScreenTourMethods');
const { TicketScreen } = require('point_of_sale.tour.TicketScreenTourMethods');
const { getSteps, startSteps } = require('point_of_sale.tour.utils');
const Tour = require('web_tour.tour');
// signal to start generating steps
// when finished, steps can be taken from getSteps
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.check.selectedOrderlineHas('Pizza Chicken', 9);
ProductScreen.do.pressNumpad('Qty 2'); // Change the quantity of the product to 2
ProductScreen.check.selectedOrderlineHas('Pizza Chicken', 2);
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickPaymentMethod('Bank');
PaymentScreen.do.clickValidate();
Chrome.do.clickTicketButton();
Tour.register('PosSettleOrder', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
// The second item in the list is the first sale.order.
ProductScreen.do.selectNthOrder(2);
ProductScreen.check.selectedOrderlineHas('product1', 1);
ProductScreen.check.totalAmountIs("10.00");
ProductScreen.do.clickQuotationButton();
// The first item in the list is the second sale.order.
// Selecting the 2nd sale.order should use a new order,
// therefore, the total amount will change.
ProductScreen.do.selectNthOrder(1);
ProductScreen.check.selectedOrderlineHas('product2', 1);
ProductScreen.check.totalAmountIs("11.00");
Tour.register('PosSettleOrderIncompatiblePartner', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.do.clickOrderline('[A001] Product A', '1');
ProductScreen.check.selectedOrderlineHas('[A001] Product A', '1.00');
ProductScreen.do.clickOrderline('[A002] Product B', '1');
ProductScreen.do.pressNumpad('Qty 0');
ProductScreen.check.selectedOrderlineHas('[A002] Product B', '0.00');
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickPaymentMethod('Bank');
PaymentScreen.check.remainingIs('0.0');
PaymentScreen.do.clickValidate();
ReceiptScreen.check.isShown();
Tour.register('PosSettleOrder2', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.do.clickOrderline("Product A", "1");
ProductScreen.check.selectedOrderlineHas('Product A', '1.00');
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickPaymentMethod('Bank');
PaymentScreen.check.remainingIs('0.0');
PaymentScreen.do.clickValidate();
ReceiptScreen.check.isShown();
Tour.register('PosSettleOrder3', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.check.totalAmountIs(40);
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickPaymentMethod('Bank');
PaymentScreen.do.clickValidate();
Chrome.do.clickTicketButton();
Tour.register('PosSettleOrderRealTime', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.downPaymentFirstOrder();
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickPaymentMethod('Cash');
PaymentScreen.do.clickValidate();
ReceiptScreen.do.clickNextOrder();
ProductScreen.do.clickRefund();
// Filter should be automatically 'Paid'.
TicketScreen.check.filterIs('Paid');
TicketScreen.do.selectOrder('-0001');
TicketScreen.do.clickOrderline('Down Payment');
TicketScreen.do.pressNumpad('1');
TicketScreen.do.confirmRefund();
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickPaymentMethod('Cash');
PaymentScreen.do.clickValidate();
ReceiptScreen.do.clickNextOrder();
Tour.register('PosRefundDownpayment', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.check.totalAmountIs(28.98); // 3.5 * 8 * 1.15 * 90%
ProductScreen.do.clickOrderline("Product A", '0.5');
ProductScreen.check.checkOrderlinesNumber(4);
ProductScreen.check.selectedOrderlineHas('Product A', '0.5', '4.14');
Tour.register('PosSettleOrderNotGroupable', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.check.checkCustomerNotes("Customer note 2--Customer note 3");
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickPaymentMethod('Bank');
PaymentScreen.do.clickValidate();
ReceiptScreen.check.checkCustomerNotes("Customer note 2--Customer note 3");
ReceiptScreen.do.clickNextOrder();
Tour.register('PosSettleOrderWithNote', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickPaymentMethod('Bank');
PaymentScreen.do.clickValidate();
ReceiptScreen.do.clickNextOrder();
ProductScreen.do.clickQuotationButton();
ProductScreen.check.checkOrdersListEmpty();
Tour.register('PosOrderDoesNotRemainInList', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.check.selectedOrderlineHas('product_a', '1', '100');
ProductScreen.do.clickPartnerButton();
ProductScreen.do.clickCustomer('partner_a');
ProductScreen.check.selectedOrderlineHas('product_a', '1', '100');
Tour.register('PosSettleCustomPrice', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.check.selectedOrderlineHas('Test service product', '1.00', '50.00');
Tour.register('PosSettleDraftOrder', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.selectFirstOrder();
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickShipLaterButton()
PaymentScreen.do.clickPaymentMethod('Bank');
PaymentScreen.check.remainingIs('0.0');
PaymentScreen.do.clickValidate();
ReceiptScreen.check.isShown();
Tour.register('PosSettleOrderShipLater', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.confirmOpeningPopup();
ProductScreen.do.clickQuotationButton();
ProductScreen.do.downPaymentFirstOrder();
ProductScreen.check.selectedOrderlineHas('Down Payment', '1', '10.00');
ProductScreen.do.clickPayButton();
PaymentScreen.do.clickPaymentMethod('Cash');
PaymentScreen.do.clickValidate();
ReceiptScreen.do.clickNextOrder();
Tour.register('PoSDownPaymentAmount', { test: true, url: '/pos/ui' }, getSteps());
});

View file

@ -0,0 +1,324 @@
import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util";
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util";
import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_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 { escapeRegExp } from "@web/core/utils/strings";
import { registry } from "@web/core/registry";
export function clickDownPaymentNumpad(num) {
return {
content: `click discount numpad button: ${num}`,
trigger: `.o_dialog div.numpad button:contains(/^${escapeRegExp(num)}$/)`,
run: "click",
};
}
export function addDownPayment(percentage, soNth, downPaymentType) {
const steps = [
ProductScreen.clickControlButton("Quotation/Order"),
{
content: "Select the first SO",
trigger: `.o_sale_order .o_data_row:nth-child(${soNth}) .o_data_cell:nth-child(1)`,
run: "click",
},
];
if (downPaymentType === "percent") {
steps.push({
content: "Select 'Apply a down payment (percentage)'",
trigger: ".modal-body button:contains('percentage')",
run: "click",
});
} else {
steps.push({
content: "Select 'Apply a down payment (fixed amount)'",
trigger: ".modal-body button:contains('fixed amount')",
run: "click",
});
}
for (const num of percentage.split("")) {
steps.push(clickDownPaymentNumpad(num));
}
steps.push({
content: "Select 'Apply'",
trigger: ".modal-dialog button.btn-primary:contains('Apply')",
run: "click",
});
return steps;
}
export function payAndInvoice(totalAmount) {
return [
ProductScreen.clickPayButton(),
PaymentScreen.totalIs(totalAmount),
PaymentScreen.clickPaymentMethod("Bank"),
PaymentScreen.remainingIs("0.0"),
PaymentScreen.clickInvoiceButton(),
PaymentScreen.clickValidate(),
ReceiptScreen.receiptAmountTotalIs(totalAmount),
ReceiptScreen.clickNextOrder(),
];
}
registry
.category("web_tour.tours")
.add("test_taxes_l10n_in_pos_downpayment_round_per_line_price_excluded", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("0.73"),
ProductScreen.checkTaxAmount("0.10"),
...payAndInvoice("0.73"),
...addDownPayment("0.73", 2, "fixed"),
ProductScreen.checkTotalAmount("0.73"),
ProductScreen.checkTaxAmount("0.10"),
...payAndInvoice("0.73"),
...addDownPayment("7", 3, "percent"),
ProductScreen.checkTotalAmount("2.56"),
ProductScreen.checkTaxAmount("0.33"),
...payAndInvoice("2.56"),
...addDownPayment("2.56", 4, "fixed"),
ProductScreen.checkTotalAmount("2.56"),
ProductScreen.checkTaxAmount("0.33"),
...payAndInvoice("2.56"),
...addDownPayment("18", 5, "percent"),
ProductScreen.checkTotalAmount("6.60"),
ProductScreen.checkTaxAmount("0.87"),
...payAndInvoice("6.60"),
...addDownPayment("6.60", 6, "fixed"),
ProductScreen.checkTotalAmount("6.60"),
ProductScreen.checkTaxAmount("0.87"),
...payAndInvoice("6.60"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_in_pos_downpayment_round_globally_price_excluded", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("0.73"),
ProductScreen.checkTaxAmount("0.1"),
...payAndInvoice("0.73"),
...addDownPayment("0.73", 2, "fixed"),
ProductScreen.checkTotalAmount("0.73"),
ProductScreen.checkTaxAmount("0.1"),
...payAndInvoice("0.73"),
...addDownPayment("7", 3, "percent"),
ProductScreen.checkTotalAmount("2.57"),
ProductScreen.checkTaxAmount("0.33"),
...payAndInvoice("2.57"),
...addDownPayment("2.57", 4, "fixed"),
ProductScreen.checkTotalAmount("2.57"),
ProductScreen.checkTaxAmount("0.33"),
...payAndInvoice("2.57"),
...addDownPayment("18", 5, "percent"),
ProductScreen.checkTotalAmount("6.60"),
ProductScreen.checkTaxAmount("0.87"),
...payAndInvoice("6.60"),
...addDownPayment("6.60", 6, "fixed"),
ProductScreen.checkTotalAmount("6.60"),
ProductScreen.checkTaxAmount("0.87"),
...payAndInvoice("6.60"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_in_pos_downpayment_round_per_line_price_included", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("0.73"),
ProductScreen.checkTaxAmount("0.10"),
...payAndInvoice("0.73"),
...addDownPayment("0.73", 2, "fixed"),
ProductScreen.checkTotalAmount("0.73"),
ProductScreen.checkTaxAmount("0.10"),
...payAndInvoice("0.73"),
...addDownPayment("7", 3, "percent"),
ProductScreen.checkTotalAmount("2.56"),
ProductScreen.checkTaxAmount("0.33"),
...payAndInvoice("2.56"),
...addDownPayment("2.56", 4, "fixed"),
ProductScreen.checkTotalAmount("2.56"),
ProductScreen.checkTaxAmount("0.33"),
...payAndInvoice("2.56"),
...addDownPayment("18", 5, "percent"),
ProductScreen.checkTotalAmount("6.60"),
ProductScreen.checkTaxAmount("0.87"),
...payAndInvoice("6.60"),
...addDownPayment("6.60", 6, "fixed"),
ProductScreen.checkTotalAmount("6.60"),
ProductScreen.checkTaxAmount("0.87"),
...payAndInvoice("6.60"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_in_pos_downpayment_round_globally_price_included", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("0.73"),
ProductScreen.checkTaxAmount("0.10"),
...payAndInvoice("0.73"),
...addDownPayment("0.73", 2, "fixed"),
ProductScreen.checkTotalAmount("0.73"),
ProductScreen.checkTaxAmount("0.10"),
...payAndInvoice("0.73"),
...addDownPayment("7", 3, "percent"),
ProductScreen.checkTotalAmount("2.57"),
ProductScreen.checkTaxAmount("0.33"),
...payAndInvoice("2.57"),
...addDownPayment("2.57", 4, "fixed"),
ProductScreen.checkTotalAmount("2.57"),
ProductScreen.checkTaxAmount("0.34"),
...payAndInvoice("2.57"),
...addDownPayment("18", 5, "percent"),
ProductScreen.checkTotalAmount("6.60"),
ProductScreen.checkTaxAmount("0.87"),
...payAndInvoice("6.60"),
...addDownPayment("6.60", 6, "fixed"),
ProductScreen.checkTotalAmount("6.60"),
ProductScreen.checkTaxAmount("0.87"),
...payAndInvoice("6.60"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_br_pos_downpayment_round_per_line_price_excluded", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("1.92"),
ProductScreen.checkTaxAmount("0.63"),
...payAndInvoice("1.92"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_br_pos_downpayment_round_globally_price_excluded", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("1.92"),
ProductScreen.checkTaxAmount("0.63"),
...payAndInvoice("1.92"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_br_pos_downpayment_round_per_line_price_included", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("1.92"),
ProductScreen.checkTaxAmount("0.63"),
...payAndInvoice("1.92"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_br_pos_downpayment_round_globally_price_included", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("1.92"),
ProductScreen.checkTaxAmount("0.63"),
...payAndInvoice("1.92"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_be_pos_downpayment_round_per_line_price_excluded", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("0.86"),
ProductScreen.checkTaxAmount("0.15"),
...payAndInvoice("0.86"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_be_pos_downpayment_round_globally_price_excluded", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("0.86"),
ProductScreen.checkTaxAmount("0.15"),
...payAndInvoice("0.86"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_be_pos_downpayment_round_per_line_price_included", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("0.86"),
ProductScreen.checkTaxAmount("0.15"),
...payAndInvoice("0.86"),
].flat(),
});
registry
.category("web_tour.tours")
.add("test_taxes_l10n_be_pos_downpayment_round_globally_price_included", {
steps: () =>
[
Chrome.startPoS(),
Dialog.confirm("Open Register"),
...addDownPayment("2", 1, "percent"),
ProductScreen.checkTotalAmount("0.86"),
ProductScreen.checkTaxAmount("0.15"),
...payAndInvoice("0.86"),
].flat(),
});

View file

@ -0,0 +1,97 @@
import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util";
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util";
import * as Numpad from "@point_of_sale/../tests/generic_helpers/numpad_util";
export function selectNthOrder(n) {
return [
...ProductScreen.clickControlButton("Quotation/Order"),
{
content: `select nth order`,
trigger: `.modal:not(.o_inactive_modal) table.o_list_table tbody tr.o_data_row:nth-child(${n}) td`,
run: "click",
},
];
}
export function settleSaleOrderByPrice(price) {
return [
...ProductScreen.clickControlButton("Quotation/Order"),
{
content: `select sale order with price ${price}`,
trigger: `.modal:not(.o_inactive_modal) table.o_list_table tbody tr.o_data_row td:contains('${price}')`,
run: "click",
},
{
content: `Choose to settle the order`,
trigger: `.modal:not(.o_inactive_modal) .selection-item:contains('Settle the order')`,
run: "click",
},
];
}
export function settleNthOrder(n, options = {}) {
const { loadSN } = options;
const step = [
...selectNthOrder(n),
{
content: `Choose to settle the order`,
trigger: `.modal:not(.o_inactive_modal) .selection-item:contains('Settle the order')`,
run: "click",
},
];
if (loadSN !== undefined) {
step.push({
content: `Choose to auto link the lot number to the order line`,
trigger: `.modal-content:contains('Do you want to load the SN/Lots linked to the Sales Order?') button:contains('${
loadSN ? "Ok" : "Cancel"
}')`,
run: "click",
});
}
step.push({
trigger: "body:not(:has(.modal))",
});
return step;
}
export function downPaymentFirstOrder(amount) {
return [
...selectNthOrder(1),
{
content: `click on select the order`,
trigger: `.selection-item:contains('Apply a down payment')`,
run: "click",
},
Numpad.click(amount),
Dialog.confirm("Apply"),
];
}
export function checkOrdersListEmpty() {
return [
...ProductScreen.clickControlButton("Quotation/Order"),
{
content: "Check that the orders list is empty",
trigger: "p:contains(No record found)",
},
];
}
export function selectedOrderLinesHasLots(productName, lots) {
const getSerialStep = (index, serialNumber) => ({
content: `check lot${index} is linked`,
trigger: `.info-list li:contains(${serialNumber})`,
});
const lotSteps = lots.reduce((acc, serial, i) => acc.concat(getSerialStep(i, serial)), []);
return [...ProductScreen.selectedOrderlineHas(productName), ...lotSteps];
}
export function checkOrdersListNotEmpty() {
return [
...ProductScreen.clickControlButton("Quotation/Order"),
{
content: "Check that the orders list is not empty",
trigger: ".o_data_row",
},
];
}