From ebb9211f2d2acdf9f3df0b91c5dccbc48ebddabf Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 13 Jan 2025 17:03:32 -0600 Subject: [PATCH 1/6] docs: tweak readme, project trove classifiers --- README.md | 3 ++- pyproject.toml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 93b3bc9..a339dd3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Sideshow-COREPOS -This package adds CORE-POS integration for Sideshow. +This package adds [CORE-POS](https://www.core-pos.com/) integration +for [Sideshow](https://pypi.org/project/Sideshow/). Full docs are at https://rattailproject.org/docs/sideshow-corepos/ diff --git a/pyproject.toml b/pyproject.toml index 7c4e2e7..502285a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,8 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Topic :: Office/Business", + "Topic :: Software Development :: Libraries :: Python Modules", ] license = {text = "GNU General Public License v3+"} requires-python = ">= 3.8" From 7721ddf11edf507355e2a4dc278f6796cde57f91 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 13 Jan 2025 20:37:53 -0600 Subject: [PATCH 2/6] docs: remove bad version string --- docs/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index a5ee51b..8bbe594 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,6 @@ from importlib.metadata import version as get_version project = 'Sideshow-COREPOS' copyright = '2025, Lance Edgar' author = 'Lance Edgar' -release = '0.1' release = get_version('Sideshow-COREPOS') # -- General configuration --------------------------------------------------- From 5d3820a8f206523805c6778b46b1e8d73250067b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 18 Feb 2025 12:15:27 -0600 Subject: [PATCH 3/6] docs: update intersphinx doc links per server migration --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 8bbe594..17b5ce7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,8 +27,8 @@ templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] intersphinx_mapping = { - 'sideshow': ('https://rattailproject.org/docs/sideshow/', None), - 'wuttjamaican': ('https://rattailproject.org/docs/wuttjamaican/', None), + 'sideshow': ('https://docs.wuttaproject.org/sideshow/', None), + 'wuttjamaican': ('https://docs.wuttaproject.org/wuttjamaican/', None), } From c9d093d343f5c62d2eb40560606390a1c0053755 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 20 Feb 2025 09:02:26 -0600 Subject: [PATCH 4/6] fix: set vendor name, sku when refreshing neworder batch row --- src/sideshow_corepos/batch/neworder.py | 8 ++++++++ tests/batch/test_neworder.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/sideshow_corepos/batch/neworder.py b/src/sideshow_corepos/batch/neworder.py index 694604c..bff2f1a 100644 --- a/src/sideshow_corepos/batch/neworder.py +++ b/src/sideshow_corepos/batch/neworder.py @@ -198,6 +198,14 @@ class NewOrderBatchHandler(base.NewOrderBatchHandler): row.department_id = product.department_number row.department_name = product.department.name if product.department else None row.special_order = False + + row.vendor_name = None + row.vendor_item_code = None + item = product.default_vendor_item + if item: + row.vendor_name = item.vendor.name if item.vendor else None + row.vendor_item_code = item.sku + row.case_size = self.get_case_size_for_external_product(product) row.unit_cost = product.cost row.unit_price_reg = self.get_unit_price_reg_for_external_product(product) diff --git a/tests/batch/test_neworder.py b/tests/batch/test_neworder.py index 290d339..b96cda9 100644 --- a/tests/batch/test_neworder.py +++ b/tests/batch/test_neworder.py @@ -259,3 +259,5 @@ class TestNewOrderBatchHandler(DataTestCase): self.assertEqual(row.product_size, "32oz") self.assertEqual(row.case_size, decimal.Decimal('12.3400')) self.assertEqual(row.unit_price_reg, decimal.Decimal('4.19')) + self.assertEqual(row.vendor_name, 'Acme Distributors') + self.assertEqual(row.vendor_item_code, '1234') From 198c3f77bbfa0e67b5e4035dbd686e461b755aed Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 20 Feb 2025 09:34:41 -0600 Subject: [PATCH 5/6] =?UTF-8?q?bump:=20version=200.1.0=20=E2=86=92=200.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38a3ffe..5c9f8fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.1.1 (2025-02-20) + +### Fix + +- set vendor name, sku when refreshing neworder batch row + ## v0.1.0 (2025-01-13) ### Feat diff --git a/pyproject.toml b/pyproject.toml index 502285a..6d57724 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "Sideshow-COREPOS" -version = "0.1.0" +version = "0.1.1" description = "Case/Special Order Tracker for CORE-POS" readme = "README.md" authors = [ @@ -33,8 +33,8 @@ classifiers = [ license = {text = "GNU General Public License v3+"} requires-python = ">= 3.8" dependencies = [ - "Sideshow>=0.3.0", - "Wutta-COREPOS[web]>=0.2.0", + "Sideshow>=0.6.0", + "Wutta-COREPOS[web]>=0.3.0", ] [project.optional-dependencies] From bad6ded72dd5985af7ed80bff9aacf9963c15464 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 6 Jul 2025 14:09:11 -0500 Subject: [PATCH 6/6] fix: allow config injection for sake of tests per changes in wuttaweb, sideshow --- pyproject.toml | 2 +- src/sideshow_corepos/web/app.py | 11 ++++++----- tests/test_config.py | 18 ++++++++++++++++++ tests/web/test_app.py | 28 ++++++++++++++++++++-------- 4 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 tests/test_config.py diff --git a/pyproject.toml b/pyproject.toml index 6d57724..9b1b077 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ classifiers = [ license = {text = "GNU General Public License v3+"} requires-python = ">= 3.8" dependencies = [ - "Sideshow>=0.6.0", + "Sideshow>=0.7.1", "Wutta-COREPOS[web]>=0.3.0", ] diff --git a/src/sideshow_corepos/web/app.py b/src/sideshow_corepos/web/app.py index 6f4e327..e249760 100644 --- a/src/sideshow_corepos/web/app.py +++ b/src/sideshow_corepos/web/app.py @@ -44,7 +44,8 @@ def main(global_config, **settings): pyramid_config = base.make_pyramid_config(settings) # configure DB sessions - CoreOpSession.configure(bind=wutta_config.core_office_op_engine) + if hasattr(wutta_config, 'core_office_op_engine'): + CoreOpSession.configure(bind=wutta_config.core_office_op_engine) # bring in the rest of Sideshow pyramid_config.include('sideshow.web') @@ -53,15 +54,15 @@ def main(global_config, **settings): return pyramid_config.make_wsgi_app() -def make_wsgi_app(): +def make_wsgi_app(config=None): """ Make and return the WSGI app (generic entry point). """ - return base.make_wsgi_app(main) + return base.make_wsgi_app(main, config=config) -def make_asgi_app(): +def make_asgi_app(config=None): """ Make and return the ASGI app (generic entry point). """ - return base.make_asgi_app(main) + return base.make_asgi_app(main, config=config) diff --git a/tests/test_config.py b/tests/test_config.py new file mode 100644 index 0000000..5ad7a3b --- /dev/null +++ b/tests/test_config.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8; -*- + +from wuttjamaican.testing import ConfigTestCase + +from sideshow_corepos import config as mod + + +class TestSideshowCoreposConfig(ConfigTestCase): + + def test_basic(self): + + self.assertIsNone(self.config.get('wutta.batch.neworder.handler.spec')) + + ext = mod.SideshowCoreposConfig() + ext.configure(self.config) + + self.assertEqual(self.config.get('wutta.batch.neworder.handler.spec'), + 'sideshow_corepos.batch.neworder:NewOrderBatchHandler') diff --git a/tests/web/test_app.py b/tests/web/test_app.py index 1b4790e..d7f900c 100644 --- a/tests/web/test_app.py +++ b/tests/web/test_app.py @@ -1,32 +1,44 @@ # -*- coding: utf-8; -*- -from wuttjamaican.testing import FileTestCase, ConfigTestCase +import sqlalchemy as sa + +from wuttjamaican.testing import DataTestCase from asgiref.wsgi import WsgiToAsgi from pyramid.router import Router +from wutta_corepos.web.db import CoreOpSession + from sideshow_corepos.web import app as mod -class TestMain(FileTestCase): +class TestMain(DataTestCase): def test_basic(self): global_config = None - myconf = self.write_file('my.conf', '') - settings = {'wutta.config': myconf} + settings = {'wutta_config': self.config} app = mod.main(global_config, **settings) self.assertIsInstance(app, Router) + self.assertIsNone(CoreOpSession.session_factory.kw['bind']) + + def test_corepos_engine(self): + engine = sa.create_engine('sqlite://') + self.config.core_office_op_engine = engine + settings = {'wutta_config': self.config} + app = mod.main(None, **settings) + self.assertIsInstance(app, Router) + self.assertIs(CoreOpSession.session_factory.kw['bind'], engine) -class TestMakeWsgiApp(ConfigTestCase): +class TestMakeWsgiApp(DataTestCase): def test_basic(self): - wsgi = mod.make_wsgi_app() + wsgi = mod.make_wsgi_app(config=self.config) self.assertIsInstance(wsgi, Router) -class TestMakeAsgiApp(ConfigTestCase): +class TestMakeAsgiApp(DataTestCase): def test_basic(self): - asgi = mod.make_asgi_app() + asgi = mod.make_asgi_app(config=self.config) self.assertIsInstance(asgi, WsgiToAsgi)