[IMP] pos_restaurant: Table not stacked when added
When we added tables on a floor plan from the floor screen, the tables stacked one upon another which was confusing and annoying. Now the table will be added on a free place on the floor plan. We also rename the tables: they are no more called "T1", "T2" but "1", "2",... closes odoo/odoo#114282 Signed-off-by: Heinz Robin (rhe) <rhe@odoo.com>
This commit is contained in:
@@ -214,7 +214,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_01" model="restaurant.table">
|
||||
<field name="name">T1</field>
|
||||
<field name="name">1</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -226,7 +226,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_02" model="restaurant.table">
|
||||
<field name="name">T2</field>
|
||||
<field name="name">2</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -238,7 +238,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_03" model="restaurant.table">
|
||||
<field name="name">T3</field>
|
||||
<field name="name">3</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -250,7 +250,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_04" model="restaurant.table">
|
||||
<field name="name">T4</field>
|
||||
<field name="name">4</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -262,7 +262,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_05" model="restaurant.table">
|
||||
<field name="name">T5</field>
|
||||
<field name="name">5</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -274,7 +274,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_06" model="restaurant.table">
|
||||
<field name="name">T6</field>
|
||||
<field name="name">6</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -286,7 +286,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_07" model="restaurant.table">
|
||||
<field name="name">T7</field>
|
||||
<field name="name">7</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(235,109,109)</field>
|
||||
@@ -298,7 +298,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_08" model="restaurant.table">
|
||||
<field name="name">T8</field>
|
||||
<field name="name">8</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(235,109,109)</field>
|
||||
@@ -310,7 +310,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_09" model="restaurant.table">
|
||||
<field name="name">T9</field>
|
||||
<field name="name">9</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(235,109,109)</field>
|
||||
@@ -322,7 +322,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_10" model="restaurant.table">
|
||||
<field name="name">T10</field>
|
||||
<field name="name">10</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(235,109,109)</field>
|
||||
@@ -334,7 +334,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_11" model="restaurant.table">
|
||||
<field name="name">T11</field>
|
||||
<field name="name">11</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_main"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(78,210,190)</field>
|
||||
@@ -356,7 +356,7 @@
|
||||
<!-- Patio: Left table row -->
|
||||
|
||||
<record id="table_21" model="restaurant.table">
|
||||
<field name="name">T1</field>
|
||||
<field name="name">1</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">2</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -368,7 +368,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_22" model="restaurant.table">
|
||||
<field name="name">T2</field>
|
||||
<field name="name">2</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">2</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -380,7 +380,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_23" model="restaurant.table">
|
||||
<field name="name">T3</field>
|
||||
<field name="name">3</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">2</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -392,7 +392,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_24" model="restaurant.table">
|
||||
<field name="name">T4</field>
|
||||
<field name="name">4</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">2</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -406,7 +406,7 @@
|
||||
<!-- Patio: Right table row -->
|
||||
|
||||
<record id="table_25" model="restaurant.table">
|
||||
<field name="name">T5</field>
|
||||
<field name="name">5</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">2</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -418,7 +418,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_26" model="restaurant.table">
|
||||
<field name="name">T6</field>
|
||||
<field name="name">6</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">2</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -430,7 +430,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_27" model="restaurant.table">
|
||||
<field name="name">T7</field>
|
||||
<field name="name">7</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">2</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -442,7 +442,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_28" model="restaurant.table">
|
||||
<field name="name">T8</field>
|
||||
<field name="name">8</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">2</field>
|
||||
<field name="color">rgb(53,211,116)</field>
|
||||
@@ -456,7 +456,7 @@
|
||||
<!-- Patio: Center table block -->
|
||||
|
||||
<record id="table_29" model="restaurant.table">
|
||||
<field name="name">T9</field>
|
||||
<field name="name">9</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(235,191,109)</field>
|
||||
@@ -468,7 +468,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_29" model="restaurant.table">
|
||||
<field name="name">T9</field>
|
||||
<field name="name">9</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(235,191,109)</field>
|
||||
@@ -480,7 +480,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_30" model="restaurant.table">
|
||||
<field name="name">T10</field>
|
||||
<field name="name">10</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(235,191,109)</field>
|
||||
@@ -492,7 +492,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_31" model="restaurant.table">
|
||||
<field name="name">T11</field>
|
||||
<field name="name">11</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(235,191,109)</field>
|
||||
@@ -504,7 +504,7 @@
|
||||
</record>
|
||||
|
||||
<record id="table_32" model="restaurant.table">
|
||||
<field name="name">T12</field>
|
||||
<field name="name">12</field>
|
||||
<field name="floor_id" ref="pos_restaurant.floor_patio"/>
|
||||
<field name="seats">4</field>
|
||||
<field name="color">rgb(235,191,109)</field>
|
||||
|
||||
@@ -78,17 +78,99 @@ export class FloorScreen extends Component {
|
||||
this.state.selectedTableId = null;
|
||||
}
|
||||
async _createTableHelper(copyTable) {
|
||||
let existingTable = this.activeFloor.tables;
|
||||
let newTable;
|
||||
if (copyTable) {
|
||||
newTable = Object.assign({}, copyTable);
|
||||
newTable.position_h += 10;
|
||||
newTable.position_v += 10;
|
||||
} else {
|
||||
let posV = 0;
|
||||
let posH = 10;
|
||||
const referenceScreenWidth = 1180;
|
||||
const spaceBetweenTable = 15 * (screen.width/referenceScreenWidth);
|
||||
const h_min = spaceBetweenTable;
|
||||
const h_max = screen.width;
|
||||
const v_max = screen.height;
|
||||
let potentialWidth = 100 * (h_max/referenceScreenWidth);
|
||||
if (potentialWidth > 130) {
|
||||
potentialWidth = 130;
|
||||
} else if (potentialWidth < 75) {
|
||||
potentialWidth = 75;
|
||||
}
|
||||
const heightTable = potentialWidth;
|
||||
const widthTable = potentialWidth;
|
||||
let positionTable = [];
|
||||
|
||||
existingTable.forEach((table) => {
|
||||
positionTable.push([table.position_v, table.position_v + table.height, table.position_h, table.position_h + table.width])
|
||||
})
|
||||
|
||||
positionTable.sort((tableA, tableB) => {
|
||||
if (tableA[0] < tableB[0]) {
|
||||
return -1;
|
||||
} else if (tableA[0] > tableB[0]) {
|
||||
return 1;
|
||||
} else if (tableA[2] < tableB[2]) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
let actualHeight = 100
|
||||
let impossible = true;
|
||||
|
||||
while(actualHeight <= (v_max - heightTable - spaceBetweenTable) && impossible) {
|
||||
let tableIntervals = [[h_min, h_min, v_max], [h_max, h_max, v_max]];
|
||||
for (let i = 0; i < positionTable.length; i++) {
|
||||
if (positionTable[i][0] >= (actualHeight + heightTable + spaceBetweenTable)) {
|
||||
continue;
|
||||
} else if ((positionTable[i][1] + spaceBetweenTable) <= actualHeight) {
|
||||
continue;
|
||||
} else {
|
||||
tableIntervals.push([positionTable[i][2], positionTable[i][3], positionTable[i][1]]);
|
||||
}
|
||||
}
|
||||
|
||||
tableIntervals.sort((a, b) => {
|
||||
if (a[0] < b[0]) {
|
||||
return -1;
|
||||
} else if (a[0] > b[0]) {
|
||||
return 1;
|
||||
} else if (a[1] < b[1]) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
|
||||
let nextHeight = v_max;
|
||||
for (let i = 0; i < tableIntervals.length - 1; i++) {
|
||||
if (tableIntervals[i][2] < nextHeight) {
|
||||
nextHeight = tableIntervals[i][2];
|
||||
}
|
||||
|
||||
if (tableIntervals[i+1][0] - tableIntervals[i][1] > widthTable + spaceBetweenTable) {
|
||||
impossible = false;
|
||||
posV = actualHeight;
|
||||
posH = tableIntervals[i][1] + spaceBetweenTable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
actualHeight = nextHeight + spaceBetweenTable;
|
||||
}
|
||||
|
||||
if (impossible) {
|
||||
posV = positionTable[0][0] + 10;
|
||||
posH = positionTable[0][2] + 10;
|
||||
}
|
||||
|
||||
newTable = {
|
||||
position_v: 100,
|
||||
position_h: 100,
|
||||
width: 75,
|
||||
height: 75,
|
||||
position_v: posV,
|
||||
position_h: posH,
|
||||
width: widthTable,
|
||||
height: heightTable,
|
||||
shape: "square",
|
||||
seats: 1,
|
||||
color: "rgb(53, 211, 116)",
|
||||
@@ -112,7 +194,7 @@ export class FloorScreen extends Component {
|
||||
} else if (this._lastName) {
|
||||
this._lastName.num += 1;
|
||||
} else {
|
||||
this._lastName = { num: 1, str: "T" };
|
||||
this._lastName = { num: 1, str: "" };
|
||||
}
|
||||
return "" + this._lastName.str + this._lastName.num;
|
||||
}
|
||||
|
||||
@@ -43,21 +43,6 @@
|
||||
background-size: cover;
|
||||
transition: all 300ms ease-in-out;
|
||||
|
||||
.tables {
|
||||
position: relative;
|
||||
--scale: 1;
|
||||
transform: scale(var(--scale));
|
||||
|
||||
@media screen and (min-width: 1024px) {
|
||||
max-width: 1024px;
|
||||
margin: auto;
|
||||
max-height: 540px;
|
||||
border-radius: 0px 0px 6px 6px;
|
||||
border: dashed 2px rgba(0,0,0,0.1);
|
||||
border-top: none;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
// Should probably be moved to table.scss but currently the selectors are too generic
|
||||
.table {
|
||||
position: absolute;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<i class="fa fa-plus" role="img" aria-label="Add button" title="Add button"></i>
|
||||
<span> button in the editing toolbar to create new tables.</span>
|
||||
</div>
|
||||
<div t-else="" class="tables" t-ref="map">
|
||||
<div t-else="" t-ref="map">
|
||||
<t t-foreach="activeTables" t-as="table" t-key="table.id">
|
||||
<Table t-if="table.id !== state.selectedTableId" onClick.bind="onSelectTable" table="table" />
|
||||
<EditableTable t-else="" table="table" onSaveTable.bind="onSaveTable" limit="floorMapRef" />
|
||||
|
||||
@@ -15,16 +15,16 @@ import { registry } from "@web/core/registry";
|
||||
startSteps();
|
||||
|
||||
// Test TransferOrderButton
|
||||
FloorScreen.do.clickTable("T2");
|
||||
FloorScreen.do.clickTable("2");
|
||||
ProductScreen.exec.addOrderline("Water", "5", "2", "10.0");
|
||||
ProductScreen.do.clickTransferButton();
|
||||
FloorScreen.do.clickTable("T4");
|
||||
FloorScreen.do.clickTable("4");
|
||||
ProductScreen.do.clickOrderline("Water", "5", "2");
|
||||
Chrome.do.backToFloor();
|
||||
FloorScreen.do.clickTable("T2");
|
||||
FloorScreen.do.clickTable("2");
|
||||
ProductScreen.check.orderIsEmpty();
|
||||
Chrome.do.backToFloor();
|
||||
FloorScreen.do.clickTable("T4");
|
||||
FloorScreen.do.clickTable("4");
|
||||
ProductScreen.do.clickOrderline("Water", "5", "2");
|
||||
|
||||
// Test SplitBillButton
|
||||
|
||||
@@ -14,21 +14,21 @@ startSteps();
|
||||
|
||||
// check floors if they contain their corresponding tables
|
||||
FloorScreen.check.selectedFloorIs("Main Floor");
|
||||
FloorScreen.check.hasTable("T2");
|
||||
FloorScreen.check.hasTable("T4");
|
||||
FloorScreen.check.hasTable("T5");
|
||||
FloorScreen.check.hasTable("2");
|
||||
FloorScreen.check.hasTable("4");
|
||||
FloorScreen.check.hasTable("5");
|
||||
FloorScreen.do.clickFloor("Second Floor");
|
||||
FloorScreen.check.hasTable("T3");
|
||||
FloorScreen.check.hasTable("T1");
|
||||
FloorScreen.check.hasTable("3");
|
||||
FloorScreen.check.hasTable("1");
|
||||
|
||||
// clicking table in active mode does not open product screen
|
||||
// instead, table is selected
|
||||
FloorScreen.do.clickEdit();
|
||||
FloorScreen.check.editModeIsActive(true);
|
||||
FloorScreen.do.clickTable("T3");
|
||||
FloorScreen.check.selectedTableIs("T3");
|
||||
FloorScreen.do.clickTable("T1");
|
||||
FloorScreen.check.selectedTableIs("T1");
|
||||
FloorScreen.do.clickTable("3");
|
||||
FloorScreen.check.selectedTableIs("3");
|
||||
FloorScreen.do.clickTable("1");
|
||||
FloorScreen.check.selectedTableIs("1");
|
||||
|
||||
// switching floor in edit mode deactivates edit mode
|
||||
FloorScreen.do.clickFloor("Main Floor");
|
||||
@@ -38,62 +38,62 @@ FloorScreen.check.editModeIsActive(true);
|
||||
|
||||
// test add table
|
||||
FloorScreen.do.clickAddTable();
|
||||
FloorScreen.check.selectedTableIs("T1");
|
||||
FloorScreen.check.selectedTableIs("1");
|
||||
FloorScreen.do.clickRename();
|
||||
TextInputPopup.check.isShown();
|
||||
TextInputPopup.do.inputText("T100");
|
||||
TextInputPopup.do.inputText("100");
|
||||
TextInputPopup.do.clickConfirm();
|
||||
FloorScreen.check.selectedTableIs("T100");
|
||||
FloorScreen.check.selectedTableIs("100");
|
||||
|
||||
// test duplicate table
|
||||
FloorScreen.do.clickDuplicate();
|
||||
// new table is already named T101
|
||||
FloorScreen.check.selectedTableIs("T101");
|
||||
// new table is already named 101
|
||||
FloorScreen.check.selectedTableIs("101");
|
||||
FloorScreen.do.clickRename();
|
||||
TextInputPopup.check.isShown();
|
||||
TextInputPopup.do.inputText("T1111");
|
||||
TextInputPopup.do.inputText("1111");
|
||||
TextInputPopup.do.clickConfirm();
|
||||
FloorScreen.check.selectedTableIs("T1111");
|
||||
FloorScreen.check.selectedTableIs("1111");
|
||||
|
||||
// switch floor, switch back and check if
|
||||
// the new tables are still there
|
||||
FloorScreen.do.clickFloor("Second Floor");
|
||||
FloorScreen.check.editModeIsActive(false);
|
||||
FloorScreen.check.hasTable("T3");
|
||||
FloorScreen.check.hasTable("T1");
|
||||
FloorScreen.check.hasTable("3");
|
||||
FloorScreen.check.hasTable("1");
|
||||
|
||||
FloorScreen.do.clickFloor("Main Floor");
|
||||
FloorScreen.check.hasTable("T2");
|
||||
FloorScreen.check.hasTable("T4");
|
||||
FloorScreen.check.hasTable("T5");
|
||||
FloorScreen.check.hasTable("T100");
|
||||
FloorScreen.check.hasTable("T1111");
|
||||
FloorScreen.check.hasTable("2");
|
||||
FloorScreen.check.hasTable("4");
|
||||
FloorScreen.check.hasTable("5");
|
||||
FloorScreen.check.hasTable("100");
|
||||
FloorScreen.check.hasTable("1111");
|
||||
|
||||
// test delete table
|
||||
FloorScreen.do.clickEdit();
|
||||
FloorScreen.check.editModeIsActive(true);
|
||||
FloorScreen.do.clickTable("T2");
|
||||
FloorScreen.check.selectedTableIs("T2");
|
||||
FloorScreen.do.clickTable("2");
|
||||
FloorScreen.check.selectedTableIs("2");
|
||||
FloorScreen.do.clickTrash();
|
||||
Chrome.do.confirmPopup();
|
||||
|
||||
// change number of seats
|
||||
FloorScreen.do.clickTable("T4");
|
||||
FloorScreen.check.selectedTableIs("T4");
|
||||
FloorScreen.do.clickTable("4");
|
||||
FloorScreen.check.selectedTableIs("4");
|
||||
FloorScreen.do.clickSeats();
|
||||
NumberPopup.do.pressNumpad("Backspace 9");
|
||||
NumberPopup.check.inputShownIs("9");
|
||||
NumberPopup.do.clickConfirm();
|
||||
FloorScreen.check.tableSeatIs("T4", "9");
|
||||
FloorScreen.check.tableSeatIs("4", "9");
|
||||
|
||||
// change number of seat when the input is already selected
|
||||
FloorScreen.do.clickTable("T4");
|
||||
FloorScreen.check.selectedTableIs("T4");
|
||||
FloorScreen.do.clickTable("4");
|
||||
FloorScreen.check.selectedTableIs("4");
|
||||
FloorScreen.do.clickSeats();
|
||||
NumberPopup.do.pressNumpad("1 5");
|
||||
NumberPopup.check.inputShownIs("15");
|
||||
NumberPopup.do.clickConfirm();
|
||||
FloorScreen.check.tableSeatIs("T4", "15");
|
||||
FloorScreen.check.tableSeatIs("4", "15");
|
||||
|
||||
// change shape
|
||||
FloorScreen.do.changeShapeTo("round");
|
||||
@@ -101,16 +101,16 @@ FloorScreen.do.changeShapeTo("round");
|
||||
// Opening product screen in main floor should go back to main floor
|
||||
FloorScreen.do.clickEdit();
|
||||
FloorScreen.check.editModeIsActive(false);
|
||||
FloorScreen.check.tableIsNotSelected("T4");
|
||||
FloorScreen.do.clickTable("T4");
|
||||
FloorScreen.check.tableIsNotSelected("4");
|
||||
FloorScreen.do.clickTable("4");
|
||||
ProductScreen.check.isShown();
|
||||
Chrome.check.backToFloorTextIs("Main Floor", "T4");
|
||||
Chrome.check.backToFloorTextIs("Main Floor", "4");
|
||||
Chrome.do.backToFloor();
|
||||
|
||||
// Opening product screen in second floor should go back to second floor
|
||||
FloorScreen.do.clickFloor("Second Floor");
|
||||
FloorScreen.check.hasTable("T3");
|
||||
FloorScreen.do.clickTable("T3");
|
||||
Chrome.check.backToFloorTextIs("Second Floor", "T3");
|
||||
FloorScreen.check.hasTable("3");
|
||||
FloorScreen.do.clickTable("3");
|
||||
Chrome.check.backToFloorTextIs("Second Floor", "3");
|
||||
|
||||
registry.category("web_tour.tours").add("FloorScreenTour", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
|
||||
@@ -13,7 +13,7 @@ import { registry } from "@web/core/registry";
|
||||
// when finished, steps can be taken from getSteps
|
||||
startSteps();
|
||||
|
||||
FloorScreen.do.clickTable("T2");
|
||||
FloorScreen.do.clickTable("2");
|
||||
ProductScreen.do.confirmOpeningPopup();
|
||||
ProductScreen.exec.addOrderline("Water", "5", "2", "10.0");
|
||||
ProductScreen.exec.addOrderline("Minute Maid", "3", "2", "6.0");
|
||||
@@ -53,12 +53,12 @@ registry.category("web_tour.tours").add("SplitBillScreenTour", { test: true, url
|
||||
|
||||
startSteps();
|
||||
|
||||
FloorScreen.do.clickTable("T2");
|
||||
FloorScreen.do.clickTable("2");
|
||||
ProductScreen.exec.addOrderline("Water", "1", "2.0");
|
||||
ProductScreen.exec.addOrderline("Minute Maid", "1", "2.0");
|
||||
ProductScreen.exec.addOrderline("Coca-Cola", "1", "2.0");
|
||||
Chrome.do.backToFloor();
|
||||
FloorScreen.do.clickTable("T2");
|
||||
FloorScreen.do.clickTable("2");
|
||||
ProductScreen.do.clickSplitBillButton();
|
||||
|
||||
SplitBillScreen.do.clickOrderline("Water");
|
||||
|
||||
@@ -16,7 +16,7 @@ TicketScreen.check.noNewTicketButton();
|
||||
TicketScreen.do.clickDiscard();
|
||||
|
||||
// Deleting the last order in the table brings back to floorscreen
|
||||
FloorScreen.do.clickTable("T4");
|
||||
FloorScreen.do.clickTable("4");
|
||||
ProductScreen.check.isShown();
|
||||
Chrome.do.clickTicketButton();
|
||||
TicketScreen.check.nthRowContains(2, "-0001");
|
||||
@@ -25,7 +25,7 @@ FloorScreen.check.isShown();
|
||||
|
||||
// Create 2 items in a table. From floorscreen, delete 1 item. Then select the other item.
|
||||
// Correct order and screen should be displayed and the BackToFloorButton is shown.
|
||||
FloorScreen.do.clickTable("T2");
|
||||
FloorScreen.do.clickTable("2");
|
||||
ProductScreen.exec.addOrderline("Minute Maid", "1", "2");
|
||||
ProductScreen.check.totalAmountIs("2.0");
|
||||
Chrome.do.clickTicketButton();
|
||||
@@ -33,29 +33,29 @@ TicketScreen.do.clickNewTicket();
|
||||
ProductScreen.exec.addOrderline("Coca-Cola", "2", "2");
|
||||
ProductScreen.check.totalAmountIs("4.0");
|
||||
Chrome.do.backToFloor();
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T2", "2");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("2", "2");
|
||||
Chrome.do.clickTicketButton();
|
||||
TicketScreen.do.deleteOrder("-0003");
|
||||
Chrome.do.confirmPopup();
|
||||
TicketScreen.do.selectOrder("-0002");
|
||||
ProductScreen.check.isShown();
|
||||
ProductScreen.check.totalAmountIs("2.0");
|
||||
Chrome.check.backToFloorTextIs("Main Floor", "T2");
|
||||
Chrome.check.backToFloorTextIs("Main Floor", "2");
|
||||
Chrome.do.backToFloor();
|
||||
|
||||
// Make sure that order is deleted properly.
|
||||
FloorScreen.do.clickTable("T5");
|
||||
FloorScreen.do.clickTable("5");
|
||||
ProductScreen.exec.addOrderline("Minute Maid", "1", "3");
|
||||
ProductScreen.check.totalAmountIs("3.0");
|
||||
Chrome.do.backToFloor();
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T5", "1");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("5", "1");
|
||||
Chrome.do.clickTicketButton();
|
||||
TicketScreen.do.deleteOrder("-0004");
|
||||
Chrome.do.confirmPopup();
|
||||
TicketScreen.do.clickDiscard();
|
||||
FloorScreen.check.isShown();
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T5", "0");
|
||||
FloorScreen.do.clickTable("T5");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("5", "0");
|
||||
FloorScreen.do.clickTable("5");
|
||||
ProductScreen.check.orderIsEmpty();
|
||||
|
||||
registry
|
||||
|
||||
@@ -15,13 +15,13 @@ startSteps();
|
||||
|
||||
// Create order that is synced when draft.
|
||||
// order 1
|
||||
FloorScreen.do.clickTable("T2");
|
||||
FloorScreen.do.clickTable("2");
|
||||
ProductScreen.do.confirmOpeningPopup();
|
||||
ProductScreen.exec.addOrderline("Minute Maid", "1", "2");
|
||||
ProductScreen.check.totalAmountIs("2.0");
|
||||
Chrome.do.backToFloor();
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T2", "1");
|
||||
FloorScreen.do.clickTable("T2");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("2", "1");
|
||||
FloorScreen.do.clickTable("2");
|
||||
ProductScreen.check.totalAmountIs("2.0");
|
||||
ProductScreen.do.clickPayButton();
|
||||
PaymentScreen.do.clickPaymentMethod("Bank");
|
||||
@@ -33,14 +33,14 @@ TicketScreen.do.clickNewTicket();
|
||||
ProductScreen.exec.addOrderline("Coca-Cola", "2", "2");
|
||||
ProductScreen.check.totalAmountIs("4.0");
|
||||
Chrome.do.backToFloor();
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T2", "1");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("2", "1");
|
||||
Chrome.do.clickTicketButton();
|
||||
TicketScreen.check.nthRowContains("2", "Tipping");
|
||||
TicketScreen.do.clickDiscard();
|
||||
|
||||
// Create without syncing the draft.
|
||||
// order 3
|
||||
FloorScreen.do.clickTable("T5");
|
||||
FloorScreen.do.clickTable("5");
|
||||
ProductScreen.exec.addOrderline("Minute Maid", "3", "2");
|
||||
ProductScreen.check.totalAmountIs("6.0");
|
||||
ProductScreen.do.clickPayButton();
|
||||
@@ -53,7 +53,7 @@ TicketScreen.do.clickNewTicket();
|
||||
ProductScreen.exec.addOrderline("Coca-Cola", "4", "2");
|
||||
ProductScreen.check.totalAmountIs("8.0");
|
||||
Chrome.do.backToFloor();
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T5", "1");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("5", "1");
|
||||
Chrome.do.clickTicketButton();
|
||||
TicketScreen.check.nthRowContains("3", "Tipping");
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ class Check {
|
||||
return [
|
||||
{
|
||||
content: `selected floor has '${name}' table`,
|
||||
trigger: `.floor-map .tables .table .label:contains("${name}")`,
|
||||
trigger: `.floor-map .table .label:contains("${name}")`,
|
||||
run: () => {},
|
||||
},
|
||||
];
|
||||
@@ -118,7 +118,7 @@ class Check {
|
||||
return [
|
||||
{
|
||||
content: `number of seats in table '${table}' is '${val}'`,
|
||||
trigger: `.floor-map .tables .table .label:contains("${table}") ~ .table-seats:contains("${val}")`,
|
||||
trigger: `.floor-map .table .label:contains("${table}") ~ .table-seats:contains("${val}")`,
|
||||
run: function () {},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -11,7 +11,7 @@ import { registry } from "@web/core/registry";
|
||||
|
||||
startSteps();
|
||||
|
||||
FloorScreen.do.clickTable("T5");
|
||||
FloorScreen.do.clickTable("5");
|
||||
|
||||
// Create first order
|
||||
ProductScreen.do.confirmOpeningPopup();
|
||||
@@ -36,8 +36,8 @@ ReceiptScreen.do.clickNextOrder();
|
||||
|
||||
// After clicking next order, floor screen is shown.
|
||||
// It should have 1 as number of draft synced order.
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T5", "1");
|
||||
FloorScreen.do.clickTable("T5");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("5", "1");
|
||||
FloorScreen.do.clickTable("5");
|
||||
ProductScreen.check.totalAmountIs("4.40");
|
||||
|
||||
// Create another draft order and go back to floor
|
||||
@@ -50,10 +50,10 @@ ProductScreen.check.selectedOrderlineHas("Minute Maid");
|
||||
Chrome.do.backToFloor();
|
||||
|
||||
// At floor screen, there should be 2 synced draft orders
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T5", "2");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("5", "2");
|
||||
|
||||
// Delete the first order then go back to floor
|
||||
FloorScreen.do.clickTable("T5");
|
||||
FloorScreen.do.clickTable("5");
|
||||
ProductScreen.check.isShown();
|
||||
Chrome.do.clickTicketButton();
|
||||
TicketScreen.do.deleteOrder("-0001");
|
||||
@@ -62,7 +62,7 @@ TicketScreen.do.selectOrder("-0003");
|
||||
Chrome.do.backToFloor();
|
||||
|
||||
// There should be 1 synced draft order.
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T5", "1");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("5", "1");
|
||||
registry.category("web_tour.tours").add("pos_restaurant_sync", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
|
||||
startSteps();
|
||||
@@ -73,13 +73,13 @@ startSteps();
|
||||
*/
|
||||
|
||||
// There is one draft synced order from the previous tour
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T5", "1");
|
||||
FloorScreen.do.clickTable("T5");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("5", "1");
|
||||
FloorScreen.do.clickTable("5");
|
||||
ProductScreen.check.totalAmountIs("4.40");
|
||||
|
||||
// Test transfering an order
|
||||
ProductScreen.do.clickTransferButton();
|
||||
FloorScreen.do.clickTable("T4");
|
||||
FloorScreen.do.clickTable("4");
|
||||
|
||||
// Test if products still get merged after transfering the order
|
||||
ProductScreen.do.clickDisplayedProduct("Coca-Cola");
|
||||
@@ -93,14 +93,14 @@ PaymentScreen.do.clickValidate();
|
||||
ReceiptScreen.do.clickNextOrder();
|
||||
// At this point, there are no draft orders.
|
||||
|
||||
FloorScreen.do.clickTable("T2");
|
||||
FloorScreen.do.clickTable("2");
|
||||
ProductScreen.check.isShown();
|
||||
ProductScreen.check.orderIsEmpty();
|
||||
ProductScreen.do.clickTransferButton();
|
||||
FloorScreen.do.clickTable("T4");
|
||||
FloorScreen.do.clickTable("4");
|
||||
ProductScreen.do.clickDisplayedProduct("Coca-Cola");
|
||||
ProductScreen.check.totalAmountIs("2.20");
|
||||
Chrome.do.backToFloor();
|
||||
FloorScreen.check.orderCountSyncedInTableIs("T4", "1");
|
||||
FloorScreen.check.orderCountSyncedInTableIs("4", "1");
|
||||
|
||||
registry.category("web_tour.tours").add("pos_restaurant_sync_second_login", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
|
||||
@@ -55,14 +55,14 @@ class TestFrontend(odoo.tests.HttpCase):
|
||||
})
|
||||
|
||||
table_05 = self.env['restaurant.table'].create({
|
||||
'name': 'T5',
|
||||
'name': '5',
|
||||
'floor_id': main_floor.id,
|
||||
'seats': 4,
|
||||
'position_h': 100,
|
||||
'position_v': 100,
|
||||
})
|
||||
table_04 = self.env['restaurant.table'].create({
|
||||
'name': 'T4',
|
||||
'name': '4',
|
||||
'floor_id': main_floor.id,
|
||||
'seats': 4,
|
||||
'shape': 'square',
|
||||
@@ -70,7 +70,7 @@ class TestFrontend(odoo.tests.HttpCase):
|
||||
'position_v': 100,
|
||||
})
|
||||
table_02 = self.env['restaurant.table'].create({
|
||||
'name': 'T2',
|
||||
'name': '2',
|
||||
'floor_id': main_floor.id,
|
||||
'seats': 4,
|
||||
'position_h': 250,
|
||||
@@ -83,7 +83,7 @@ class TestFrontend(odoo.tests.HttpCase):
|
||||
})
|
||||
|
||||
table_01 = self.env['restaurant.table'].create({
|
||||
'name': 'T1',
|
||||
'name': '1',
|
||||
'floor_id': second_floor.id,
|
||||
'seats': 4,
|
||||
'shape': 'square',
|
||||
@@ -91,7 +91,7 @@ class TestFrontend(odoo.tests.HttpCase):
|
||||
'position_v': 150,
|
||||
})
|
||||
table_03 = self.env['restaurant.table'].create({
|
||||
'name': 'T3',
|
||||
'name': '3',
|
||||
'floor_id': second_floor.id,
|
||||
'seats': 4,
|
||||
'position_h': 100,
|
||||
|
||||
Reference in New Issue
Block a user