diff --git a/NEWS.rst b/NEWS.rst index a4274b7055fa21013a89f3cb5bd824745c053220_TkVXUy5yc3Q=..48ec25e39dd8df9fae6e34a9689464dadf496142_TkVXUy5yc3Q= 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -1,6 +1,6 @@ Changelog ========= -18.0.1.1.0 +18.0.1.0.1 ---------- @@ -5,6 +5,5 @@ ---------- -* Provides a way for other modules to define a message type. * Fix message body encoding and display. 18.0.1.0.0 diff --git a/models/xbus_message.py b/models/xbus_message.py index a4274b7055fa21013a89f3cb5bd824745c053220_bW9kZWxzL3hidXNfbWVzc2FnZS5weQ==..48ec25e39dd8df9fae6e34a9689464dadf496142_bW9kZWxzL3hidXNfbWVzc2FnZS5weQ== 100644 --- a/models/xbus_message.py +++ b/models/xbus_message.py @@ -46,7 +46,7 @@ # is only used to display information uid = fields.Char(string="UID", readonly=True) - type = fields.Selection(selection="_get_type_selection", required=True) + type = fields.Selection([], required=True) header = fields.Binary(attachment=False) @@ -88,12 +88,6 @@ return False return False - def _get_type_selection(self): - """Provides a list of message type selection values. - Should return a list of value-label tuples. - """ - raise NotImplementedError - link_ids = fields.One2many( comodel_name="xbus.message.link", string="Linked Records", diff --git a/tests/models.py b/tests/models.py index a4274b7055fa21013a89f3cb5bd824745c053220_dGVzdHMvbW9kZWxzLnB5..48ec25e39dd8df9fae6e34a9689464dadf496142_dGVzdHMvbW9kZWxzLnB5 100644 --- a/tests/models.py +++ b/tests/models.py @@ -17,7 +17,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################# -from odoo import models # type: ignore[import-untyped] +from odoo import fields, models # type: ignore[import-untyped] class XbusMessage(models.Model): @@ -26,7 +26,7 @@ _inherit = "xbus.message" - def _get_type_selection(self): - return [ + type = fields.Selection( + selection_add=[ ("test_1", "Test Message Type 1"), ("test_2", "Test Message Type 2"), @@ -31,3 +31,5 @@ ("test_1", "Test Message Type 1"), ("test_2", "Test Message Type 2"), - ] + ], + ondelete={"test_1": "cascade", "test_2": "cascade"}, + )