Skip to content
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: 0 additions & 2 deletions setup/.setuptools-odoo-make-default-ignore

This file was deleted.

2 changes: 0 additions & 2 deletions setup/README

This file was deleted.

1 change: 0 additions & 1 deletion setup/_metapackage/VERSION.txt

This file was deleted.

20 changes: 0 additions & 20 deletions setup/_metapackage/setup.py

This file was deleted.

1 change: 0 additions & 1 deletion setup/statechart/odoo/addons/statechart

This file was deleted.

6 changes: 0 additions & 6 deletions setup/statechart/setup.py

This file was deleted.

1 change: 0 additions & 1 deletion setup/statechart_demo/odoo/addons/statechart_demo

This file was deleted.

6 changes: 0 additions & 6 deletions setup/statechart_demo/setup.py

This file was deleted.

1 change: 0 additions & 1 deletion setup/test_statechart/odoo/addons/test_statechart

This file was deleted.

6 changes: 0 additions & 6 deletions setup/test_statechart/setup.py

This file was deleted.

6 changes: 3 additions & 3 deletions statechart/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -47,7 +47,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/acsone/scobidoo/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 <https://github.com/acsone/scobidoo/issues/new?body=module:%20statechart%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/acsone/scobidoo/issues/new?body=module:%20statechart%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand All @@ -62,6 +62,6 @@ Authors
Maintainers
-----------

This module is part of the `acsone/scobidoo <https://github.com/acsone/scobidoo/tree/16.0/statechart>`_ project on GitHub.
This module is part of the `acsone/scobidoo <https://github.com/acsone/scobidoo/tree/18.0/statechart>`_ project on GitHub.

You are welcome to contribute.
7 changes: 6 additions & 1 deletion statechart/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -19,5 +19,10 @@
},
"data": [],
"demo": [],
"assets": {
"web.assets_backend": [
"statechart/static/src/core/errors/error_dialogs.esm.js",
],
},
"installable": True,
}
14 changes: 2 additions & 12 deletions statechart/models/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
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__)


class Interpreter(SismicInterpreter):
def __init__(self, *args, **kwargs):
Expand All @@ -31,7 +21,7 @@ def execute(self, max_steps=-1):
try:
return super().execute(max_steps)
except CodeEvaluationError as e:
raise _root_cause(e).with_traceback(sys.exc_info()[2]) from e
raise (e.__cause__ or e).with_traceback(sys.exc_info()[2]) from e

def execute_once(self):
if self._in_execute_once:
Expand All @@ -41,7 +31,7 @@ def execute_once(self):
try:
return super().execute_once()
except CodeEvaluationError as e:
raise _root_cause(e).with_traceback(sys.exc_info()[2]) from e
raise (e.__cause__ or e).with_traceback(sys.exc_info()[2]) from e
finally:
self._in_execute_once = False

Expand Down
12 changes: 11 additions & 1 deletion statechart/models/statechart_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
_logger = logging.getLogger(__name__)


def _patch_method(cls, name, method):
"""This method was part of the Model class in Odoo 16 and earlier."""
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)


def _sc_make_event_allowed_field_name(event_name):
# TODO event names must be valid python identifiers
# (that must be tested somewhere long before reaching this point)
Expand Down Expand Up @@ -217,7 +227,7 @@ def partial(self, *args, **kwargs):
event_name,
cls,
)
cls._patch_method(event_name, partial)
_patch_method(cls, event_name, partial)
else:
raise UserError(
_(
Expand Down
13 changes: 7 additions & 6 deletions statechart/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +369,7 @@ <h1 class="title">Statechart</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:63949f6cfdabc7f7e60a2b3d75f934f75c6024666a807e4e916a56bd23a09ec9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/acsone/scobidoo/tree/16.0/statechart"><img alt="acsone/scobidoo" src="https://img.shields.io/badge/github-acsone%2Fscobidoo-lightgray.png?logo=github" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/acsone/scobidoo/tree/18.0/statechart"><img alt="acsone/scobidoo" src="https://img.shields.io/badge/github-acsone%2Fscobidoo-lightgray.png?logo=github" /></a></p>
<p>Add statecharts to Odoo models.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down Expand Up @@ -397,7 +398,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/acsone/scobidoo/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/acsone/scobidoo/issues/new?body=module:%20statechart%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/acsone/scobidoo/issues/new?body=module:%20statechart%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -410,7 +411,7 @@ <h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/acsone/scobidoo/tree/16.0/statechart">acsone/scobidoo</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/acsone/scobidoo/tree/18.0/statechart">acsone/scobidoo</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
Expand Down
10 changes: 10 additions & 0 deletions statechart/static/src/core/errors/error_dialogs.esm.js
Original file line number Diff line number Diff line change
@@ -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");
8 changes: 4 additions & 4 deletions statechart_demo/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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**

Expand All @@ -41,7 +41,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/acsone/scobidoo/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 <https://github.com/acsone/scobidoo/issues/new?body=module:%20statechart_demo%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/acsone/scobidoo/issues/new?body=module:%20statechart_demo%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand All @@ -56,6 +56,6 @@ Authors
Maintainers
-----------

This module is part of the `acsone/scobidoo <https://github.com/acsone/scobidoo/tree/16.0/statechart_demo>`_ project on GitHub.
This module is part of the `acsone/scobidoo <https://github.com/acsone/scobidoo/tree/18.0/statechart_demo>`_ project on GitHub.

You are welcome to contribute.
2 changes: 1 addition & 1 deletion statechart_demo/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 8 additions & 7 deletions statechart_demo/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,10 +369,10 @@ <h1 class="title">Statechart Demo</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2c5bc3858802d5813ebc802651968e3257c8bfc4c9c6cf47d757020eccef1d28
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/acsone/scobidoo/tree/16.0/statechart_demo"><img alt="acsone/scobidoo" src="https://img.shields.io/badge/github-acsone%2Fscobidoo-lightgray.png?logo=github" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/acsone/scobidoo/tree/18.0/statechart_demo"><img alt="acsone/scobidoo" src="https://img.shields.io/badge/github-acsone%2Fscobidoo-lightgray.png?logo=github" /></a></p>
<p>Demo workflows for the statechart module.</p>
<p>Demonstration of parallel states on the <tt class="docutils literal">res.partner</tt> model.</p>
<p><img alt="Parallel states" src="https://raw.githubusercontent.com/acsone/scobidoo/16.0/statechart_demo/models/res_partner_statechart.png" /></p>
<p><img alt="Parallel states" src="https://raw.githubusercontent.com/acsone/scobidoo/18.0/statechart_demo/models/res_partner_statechart.png" /></p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -388,7 +389,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/acsone/scobidoo/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/acsone/scobidoo/issues/new?body=module:%20statechart_demo%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/acsone/scobidoo/issues/new?body=module:%20statechart_demo%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -401,7 +402,7 @@ <h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-4">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/acsone/scobidoo/tree/16.0/statechart_demo">acsone/scobidoo</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/acsone/scobidoo/tree/18.0/statechart_demo">acsone/scobidoo</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
Expand Down
13 changes: 3 additions & 10 deletions statechart_demo/views/res_partner_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
<button
name="track_2_validate"
type="object"
string="Validate (track 2)"
attrs="{'invisible': [('sc_track_2_validate_allowed', '=', False)]}"
invisible="not sc_track_2_validate_allowed"
class="btn-primary"
/>
<button
name="validate"
type="object"
string="Validate"
attrs="{'invisible': [('sc_validate_allowed', '=', False)]}"
invisible="not sc_validate_allowed"
class="btn-primary"
/>
<field name="sc_state" />
</header>
</xpath>
<xpath expr="/form" position="inside">
<group name="sc_invisible_fields" invisible="1">
<field name="sc_track_1_validate_allowed" />
<field name="sc_track_2_validate_allowed" />
<field name="sc_validate_allowed" />
</group>
</xpath>
</field>
</record>
</odoo>
Loading
Loading