From 6a26de362250d9c70e2a0f52e481248376c66b22 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 16 Aug 2024 15:05:03 -0500 Subject: [PATCH 1/6] fix: refactory grid usage per wuttaweb --- tailbone_corepos/views/corepos/groups.py | 3 ++- tailbone_corepos/views/corepos/products.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tailbone_corepos/views/corepos/groups.py b/tailbone_corepos/views/corepos/groups.py index 3648dbb..84e87c8 100644 --- a/tailbone_corepos/views/corepos/groups.py +++ b/tailbone_corepos/views/corepos/groups.py @@ -125,7 +125,8 @@ class UserGroupView(CoreOfficeMasterView): permission_prefix = self.get_permission_prefix() factory = self.get_grid_factory() g = factory( - key='{}.users'.format(route_prefix), + self.request, + key=f'{route_prefix}.users', data=[], columns=[ 'username', diff --git a/tailbone_corepos/views/corepos/products.py b/tailbone_corepos/views/corepos/products.py index 70697e2..823da2d 100644 --- a/tailbone_corepos/views/corepos/products.py +++ b/tailbone_corepos/views/corepos/products.py @@ -248,7 +248,8 @@ class ProductView(CoreOfficeMasterView): factory = self.get_grid_factory() g = factory( - key='{}.vendor_items'.format(route_prefix), + self.request, + key=f'{route_prefix}.vendor_items', data=[], columns=[ 'vendor_name', From 827927355d1aa30553cda1d4514b295f93cfa68a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 18 Aug 2024 20:09:01 -0500 Subject: [PATCH 2/6] =?UTF-8?q?bump:=20version=200.3.0=20=E2=86=92=200.3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2632cd2..a0a2756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to tailbone-corepos will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.3.1 (2024-08-18) + +### Fix + +- refactory grid usage per wuttaweb + ## v0.3.0 (2024-08-06) ### Feat diff --git a/pyproject.toml b/pyproject.toml index 64f726a..2bcdc3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "tailbone-corepos" -version = "0.3.0" +version = "0.3.1" description = "Tailbone interfaces for CORE POS" readme = "README.rst" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] From 06d1ada3fda23ee966208830f0f353fb0d847d1a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 13 Sep 2024 18:13:45 -0500 Subject: [PATCH 3/6] docs: use markdown for readme file --- README.md | 12 ++++++++++++ README.rst | 15 --------------- pyproject.toml | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) create mode 100644 README.md delete mode 100644 README.rst diff --git a/README.md b/README.md new file mode 100644 index 0000000..2af4798 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ + +# tailbone-corepos + +Rattail is a retail software framework, released under the GNU General +Public License. + +This package contains software interfaces for the [CORE +POS](https://www.core-pos.com/) system, which is open source and +freely available. + +Please see Rattail's [home page](https://rattailproject.org/) for more +information. diff --git a/README.rst b/README.rst deleted file mode 100644 index 3a6860d..0000000 --- a/README.rst +++ /dev/null @@ -1,15 +0,0 @@ - -tailbone-corepos -================ - -Rattail is a retail software framework, released under the GNU General Public -License. - -This package contains software interfaces for the `CORE POS`_ system, which is -open source and freely available. - -.. _`CORE POS`: https://www.core-pos.com/ - -Please see Rattail's `home page`_ for more information. - -.. _`home page`: https://rattailproject.org/ diff --git a/pyproject.toml b/pyproject.toml index 2bcdc3c..aee79b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" name = "tailbone-corepos" version = "0.3.1" description = "Tailbone interfaces for CORE POS" -readme = "README.rst" +readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}] license = {text = "GNU GPL v3+"} classifiers = [ From 494cae2433b79d2a06709f5446f874da99ebac1a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 14 Sep 2024 13:39:25 -0500 Subject: [PATCH 4/6] docs: update project links, kallithea -> forgejo --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index aee79b9..1fb6efd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,10 +33,10 @@ dependencies = [ [project.urls] -Homepage = "https://redmine.rattailproject.org/projects/corepos-integration" -Repository = "https://kallithea.rattailproject.org/rattail-project/tailbone-corepos" -Issues = "https://redmine.rattailproject.org/projects/corepos-integration/issues" -Changelog = "https://kallithea.rattailproject.org/rattail-project/tailbone-corepos/files/master/CHANGELOG.md" +Homepage = "https://rattailproject.org" +Repository = "https://forgejo.wuttaproject.org/rattail/tailbone-corepos" +Issues = "https://forgejo.wuttaproject.org/rattail/tailbone-corepos/issues" +Changelog = "https://forgejo.wuttaproject.org/rattail/tailbone-corepos/src/branch/master/CHANGELOG.md" [project.entry-points."tailbone.providers"] From 3514b477765d4017bc9a0d263699b0eaf873bc29 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 18 Nov 2024 19:15:51 -0600 Subject: [PATCH 5/6] fix: add startup workaround for CORE model imports, to avoid error still not 100% clear why this has started happening but clearly has something to do with changes to wuttjamaican / rattail config startup sequence.. --- tailbone_corepos/provider.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/tailbone_corepos/provider.py b/tailbone_corepos/provider.py index c128a18..043b30e 100644 --- a/tailbone_corepos/provider.py +++ b/tailbone_corepos/provider.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2023 Lance Edgar +# Copyright © 2010-2024 Lance Edgar # # This file is part of Rattail. # @@ -24,6 +24,7 @@ Tailbone Provider for CORE-POS Integration """ +import sqlalchemy as sa from sqlalchemy.orm import sessionmaker, scoped_session from zope.sqlalchemy import register @@ -71,6 +72,37 @@ class TailboneCorePosProvider(TailboneProvider): register(Session) ExtraCoreTransArchiveSessions[key] = Session + # must import all sqlalchemy models before things get rolling, + # otherwise can have errors about continuum TransactionMeta class + # not yet mapped, when relevant pages are first requested... + # cf. https://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/database/sqlalchemy.html#importing-all-sqlalchemy-models + # hat tip to https://stackoverflow.com/a/59241485 + if rattail_config.core_office_op_engine: + app = rattail_config.get_app() + corepos = app.get_corepos_handler() + + # nb. use fake db to avoid true cxn errors, since the only + # point of this is to load the models + engine = sa.create_engine('sqlite://') + + # office_op + core_model = corepos.get_model_office_op() + core_session = corepos.make_session_office_op(bind=engine) + try: + core_session.query(core_model.Store).first() + except sa.exc.OperationalError: + pass + core_session.close() + + # office_trans + core_model = corepos.get_model_office_trans() + core_session = corepos.make_session_office_trans(bind=engine) + try: + core_session.query(core_model.TransactionDetail).first() + except sa.exc.OperationalError: + pass + core_session.close() + def get_provided_views(self): return { From 7249598b35e44b4c4e018264a28f5f7750e99d1f Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 18 Nov 2024 19:17:09 -0600 Subject: [PATCH 6/6] =?UTF-8?q?bump:=20version=200.3.1=20=E2=86=92=200.3.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0a2756..225501c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to tailbone-corepos will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.3.2 (2024-11-18) + +### Fix + +- add startup workaround for CORE model imports, to avoid error + ## v0.3.1 (2024-08-18) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 1fb6efd..8ef8cf8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "hatchling.build" [project] name = "tailbone-corepos" -version = "0.3.1" +version = "0.3.2" description = "Tailbone interfaces for CORE POS" readme = "README.md" authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]