Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16.0 eee #3

Merged
merged 5 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
Expand Down
5 changes: 5 additions & 0 deletions test_pos2023/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
===========================
Тестовые Сценарии для POS
===========================

Для подробностей загляните в папку ``tests``.
Empty file added test_pos2023/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions test_pos2023/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Тестовые сценарии для POS",
"version": "16.0.0.1.0",
"license": "LGPL-3",
"depends": [
"point_of_sale",
],
}
1 change: 1 addition & 0 deletions test_pos2023/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_session_close
92 changes: 92 additions & 0 deletions test_pos2023/tests/test_session_close.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import inspect
import logging

from odoo.tests import tagged

from odoo.addons.point_of_sale.tests.common import TestPoSCommon

_logger = logging.getLogger(__name__)


@tagged("post_install", "-at_install")
class TestSessionClose(TestPoSCommon):
def setUp(self):
super(TestPoSCommon, self).setUp()
self.product1 = self.env["product.product"].create(
{
"type": "consu",
"available_in_pos": True,
"taxes_id": [(5, 0, 0)],
"name": "Consumable Product 1",
"categ_id": self.categ_basic.id,
"lst_price": 10.0,
"standard_price": 5,
}
)

def test_late_session_close(self):
method_name = inspect.currentframe().f_code.co_name

# В первом POS открываем сессию
self.config = self._create_basic_config()
self.open_new_session()
session1 = self.pos_session

# Оплачиваем наличкой один заказ
orders = []
orders.append(
self.create_ui_order_data(
[(self.product1, 1)],
payments=[(self.cash_pm1, 10)],
)
)

self.env["pos.order"].create_from_ui(orders)

# Не закрываем сессию в первом POS
# и открываем и закрываем много сессий на втором POS-е
# в каждой сессии также по одному заказу оплачиваем наличкой
self.config = self._create_basic_config()

for i in range(1000):
_logger.info("%s: running session %s" % (method_name, i))
self.open_new_session()
order = self.create_ui_order_data(
[(self.product1, 1)],
payments=[(self.cash_pm1, 10)],
)
self.env["pos.order"].create_from_ui([order])
self.pos_session.action_pos_session_validate()

# Ну а теперь попробуем закрывать самую первую сессию
_logger.info("closing very first session")
session1.action_pos_session_validate()

def test_1000_pos_configs(self):
method_name = inspect.currentframe().f_code.co_name

for i in range(1000):
pos = self._create_basic_config()
# открываем очередную кассу
_logger.info("%s: running session %s" % (method_name, i))
self.config = pos
self.open_new_session()

# заказываем что-то
orders = []
orders.append(
self.create_ui_order_data(
[(self.product1, 1)],
payments=[(self.cash_pm1, 10)],
)
)
self.env["pos.order"].create_from_ui(orders)

if i == 0:
# первую сессию просто запоминаем
first_session = self.pos_session
else:
# остальные сессии закрываем
self.pos_session.action_pos_session_validate()

first_session.action_pos_session_validate()
Loading