-
-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! fixup! [MIG] pos_deposit to v16
- Loading branch information
Showing
8 changed files
with
174 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* Copyright 2024 Hunki Enterprises BV | ||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
*/ | ||
odoo.define("pos_container_deposit.components", function (require) { | ||
"use strict"; | ||
|
||
const Orderline = require("point_of_sale.Orderline"); | ||
const Registries = require("point_of_sale.Registries"); | ||
const PosDepositOrderlineExtension = (Orderline) => | ||
class PosDepositOrderline extends Orderline { | ||
selectLine() { | ||
/* | ||
* Don't allow selecting deposit products | ||
*/ | ||
if (!this.props.line.is_container_deposit) { | ||
super.selectLine(...arguments); | ||
} | ||
} | ||
}; | ||
|
||
Registries.Component.extend(Orderline, PosDepositOrderlineExtension); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
pos_container_deposit/static/tests/tours/pos_container_deposit_tour.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
odoo.define("pos_container_deposit.test_tour", function (require) { | ||
"use strict"; | ||
|
||
const {ProductScreen} = require("point_of_sale.tour.ProductScreenTourMethods"); | ||
const {getSteps, startSteps} = require("point_of_sale.tour.utils"); | ||
const Tour = require("web_tour.tour"); | ||
const product_name = "Generic sugar liquid"; | ||
const deposit_product_name = "Bottle deposit .25"; | ||
|
||
startSteps(); | ||
|
||
ProductScreen.do.clickHomeCategory(); | ||
ProductScreen.do.clickDisplayedProduct(product_name); | ||
ProductScreen.do.clickDisplayedProduct(product_name); | ||
ProductScreen.check.checkOrderlinesNumber(2); | ||
ProductScreen.check.selectedOrderlineHas(product_name); | ||
getSteps().push({ | ||
content: `selecting orderline with product '${deposit_product_name}' and quantity '2.0'`, | ||
trigger: `.order .orderline:not(:has(.selected)) .product-name:contains("${deposit_product_name}") ~ .info-list em:contains("2.0")`, | ||
}); | ||
ProductScreen.check.selectedOrderlineHas(product_name); | ||
ProductScreen.do.pressNumpad("Price"); | ||
ProductScreen.check.modeIsActive("Price"); | ||
ProductScreen.do.pressNumpad("5"); | ||
ProductScreen.check.selectedOrderlineHas(product_name, "2", "10"); | ||
ProductScreen.do.clickDisplayedProduct(product_name); | ||
ProductScreen.do.clickDisplayedProduct(product_name); | ||
ProductScreen.check.checkOrderlinesNumber(4); | ||
ProductScreen.do.pressNumpad("Qty"); | ||
ProductScreen.do.pressNumpad("Backspace"); | ||
ProductScreen.do.pressNumpad("Backspace"); | ||
ProductScreen.check.modeIsActive("Qty"); | ||
ProductScreen.check.selectedOrderlineHas(product_name, "2", "10"); | ||
ProductScreen.check.checkOrderlinesNumber(2); | ||
ProductScreen.do.pressNumpad("Qty"); | ||
ProductScreen.do.pressNumpad("Backspace"); | ||
ProductScreen.do.pressNumpad("Backspace"); | ||
ProductScreen.check.modeIsActive("Qty"); | ||
ProductScreen.check.orderIsEmpty(); | ||
|
||
Tour.register( | ||
"pos_container_deposit.test_tour", | ||
{test: true, url: "/pos/ui"}, | ||
getSteps() | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import test_pos_container_deposit | ||
from . import test_pos_container_deposit_frontend |
14 changes: 14 additions & 0 deletions
14
pos_container_deposit/tests/test_pos_container_deposit_frontend.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from odoo.tests.common import tagged | ||
|
||
from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon | ||
|
||
|
||
@tagged("post_install", "-at_install") | ||
class TestPosContainerDeposit(TestPointOfSaleHttpCommon): | ||
def run_tour(self): | ||
self.main_pos_config.open_ui() | ||
self.start_tour( | ||
"/pos/ui?config_id=%d" % self.main_pos_config.id, | ||
"pos_container_deposit.test_tour", | ||
login="accountman", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../pos_container_deposit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |