Initial commit: Pos packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:50 +02:00
commit 95dfb9edb0
1301 changed files with 264148 additions and 0 deletions

View file

@ -0,0 +1,56 @@
odoo.define('pos_restaurant.tour.BillScreenTourMethods', function (require) {
'use strict';
const { createTourMethods } = require('point_of_sale.tour.utils');
class Do {
clickOk() {
return [
{
content: `go back`,
trigger: `.receipt-screen .button.next`,
},
];
}
clickBillButton() {
return [
{
content: "click bill button",
trigger: '.control-button:contains("Bill")',
},
];
}
}
class Check {
isShown() {
return [
{
content: 'Bill screen is shown',
trigger: '.receipt-screen h1:contains("Bill Printing")',
run: () => {},
},
];
}
isQRCodeShown() {
return [
{
content: "QR codes are shown",
trigger: '#posqrcode',
run: () => {},
},
];
}
isQRCodeNotShown() {
return [
{
content: "QR codes are shown",
trigger: 'body:not(:has(#posqrcode))',
run: () => {},
},
];
}
}
return createTourMethods('BillScreen', Do, Check);
});

View file

@ -0,0 +1,33 @@
odoo.define('pos_restaurant.tour.ChromeTourMethods', function (require) {
'use strict';
const { createTourMethods } = require('point_of_sale.tour.utils');
const { Do } = require('point_of_sale.tour.ChromeTourMethods');
class DoExt extends Do {
backToFloor() {
return [
{
content: 'back to floor',
trigger: '.floor-button',
},
];
}
}
class Check {
backToFloorTextIs(floor, table) {
return [
{
content: `back to floor text is '${floor} ( ${table} )'`,
trigger: `.floor-button span:contains("${floor}") ~ .table-name:contains("(${table})")`,
run: () => {},
},
];
}
}
class Execute {}
return createTourMethods('Chrome', DoExt, Check, Execute);
});

View file

@ -0,0 +1,157 @@
odoo.define('pos_restaurant.tour.FloorScreenTourMethods', function (require) {
'use strict';
const { createTourMethods } = require('point_of_sale.tour.utils');
class Do {
clickTable(name) {
return [
{
content: `click table '${name}'`,
trigger: `.floor-map .table .label:contains("${name}")`,
},
];
}
clickFloor(name) {
return [
{
content: `click '${name}' floor`,
trigger: `.floor-selector .button-floor:contains("${name}")`,
},
];
}
clickEdit() {
return [
{
content: `click edit button`,
trigger: `.floor-map .edit-button`,
},
];
}
clickAddTable() {
return [
{
content: 'add table',
trigger: `.floor-map .edit-button i[aria-label=Add]`,
},
];
}
clickDuplicate() {
return [
{
content: 'duplicate table',
trigger: `.floor-map .edit-button i[aria-label=Duplicate]`,
},
];
}
clickRename() {
return [
{
content: 'rename table',
trigger: `.floor-map .edit-button i[aria-label=Rename]`,
},
];
}
clickSeats() {
return [
{
content: 'change number of seats',
trigger: `.floor-map .edit-button i[aria-label=Seats]`,
},
];
}
clickTrash() {
return [
{
content: 'trash table',
trigger: `.floor-map .edit-button.trash`,
},
];
}
changeShapeTo(shape) {
return [
{
content: `change shape to '${shape}'`,
trigger: `.edit-button .button-option${shape === 'round' ? '.square' : '.round'}`,
},
];
}
}
class Check {
selectedFloorIs(name) {
return [
{
content: `selected floor is '${name}'`,
trigger: `.floor-selector .button-floor.active:contains("${name}")`,
run: () => {},
},
];
}
selectedTableIs(name) {
return [
{
content: `selected table is '${name}'`,
trigger: `.floor-map .table.selected .label:contains("${name}")`,
run: () => {},
},
];
}
hasTable(name) {
return [
{
content: `selected floor has '${name}' table`,
trigger: `.floor-map .tables .table .label:contains("${name}")`,
run: () => {},
},
];
}
editModeIsActive(flag) {
return [
{
content: `check if edit mode is ${flag ? 'active' : 'inactive'}`,
trigger: `.floor-map .edit-button${flag ? '.active' : ':not(:has(.active))'}`,
run: () => {},
},
];
}
tableSeatIs(table, val) {
return [
{
content: `number of seats in table '${table}' is '${val}'`,
trigger: `.floor-map .tables .table .label:contains("${table}") ~ .table-seats:contains("${val}")`,
run: function () {},
},
];
}
orderCountSyncedInTableIs(table, count) {
return [
{
trigger: `.floor-map .table .order-count:contains("${count}") ~ .label:contains("${table}")`,
run: function () {},
},
];
}
isShown() {
return [
{
trigger: '.floor-map',
run: function () {},
},
];
}
tableIsNotSelected(name) {
return [
{
content: `table '${name}' is not selected`,
trigger: `.floor-map .table:not(.selected) .label:contains("${name}")`,
run: function () {},
},
];
}
}
class Execute {}
return createTourMethods('FloorScreen', Do, Check, Execute);
});

View file

@ -0,0 +1,87 @@
odoo.define('pos_restaurant.tour.ProductScreenTourMethods', function (require) {
'use strict';
const { createTourMethods } = require('point_of_sale.tour.utils');
const { Do, Check, Execute } = require('point_of_sale.tour.ProductScreenTourMethods');
class DoExt extends Do {
clickSplitBillButton() {
return [
{
content: 'click split bill button',
trigger: '.control-buttons .control-button.order-split',
},
];
}
clickTransferButton() {
return [
{
content: 'click transfer button',
trigger: '.control-buttons .control-button span:contains("Transfer")',
},
];
}
clickNoteButton() {
return [
{
content: 'click note button',
trigger: '.control-buttons .control-button span:contains("Internal Note")',
},
];
}
clickPrintBillButton() {
return [
{
content: 'click print bill button',
trigger: '.control-buttons .control-button.order-printbill',
},
];
}
clickSubmitButton() {
return [
{
content: 'click print bill button',
trigger: '.control-buttons .control-button span:contains("Order")',
},
];
}
clickGuestButton() {
return [
{
content: 'click guest button',
trigger: '.control-buttons .control-button span:contains("Guests")'
}
]
}
}
class CheckExt extends Check {
orderlineHasNote(name, quantity, note) {
return [
{
content: `line has ${quantity} quantity`,
trigger: `.order .orderline .product-name:contains("${name}") ~ .info-list em:contains("${quantity}")`,
run: function () {}, // it's a check
},
{
content: `line has '${note}' note`,
trigger: `.order .orderline .info-list .orderline-note:contains("${note}")`,
run: function () {}, // it's a check
},
];
}
guestNumberIs(numberInString) {
return [
{
content: `guest number is ${numberInString}`,
trigger: `.control-buttons .control-button span.control-button-number:contains(${numberInString})`,
run: function () {}, // it's a check
}
]
}
}
class ExecuteExt extends Execute {}
return createTourMethods('ProductScreen', DoExt, CheckExt, ExecuteExt);
});

View file

@ -0,0 +1,65 @@
odoo.define('pos_restaurant.tour.SplitBillScreenTourMethods', function (require) {
'use strict';
const { createTourMethods } = require('point_of_sale.tour.utils');
class Do {
clickOrderline(name, totalQuantity) {
let trigger = `li.orderline .product-name:contains("${name}")`;
if (totalQuantity) {
trigger += ` ~ .info-list .info:contains("${totalQuantity}")`;
}
return [
{
content: `click '${name}' orderline with total quantity of '${totalQuantity}'`,
trigger,
},
];
}
clickBack() {
return [
{
content: 'click back button',
trigger: `.splitbill-screen .button.back`,
},
];
}
clickPay() {
return [
{
content: 'click pay button',
trigger: `.splitbill-screen .pay-button .button`
}
]
}
}
class Check {
orderlineHas(name, totalQuantity, splitQuantity) {
return [
{
content: `'${name}' orderline has total quantity of '${totalQuantity}'`,
trigger: `li.orderline .product-name:contains("${name}") ~ .info-list .info:contains("${totalQuantity}")`,
run: () => {},
},
{
content: `'${name}' orderline has '${splitQuantity}' quantity to split`,
trigger: `li.orderline .product-name:contains("${name}") ~ .info-list .info em:contains("${splitQuantity}")`,
run: () => {},
},
];
}
subtotalIs(amount) {
return [
{
content: `total amount of split is '${amount}'`,
trigger: `.splitbill-screen .order-info .subtotal:contains("${amount}")`,
},
];
}
}
class Execute {}
return createTourMethods('SplitBillScreen', Do, Check, Execute);
});

View file

@ -0,0 +1,60 @@
odoo.define('pos_restaurant.tour.TipScreenTourMethods', function (require) {
'use strict';
const { createTourMethods } = require('point_of_sale.tour.utils');
class Do {
clickPercentTip(percent) {
return [
{
trigger: `.tip-screen .percentage:contains("${percent}")`,
},
];
}
setCustomTip(amount) {
return [
{
trigger: `.tip-screen .custom-amount-form input`,
run: `text ${amount}`,
},
];
}
}
class Check {
isShown() {
return [
{
trigger: '.pos .tip-screen',
run: () => {},
},
];
}
totalAmountIs(amount) {
return [
{
trigger: `.tip-screen .total-amount:contains("${amount}")`,
run: () => {},
},
];
}
percentAmountIs(percent, amount) {
return [
{
trigger: `.tip-screen .percentage:contains("${percent}") ~ .amount:contains("${amount}")`,
run: () => {},
},
];
}
inputAmountIs(amount) {
return [
{
trigger: `.tip-screen .custom-amount-form input[data-amount="${amount}"]`,
run: () => {},
}
]
}
}
return createTourMethods('TipScreen', Do, Check);
});