From 4ebf6be9b94fa7ceaa2c4812f0d6205d10c5003a Mon Sep 17 00:00:00 2001 From: hda Date: Wed, 12 Feb 2025 12:03:36 +0100 Subject: [PATCH 1/5] [18.0][MIG] statechart --- statechart/README.rst | 6 +-- statechart/__manifest__.py | 2 +- statechart/static/description/index.html | 6 +-- statechart_demo/README.rst | 8 ++-- statechart_demo/__manifest__.py | 2 +- statechart_demo/static/description/index.html | 8 ++-- statechart_demo/views/res_partner_views.xml | 13 ++---- test_statechart/README.rst | 6 +-- test_statechart/__manifest__.py | 2 +- test_statechart/static/description/index.html | 6 +-- test_statechart/views/purchase_order.xml | 43 +++++++------------ 11 files changed, 41 insertions(+), 61 deletions(-) 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/static/description/index.html b/statechart/static/description/index.html index d8c952f..5cc78ff 100644 --- a/statechart/static/description/index.html +++ b/statechart/static/description/index.html @@ -368,7 +368,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 +397,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 +410,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/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..1bf6bee 100644 --- a/statechart_demo/static/description/index.html +++ b/statechart_demo/static/description/index.html @@ -368,10 +368,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 +388,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 +401,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..b138ccd 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="sc_track_1_validate_allowed" class="btn-primary" /> - - - + + + - From 8eceab3a9c42b4ef3cc823135846df3dd17c8ef3 Mon Sep 17 00:00:00 2001 From: hda Date: Wed, 12 Feb 2025 14:59:25 +0100 Subject: [PATCH 2/5] [18.0][MIG] statechart / test / demo --- statechart/models/__init__.py | 1 + statechart/models/base.py | 22 ++++++++++++++++++++ statechart/models/interpreter.py | 4 ++-- statechart_demo/views/res_partner_views.xml | 6 +++--- test_statechart/__manifest__.py | 1 + test_statechart/security/ir.model.access.csv | 2 ++ test_statechart/tests/test_basic.py | 4 ++-- test_statechart/tests/test_inherit.py | 5 ++--- test_statechart/tests/test_po_statechart.py | 9 ++++---- test_statechart/views/purchase_order.xml | 9 +++----- 10 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 statechart/models/base.py create mode 100644 test_statechart/security/ir.model.access.csv 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..d4cc9ae 100644 --- a/statechart/models/interpreter.py +++ b/statechart/models/interpreter.py @@ -7,11 +7,11 @@ from sismic.interpreter import Interpreter as SismicInterpreter from sismic.model import Event -from odoo.exceptions import except_orm +from odoo.exceptions import UserError def _root_cause(e): - if isinstance(e, except_orm): + if isinstance(e, UserError): return e if not hasattr(e, "__cause__") or not e.__cause__: return e diff --git a/statechart_demo/views/res_partner_views.xml b/statechart_demo/views/res_partner_views.xml index b138ccd..23b8f4d 100644 --- a/statechart_demo/views/res_partner_views.xml +++ b/statechart_demo/views/res_partner_views.xml @@ -11,21 +11,21 @@ name="track_1_validate" type="object" string="Validate (track 1)" - invisible="sc_track_1_validate_allowed" + invisible="not sc_track_1_validate_allowed" class="btn-primary" /> From f10c16716cd75fcb755f4e16521e4cf52fe38275 Mon Sep 17 00:00:00 2001 From: Justine Doutreloux Date: Tue, 8 Aug 2023 13:41:34 +0200 Subject: [PATCH 3/5] [IMP] stachechat_mixin: make it possible to ignore some events in the has_allowed_event compute --- statechart/models/statechart_mixin.py | 7 ++++- test_statechart/models/test_statechart.yml | 8 ++++++ test_statechart/tests/test_basic.py | 31 ++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) 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/test_statechart/models/test_statechart.yml b/test_statechart/models/test_statechart.yml index 39a63a0..0b26470 100644 --- a/test_statechart/models/test_statechart.yml +++ b/test_statechart/models/test_statechart.yml @@ -10,10 +10,18 @@ statechart: target: confirmed1 - target: confirmed1 guard: o.amount < 1 + - target: canceled + event: cancel - name: confirmed1 transitions: - target: confirmed2 guard: o.amount < 100 - target: confirmed2 event: confirm2 + - target: canceled + event: cancel - name: confirmed2 + transitions: + - target: canceled + event: cancel + - name: canceled diff --git a/test_statechart/tests/test_basic.py b/test_statechart/tests/test_basic.py index 90e915b..b57b2a0 100644 --- a/test_statechart/tests/test_basic.py +++ b/test_statechart/tests/test_basic.py @@ -35,3 +35,34 @@ def test_automatic_transition_on_create(self): record = model.create({"amount": 0.5}) # very small amount, step 1 and 2 done automatically self.assertScState(record.sc_state, ["confirmed2", "root"]) + + def test_get_sc_event_allowed_field_names(self): + """ + Test that we can ignore certain events based on a context + key (ignore_for_has_allowed_events) + """ + model = self.env["scobidoo.test.model"] + record = model.create({"amount": 200}) + record.confirm1() + self.assertScState(record.sc_state, ["confirmed1", "root"]) + + # 2 events are allowed: confirmed2 and cancel + self.assertEqual(record.sc_has_allowed_events, True) + + # 1 event is allowed: confirmed2 + record.invalidate_cache() + self.assertEqual( + record.with_context( + ignore_for_has_allowed_events=["cancel"] + ).sc_has_allowed_events, + True, + ) + + # no event allowed + record.invalidate_cache() + self.assertEqual( + record.with_context( + ignore_for_has_allowed_events=["cancel", "confirm2"] + ).sc_has_allowed_events, + False, + ) From 42e54791a8f17330f0d7e207cc8e89ffd52759f8 Mon Sep 17 00:00:00 2001 From: Benjamin Willig Date: Fri, 5 Jul 2024 10:53:08 +0200 Subject: [PATCH 4/5] [FIX] reraise __cause__ of the CodeEvaluationError if it exists as we want the final exception before CodeEvaluationError and not the root one --- statechart/models/interpreter.py | 11 ++++------- statechart/static/description/index.html | 7 ++++--- statechart_demo/static/description/index.html | 7 ++++--- test_statechart/static/description/index.html | 7 ++++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/statechart/models/interpreter.py b/statechart/models/interpreter.py index d4cc9ae..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 UserError - def _root_cause(e): - if isinstance(e, UserError): - 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/static/description/index.html b/statechart/static/description/index.html index 5cc78ff..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 { diff --git a/statechart_demo/static/description/index.html b/statechart_demo/static/description/index.html index 1bf6bee..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 { diff --git a/test_statechart/static/description/index.html b/test_statechart/static/description/index.html index fd23d9c..df19b51 100644 --- a/test_statechart/static/description/index.html +++ b/test_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 { From aed01d8c80a52437a3053321dd22a0c4b3e3000c Mon Sep 17 00:00:00 2001 From: Thomas Binsfeld Date: Tue, 5 Aug 2025 16:22:46 +0200 Subject: [PATCH 5/5] [MIG] statechart 18.0 --- setup/.setuptools-odoo-make-default-ignore | 2 -- setup/README | 2 -- setup/_metapackage/VERSION.txt | 1 - setup/_metapackage/setup.py | 20 ------------------- setup/statechart/odoo/addons/statechart | 1 - setup/statechart/setup.py | 6 ------ .../odoo/addons/statechart_demo | 1 - setup/statechart_demo/setup.py | 6 ------ .../odoo/addons/test_statechart | 1 - setup/test_statechart/setup.py | 6 ------ .../src/core/errors/error_dialogs.esm.js | 10 ++++++++++ .../security/purchase_order_delegated.xml | 2 -- .../security/thing_with_mailthread.xml | 2 -- test_statechart/tests/test_basic.py | 4 ++-- 14 files changed, 12 insertions(+), 52 deletions(-) delete mode 100644 setup/.setuptools-odoo-make-default-ignore delete mode 100644 setup/README delete mode 100644 setup/_metapackage/VERSION.txt delete mode 100644 setup/_metapackage/setup.py delete mode 120000 setup/statechart/odoo/addons/statechart delete mode 100644 setup/statechart/setup.py delete mode 120000 setup/statechart_demo/odoo/addons/statechart_demo delete mode 100644 setup/statechart_demo/setup.py delete mode 120000 setup/test_statechart/odoo/addons/test_statechart delete mode 100644 setup/test_statechart/setup.py create mode 100644 statechart/static/src/core/errors/error_dialogs.esm.js 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/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/test_statechart/security/purchase_order_delegated.xml b/test_statechart/security/purchase_order_delegated.xml index 476b6c0..5c4f1c1 100644 --- a/test_statechart/security/purchase_order_delegated.xml +++ b/test_statechart/security/purchase_order_delegated.xml @@ -2,7 +2,6 @@ - purchase.order.delegated access @@ -52,5 +51,4 @@ - diff --git a/test_statechart/security/thing_with_mailthread.xml b/test_statechart/security/thing_with_mailthread.xml index 76887fa..ad7cdaf 100644 --- a/test_statechart/security/thing_with_mailthread.xml +++ b/test_statechart/security/thing_with_mailthread.xml @@ -2,7 +2,6 @@ - thing.with.mailthread access @@ -12,5 +11,4 @@ - diff --git a/test_statechart/tests/test_basic.py b/test_statechart/tests/test_basic.py index b57b2a0..aac7fe6 100644 --- a/test_statechart/tests/test_basic.py +++ b/test_statechart/tests/test_basic.py @@ -50,7 +50,7 @@ def test_get_sc_event_allowed_field_names(self): self.assertEqual(record.sc_has_allowed_events, True) # 1 event is allowed: confirmed2 - record.invalidate_cache() + record.invalidate_recordset() self.assertEqual( record.with_context( ignore_for_has_allowed_events=["cancel"] @@ -59,7 +59,7 @@ def test_get_sc_event_allowed_field_names(self): ) # no event allowed - record.invalidate_cache() + record.invalidate_recordset() self.assertEqual( record.with_context( ignore_for_has_allowed_events=["cancel", "confirm2"]