diff --git a/setup/.setuptools-odoo-make-default-ignore b/setup/.setuptools-odoo-make-default-ignore deleted file mode 100644 index 207e615..0000000 --- a/setup/.setuptools-odoo-make-default-ignore +++ /dev/null @@ -1,2 +0,0 @@ -# addons listed in this file are ignored by -# setuptools-odoo-make-default (one addon per line) diff --git a/setup/README b/setup/README deleted file mode 100644 index a63d633..0000000 --- a/setup/README +++ /dev/null @@ -1,2 +0,0 @@ -To learn more about this directory, please visit -https://pypi.python.org/pypi/setuptools-odoo diff --git a/setup/_metapackage/VERSION.txt b/setup/_metapackage/VERSION.txt deleted file mode 100644 index fac43ba..0000000 --- a/setup/_metapackage/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -16.0.20231216.0 \ No newline at end of file diff --git a/setup/_metapackage/setup.py b/setup/_metapackage/setup.py deleted file mode 100644 index 3560f9f..0000000 --- a/setup/_metapackage/setup.py +++ /dev/null @@ -1,20 +0,0 @@ -import setuptools - -with open('VERSION.txt', 'r') as f: - version = f.read().strip() - -setuptools.setup( - name="odoo-addons-acsone-scobidoo", - description="Meta package for acsone-scobidoo Odoo addons", - version=version, - install_requires=[ - 'odoo-addon-statechart>=16.0dev,<16.1dev', - 'odoo-addon-statechart_demo>=16.0dev,<16.1dev', - 'odoo-addon-test_statechart>=16.0dev,<16.1dev', - ], - classifiers=[ - 'Programming Language :: Python', - 'Framework :: Odoo', - 'Framework :: Odoo :: 16.0', - ] -) diff --git a/setup/statechart/odoo/addons/statechart b/setup/statechart/odoo/addons/statechart deleted file mode 120000 index bbc8b2d..0000000 --- a/setup/statechart/odoo/addons/statechart +++ /dev/null @@ -1 +0,0 @@ -../../../../statechart \ No newline at end of file diff --git a/setup/statechart/setup.py b/setup/statechart/setup.py deleted file mode 100644 index 28c57bb..0000000 --- a/setup/statechart/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -import setuptools - -setuptools.setup( - setup_requires=['setuptools-odoo'], - odoo_addon=True, -) diff --git a/setup/statechart_demo/odoo/addons/statechart_demo b/setup/statechart_demo/odoo/addons/statechart_demo deleted file mode 120000 index f9853e8..0000000 --- a/setup/statechart_demo/odoo/addons/statechart_demo +++ /dev/null @@ -1 +0,0 @@ -../../../../statechart_demo \ No newline at end of file diff --git a/setup/statechart_demo/setup.py b/setup/statechart_demo/setup.py deleted file mode 100644 index 28c57bb..0000000 --- a/setup/statechart_demo/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -import setuptools - -setuptools.setup( - setup_requires=['setuptools-odoo'], - odoo_addon=True, -) diff --git a/setup/test_statechart/odoo/addons/test_statechart b/setup/test_statechart/odoo/addons/test_statechart deleted file mode 120000 index d100b74..0000000 --- a/setup/test_statechart/odoo/addons/test_statechart +++ /dev/null @@ -1 +0,0 @@ -../../../../test_statechart \ No newline at end of file diff --git a/setup/test_statechart/setup.py b/setup/test_statechart/setup.py deleted file mode 100644 index 28c57bb..0000000 --- a/setup/test_statechart/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -import setuptools - -setuptools.setup( - setup_requires=['setuptools-odoo'], - odoo_addon=True, -) diff --git a/statechart/README.rst b/statechart/README.rst index f92e320..df965d2 100644 --- a/statechart/README.rst +++ b/statechart/README.rst @@ -17,7 +17,7 @@ Statechart :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-acsone%2Fscobidoo-lightgray.png?logo=github - :target: https://github.com/acsone/scobidoo/tree/16.0/statechart + :target: https://github.com/acsone/scobidoo/tree/18.0/statechart :alt: acsone/scobidoo |badge1| |badge2| |badge3| @@ -47,7 +47,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -62,6 +62,6 @@ Authors Maintainers ----------- -This module is part of the `acsone/scobidoo `_ project on GitHub. +This module is part of the `acsone/scobidoo `_ project on GitHub. You are welcome to contribute. diff --git a/statechart/__manifest__.py b/statechart/__manifest__.py index fb923c7..164f867 100644 --- a/statechart/__manifest__.py +++ b/statechart/__manifest__.py @@ -5,7 +5,7 @@ "name": "Statechart", "summary": """ Add Statecharts to Odoo models""", - "version": "16.0.1.0.0", + "version": "18.0.1.0.0", "license": "LGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/acsone/scobidoo", diff --git a/statechart/models/__init__.py b/statechart/models/__init__.py index f9ea52a..40251cf 100644 --- a/statechart/models/__init__.py +++ b/statechart/models/__init__.py @@ -1,2 +1,3 @@ from . import statechart from . import statechart_mixin +from . import base diff --git a/statechart/models/base.py b/statechart/models/base.py new file mode 100644 index 0000000..bbe546b --- /dev/null +++ b/statechart/models/base.py @@ -0,0 +1,22 @@ +# Copyright 2025 ACSONE SA/NV +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import api, models + + +class Base(models.AbstractModel): + """The base model, which is implicitly inherited by all models. + + Restore the _patch_method removed in Odoo 18 + """ + + _inherit = "base" + + @classmethod + def _patch_method(cls, name, method): + origin = getattr(cls, name) + method.origin = origin + # propagate decorators from origin to method, and apply api decorator + wrapped = api.propagate(origin, method) + wrapped.origin = origin + setattr(cls, name, wrapped) diff --git a/statechart/models/interpreter.py b/statechart/models/interpreter.py index e76e10c..dd694b9 100644 --- a/statechart/models/interpreter.py +++ b/statechart/models/interpreter.py @@ -7,15 +7,12 @@ from sismic.interpreter import Interpreter as SismicInterpreter from sismic.model import Event -from odoo.exceptions import except_orm - def _root_cause(e): - if isinstance(e, except_orm): - return e - if not hasattr(e, "__cause__") or not e.__cause__: - return e - return _root_cause(e.__cause__) + cause_exc = getattr(e, "__cause__", None) + if cause_exc: + return cause_exc + return e class Interpreter(SismicInterpreter): diff --git a/statechart/models/statechart_mixin.py b/statechart/models/statechart_mixin.py index 610166c..f8a1001 100644 --- a/statechart/models/statechart_mixin.py +++ b/statechart/models/statechart_mixin.py @@ -321,9 +321,14 @@ class can override the statechart with another one adding new events, @api.model def _get_sc_event_allowed_field_names(self): + ignore_for_has_allowed_events = self.env.context.get( + "ignore_for_has_allowed_events", [] + ) event_names = self._statechart.events_for() return [ - _sc_make_event_allowed_field_name(event_name) for event_name in event_names + _sc_make_event_allowed_field_name(event_name) + for event_name in event_names + if event_name not in ignore_for_has_allowed_events ] @api.depends("sc_state") diff --git a/statechart/static/description/index.html b/statechart/static/description/index.html index d8c952f..aed6ead 100644 --- a/statechart/static/description/index.html +++ b/statechart/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -368,7 +369,7 @@

Statechart

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:63949f6cfdabc7f7e60a2b3d75f934f75c6024666a807e4e916a56bd23a09ec9 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 acsone/scobidoo

+

Beta License: LGPL-3 acsone/scobidoo

Add statecharts to Odoo models.

Table of contents

@@ -397,7 +398,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -410,7 +411,7 @@

Authors

Maintainers

-

This module is part of the acsone/scobidoo project on GitHub.

+

This module is part of the acsone/scobidoo project on GitHub.

You are welcome to contribute.

diff --git a/statechart/static/src/core/errors/error_dialogs.esm.js b/statechart/static/src/core/errors/error_dialogs.esm.js new file mode 100644 index 0000000..b2304a7 --- /dev/null +++ b/statechart/static/src/core/errors/error_dialogs.esm.js @@ -0,0 +1,10 @@ +import {WarningDialog, odooExceptionTitleMap} from "@web/core/errors/error_dialogs"; +import {_t} from "@web/core/l10n/translation"; +import {registry} from "@web/core/registry"; + +registry + .category("error_dialogs") + .add("odoo.addons.statechart.exceptions.NoTransitionError", WarningDialog); + +odooExceptionTitleMap["odoo.addons.statechart.exceptions.NoTransitionError"] = + _t("Transition Error"); diff --git a/statechart_demo/README.rst b/statechart_demo/README.rst index 44ee5a6..dc96caa 100644 --- a/statechart_demo/README.rst +++ b/statechart_demo/README.rst @@ -17,7 +17,7 @@ Statechart Demo :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-acsone%2Fscobidoo-lightgray.png?logo=github - :target: https://github.com/acsone/scobidoo/tree/16.0/statechart_demo + :target: https://github.com/acsone/scobidoo/tree/18.0/statechart_demo :alt: acsone/scobidoo |badge1| |badge2| |badge3| @@ -28,7 +28,7 @@ Demonstration of parallel states on the ``res.partner`` model. |Parallel states| -.. |Parallel states| image:: https://raw.githubusercontent.com/acsone/scobidoo/16.0/statechart_demo/models/res_partner_statechart.png +.. |Parallel states| image:: https://raw.githubusercontent.com/acsone/scobidoo/18.0/statechart_demo/models/res_partner_statechart.png **Table of contents** @@ -41,7 +41,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -56,6 +56,6 @@ Authors Maintainers ----------- -This module is part of the `acsone/scobidoo `_ project on GitHub. +This module is part of the `acsone/scobidoo `_ project on GitHub. You are welcome to contribute. diff --git a/statechart_demo/__manifest__.py b/statechart_demo/__manifest__.py index 3a7e57d..7c11288 100644 --- a/statechart_demo/__manifest__.py +++ b/statechart_demo/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Statechart Demo", "summary": """Demo workflows for the statechart module""", - "version": "16.0.1.0.0", + "version": "18.0.1.0.0", "license": "LGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/acsone/scobidoo", diff --git a/statechart_demo/static/description/index.html b/statechart_demo/static/description/index.html index f680494..cbf6782 100644 --- a/statechart_demo/static/description/index.html +++ b/statechart_demo/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -368,10 +369,10 @@

Statechart Demo

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:2c5bc3858802d5813ebc802651968e3257c8bfc4c9c6cf47d757020eccef1d28 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 acsone/scobidoo

+

Beta License: LGPL-3 acsone/scobidoo

Demo workflows for the statechart module.

Demonstration of parallel states on the res.partner model.

-

Parallel states

+

Parallel states

Table of contents

    @@ -388,7 +389,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

@@ -401,7 +402,7 @@

Authors

Maintainers

-

This module is part of the acsone/scobidoo project on GitHub.

+

This module is part of the acsone/scobidoo project on GitHub.

You are welcome to contribute.

diff --git a/statechart_demo/views/res_partner_views.xml b/statechart_demo/views/res_partner_views.xml index 4963cc4..23b8f4d 100644 --- a/statechart_demo/views/res_partner_views.xml +++ b/statechart_demo/views/res_partner_views.xml @@ -11,33 +11,26 @@ name="track_1_validate" type="object" string="Validate (track 1)" - attrs="{'invisible': [('sc_track_1_validate_allowed', '=', False)]}" + invisible="not sc_track_1_validate_allowed" class="btn-primary" /> - - - + + + -